EntBlog
Code, 3D, Games, Linux and much more...
See you in Gamelab^Oviedo!
June 26, 2007 @ 2:14 | In Programming, Videogames | 13 Comments |

I am giving a presentation about Technology in VideoGames in the Gamelab 2007 Conference that is being held in Oviedo / Spain this year. My idea is to give a general overview of the current challenges real time developers have to face when developing a videogame. Is is not intended to be a deeply technical presentation.
I am proud that events like these are held in Spain. We need them to promote the industry. And undoubtly, this is going to be a high quality event (reading the name of the rest of the lecturers).
See you there gambiteros!
Update:as promised, here is the link to the power point presentation: Retos tecnológicos en Videojuegos. Be patient with the download speed
Back-of-the-envelope
April 19, 2007 @ 0:00 | In Programming | 2 Comments |

There is a technique not widely known in computing engineering that is very useful to estimate calculations: back-of the-envelope calculations. Being able to estimate properly is crucial for software engineers. Of course, there is a lot you can learn by the experience. But this skill can be improved with training.
Back-of-the-envelope calculations estimate based on rough approximations than can be derived from common sense. The back-of-the-envelope term comes from the idea that those calculations are so simple that you can write them down in the back of an envelope. Obviously you don’t have to use an envelope at all for this technique.
You need a question whose answer doesn’t have a practical way to be exactly calculated. For example, how long would it take you to fill a floppy disk by typing? A floppy disk contains 1.44 megabytes. Estimating that you can type at a rate of 50 words per minute (300 bytes), you write 1 kb in 3 minutes, 1Mb in 3000 minutes and 1.44 in 4500 minutes or 75 hours.
As you can see, you round your calculations to easy numbers in the same order of magnitude. Extrapolating knowledge is useful too. If you like to read more about this, I recommend the book Programming Pearls by Jon Bentley. It is online, and the chapter about this can be found here.
Apart from obvious rules, there are more interesting ones. For example, Jon Bentley describes the Little’s Law in his book: “The average number of things in the system is the product of the average rate at which things leave the system and the average time each one spend in the system”.
An example using the Little’s Law to estimate your city’s death rate, measured in percent of population per year: if the life expectancy is 70 years (1 person = 70 (average rate) * death rate) then death rate is 1/70 or 1.4% of the population each year.
And now, more interesting questions (without answers…): How much time does your team spend waiting for the compiler to finish its work? How much money does your studio lose due to that? How much time will take that new feature? When will the game be ready for production?
Want to evaluate your proficiency estimating things? Try this quiz. I got only a poor 5. Probably, I need to improve my estimation skill. What did you get?
Test-Driven Development by Example
March 13, 2007 @ 3:17 | In Books, Programming | No Comments |
Test-Driven Development by Example
Author: Kent Beck
Pages: 220
Published: 2003
Test-Driven Development is part of the Extreme Programming movement, created by Kent Beck (author of the book), Ward Cunningham and Ron Jeffries. It is an iterative technique to develop software where you only code the things that are strictly necessary.
If you want a new feature in your code you write a test using that feature and later you write the new code that makes that test work properly. You write new code only if an automated test has failed. And iteratively you continue until you finish all the requisites. Between test and test you always have a code that compiles and works.
This is described by Kent Beck as the Red/Green/Refactor rule:
- Red - Write a little test that doesn’t work, and perhaps doesn’t ever compile at first
- Green - Make the test work quickly, committing whatever seems necessary in the process
- Refactor - Eliminate all of the duplication created in merely getting the test to work
The book itself is written using this philosophy. With small steps the first part of the book teachs you the technique with a very simple example. The second part describes a more complicated example and introduces a framework for writing tests. Third part is dedicated to patterns for Test-Driven Development.
Part two and three of the book were boring to me but I really enjoyed the first part of the book. It is an example very well written and very easy to read that demonstrates you the heart of the technique. I like the incremental approach of writing source code that always compiles (something that I have been using for years) against the opposite technique: writing tons of code at first and later spending hours (even days) making it to compile.
Although you probably won’t be able to put into real practice the entire philosophy (I’d like to see a real project 100% Test-Driven Developed) you can learn very valuable things from this book: tests are useful and simplicity is your friend.
Rating: 8 / 10
Fast File Loading / part II - Load-In-Place
February 21, 2007 @ 0:15 | In Programming | 18 Comments |
In my first article on Fast File Loading, I described techniques directly related with the hardware and the Operating System to load files in the most efficient way. In this one, a technique for organizing the data to be loaded as fast as possible is described. Basically, we are going to load data without doing any parsing at all. Although the techniques described here are oriented towards realtime applications, any application could use them to accelerate its load times.
The implementation and all the samples shown here can be found in a project that you can download. It is a project for Microsoft Visual Studio 8.0 and it has been tested under a 32-bit architecture. Extensions to other compilers and other architectures should be easy to add. This code must be taken as a proof of concept and not as a solid and robust implementation ready to be used in a project. I have tried to isolate the dependencies with other systems so that you can concentrate in the topic of this article.
Click to read the full article
Exceptional C++ Style
November 30, 2006 @ 3:35 | In Books, Programming | 3 Comments |
Exceptional C++ Style
Author: Herb Sutter
Pages: 325
Published: 2005
I have been programming C++ for more than 15 years following the evolution of one of the more mature languages still in use today. There have been lot of changes since the beginning, and more of them are to come. Yes, may be it is time for change to other more modern language but I still enjoy learning new things about C++. And if those things are taught by Herb Sutter the reading becomes almost obligatory.
Exceptional C++ Style continues where Exceptional C++ and More Exceptional C++ left off. With the same philosophy than the previous books (topics classified by category and with a associated difficulty rating) the author cover topics previously described in other publications: C/C++ User Journal, Dr. Dobb’s Journal, Guru of the Week, etc.
The book is divided into seven parts: Generic Programming and the C++ Standard Library, Exception Safety Issues and Techniques, Class Design - Inheritance and Polymorphism, Memory and Resource Management, Optimization and Efficiency, Traps - Pitfalls and Puzzlers (really funny) and Style Case Studies (where the author himself dissects real-world published code finishing with a depth analysis of std::string and why its monolith design was really a bad decision)
I really enjoyed the book while learning more things about the language: why you should overload template functions instead of specialize, the current status of the export keyword, what the distinct levels of exception safety are, what the Nonvirtual Interface pattern is, why you should make destructors for a base class public virtual or protected nonvirtual, a precise description of the implications of the inline keyword, etc, etc…
In conclusion, if C++ is your main programming language and you really like it, you should read this book.
Rating: 8 / 10
Fast File Loading
October 25, 2006 @ 0:41 | In Programming | 17 Comments |
Reading data efficiently from Hard Disk and DVD units is vital for video games and one of the more important problems to solve in the next generation of games. While we are getting 20x performance in processing power and memory size, we are only getting 4x performance improvement in data devices (dvd for consoles).
I describe in this post how to efficiently read raw data from disk (hdd, dvd) oriented towards streaming files in a realtime application (although the concepts are useful in other areas). The platform used is Win32, but all the topics covered could be easily ported to other platforms.
Click to read the full article
Best C++ Books
August 11, 2006 @ 22:01 | In Books, Programming | 3 Comments |
Scott Meyers (author of the Effective C++ saga) has written on his blog a list of the most important C++ books written to date. I had this same idea and may be this is a good time to publish my list so you can compare. This is my personal ranking of the five best C++ books:
- The C++ Programming Language
Although I have not read the last Special 3rd Edition (it is in my list of books to be bought), I always have the 3rd edition handy as my C++ reference book. It is written in a academic style ready to be consulted whenever you have questions about all the language details.
- Effective C++
I wrote a mini review of this book months ago.
If you are a serious C++ programmer this book is a must read for you. If you haven’t read it stop wasting your time reading this blog and get a copy of the book. Effective C++ is the perfect book to accompany your main C++ book. Although intended to be your secondary book on C++, Effective C++ will learn you more that simple C++ tricks - C++ Coding Standards. 101 Rules, Guidelines, and Best Practices
I also wrote a review for this.
The book is more high-level than other related books (Effective C++, Modern C++ Design, Exceptional C++) and all the topics about C++ can be found in those books. You won’t find new topics or advices. But this book is about standars for your development team. In fact, it is designed to be used as a basic for your team’s coding standards. You can get good ideas from this book to be discussed with your team (and in fact, you do not have to agree all of them): coding conventions, hungarian notation, automated build system, version control, code reviews, etc. - Exceptional C++
The book version of the Guru of the Week webpage created and written by Herb Sutter. This book includes expanded versions of the first 30 issues on that popular page.
- Modern C++ Design
Template Metaprogramming in C++ was born with this book. This book will open your mind to choose the red pill. Even if you think templates will do more harm than good in your team at least you should read this book to know the enemy. The book describes an actual C++ library called Loki. I have work in lots of projects where subparts of that library was being used. This book is the hardest of the five, be prepared!
Debugging Applications
July 15, 2006 @ 18:36 | In Books, Programming | No Comments |

