Friday, July 2, 2010
First Rule of Optimization... Broken
There is a saying among the computer programmer types... It's that when optimizing your code, always follow these two simple rules. Rule Number 1 : Don't. And Rule Number 2 : Don't yet.
The thinking behind it is that if you are going to continue to work on the code, optimizing it now isn't really going to give you the most bang for your buck (or as the case may be, improved performance for your time). The trouble is, many of us learning coder types are writing very sloppy code that brings an otherwise smoothly running game to a broken slide show of unplayableness. And a game you can't play, you can't test... and a game you can't test, you can't improve.
So, for about 2 days this week (I only managed to get 4 days of work in this week) I attempted to improve my code to make it playable on the Xbox. And in the process, learned a lot about prioritizing updates of game objects/systems.
If it doesn't have to be updated 60 times a second, then don't update it 60 times a second.
So for a game like the one I am creating, there are a good number of things that I was updating when I didn't need to, and costing valuable CPU time... CPU time that was needed for other things.
Its been a good week, and progress has been made.
Now if I can just figure out what you are supposed to be doing in the game (I am only half joking), then everything would be set.
... I am having trouble deciding what way to present the objectives, and how the player should go about achieving said objectives... NOT A GOOD SIGN.
But I will work it out soon enough. It really is just a matter of picking between a half dozen options, trying it out, and if it doesn't work, trying something else... simple enough right?
Wish me luck.