Hi,
I’ve been working on Elite4k, a trade and space sim, since December. The game is basically a clone of evergreens like Elite and Privateer: You fly your spaceship from planet to planet, trade goods, buy upgrades, hunt pirates, mine asteroids or turn pirate yourself … I think you all get the picture I’ve almost finished the game now, with a size of around 4.8k and enough optimization potential remaining (hopefuly to reach 4k. However, some issues turned up during development which keep bothering me. I would be grateful for any input on the following questions:
Text rendering I’m currently using drawBytes to draw text from a resource byte array to a graphics context without string overhead. Is there a smarter way to do this?
Number rendering I’m currently using a method which fills a byte array from a given number by setting the current modulo-10-value of the numeric value to the current byte, then decimal shifting the number and advancing the output byte. Is there a smarter way to do this? Perhaps some light-weight number format method in the API I don’t know about?
Matrix inversion For the 3D space sim, the inverse camera matrix is required. Two ways to get it: Matrix inversion (my unrolled version is 12 lines with lots of multiplies and adds) or premultiplication with the negated matrix components. Which way to go? Premultiplication eliminates the inversion code but requires some control flow in the geometry pipeline. Any experiences?
Loading and Saving For a game where you can easily spend dozens of hours, a load and save game function is a must. The amount of game data I have to load and save is around 20 bytes. One option is to write out a text representation of the values and let the user note it down and reenter it to load a game (old-skool console style). However, 20 bytes mapped to easily typable characters is a lot of text. So I consider using the clipboard: Copy to get the current game state as a string, paste the string (which you saved in some file) to resume. Does this make sense? I’m a bit in doubt
Array Access When accessing array cells in approximately linear (depending on control flow) sequences, is it better to have something like “data[basepointer+1] (…) data[basepointer+2] (…) data[basepointer+27] (…)” or is it better to go unary where possible “data[pointer++] (…) data[pointer++] (…)”?
Thanks for your input
Wolfgang
“I’m a ****ing starship, I’m allowed to cheat!”
GCU Arbitrary, Culture Craft