Debugging Applications for Microsoft .NET and Microsfot Windows
Author: John Robbins
Pages: 801
Published: 2003
If you read MSDN, you probably read the column Bugslayer written by John Robbins. I’m a fan of Bugslayer so when I discovered this book I couldn’t resist to buy and read it.
This book is the Holy Bible for debugging. Seriously, I didn’t think someone could write more than 800 useful pages about debugging before reading Debugging Applications. 80% of the book is dedicated to Native Programming and the rest is for Managed Programming. Both using Microsoft Visual Studio 2003.
The book is divided in four parts. The first part is about general debugging topics not related with Windows: What Are Bugs?, Debugging Process, Bug Tracking Systems, Regression Tests, Defensive Programming (the chapter dedicated to assertions should be a must read for every member of a programming team).
The second part is about Win32 and .NET debugging support with two chapters entirely dedicated to native code: x86 assembly, symbols, dump files, windbg…
Third part is about Tools for debugging. It describes how to extend the Visual Studio IDE, introducion to Add-Ins and profiling API for .NET.
The fourth part is entirely dedicated to Native Code Techniques: Crash Handlers, Windows Services, Multithread Deadlocks, Automated Testing, C Run-Time Library and Working Set are the more relevants topics.
I really recommend this book. John Robbins is an expert and it is demonstrated in a very well written book. I really enjoyed reading this book.
By the way, the next revision of this book will be break into two books: one for the managed and one for native. The .NET version is already available for presale in Amazon
Rating: 9 / 10
Setting up a Symbol Server
July 6, 2006 @ 2:27 | In Programming | 5 Comments |
Debug symbols allow you to have better debugging sessions. They have information about the functions contained in executables and dynamic libraries and provide you with information to get clean call stacks. A Symbol Server allows the debugger to load the correct symbols, binaries and sources automatically.
In this article, I describe how to set up a Symbol Server for your programming team to store symbols (from the operating system, third party libraries and from your own libraries), binaries and source code to improve the productivity of the team and the service given to your clients.
Click to read the full article
C++ Coding Standards
May 30, 2006 @ 1:22 | In Books, Programming | 1 Comment |

C++ Coding Standards. 101 Rules, Guidelines, and Best Practices
Author: Herb Sutter, Andrei Alexandrescu
Pages: 220
Published: 2005
Although a little bit tired of reading gem style books (Effective C++, Game Programming Gems, AI Game Programming Wisdom, GPU Gems, ShaderX, …) the authority of the authors made me find time to read C++ Coding Standards. Definitely, it was well invested time.
The book is divided in twelve sections (Organizational and Policy Issues; Design Style; Coding Style; Function and Operators; Class Design and Inheritance; Construction, Destruction, and Copying; Namespaces and Modules; Templates and Genericity, Error handling and Exceptions; STL: Containers; STL: Algorithms; Type Safety) each one having ten topics (more or less).
The book is more high-level than other related books (Effective C++, Modern C++ Design, Exceptional C++) and all the topics about C++ can be found in those books. You won’t find new topics or advices. But this book is about standars for your development team. In fact, it is designed to be used as a basic for your team’s coding standards. You can get good ideas from this book to be discussed with your team (and in fact, you do not have to agree all of them): coding conventions, hungarian notation, automated build system, version control, code reviews, etc.
Definitely, this book will help to improve the code quality of a team. My recommendation: read it.
Rating: 8 / 10
Wed, 20 Aug 2008 19:59:15 +0200 / 22 queries. 2.159 seconds / 3 Users Online
|
|
|
|
|
Theme modified from Pool theme. Valid XHTML and CSS






Previous Page
About