Pre-Order the Game!

Desura Digital Distribution

Sunday, December 11, 2011

Data Driven Stars and Planets almost done!

I've started work on changing from hard-coded planet and star types to one that uses data files. I've been able to convert most of the mechanisms, and made it even more flexible and powerful as a result. Originally, there's only one star sprite, and one black hole sprite, and one starShader.fx file that applies to all stars. With the new data system, you can specify which shader file to use, which sprite to use inside stars.png or planets.png (allowing for a lot more different star sprites, like binary systems for example).

This is pretty powerful system that I've set up. You can specify whether or not a star system is inhabitable (if it's a black hole, uninhabitable for example), which planets and their probability of appearing, etc. If you set a planet's max pop to be 0, then it's uninhabitable.

This is what the XML files look like for stars.xml and planets.xml:

Note that there's only two star types, the yellow star (with shader values of "1,1,0,1" or yellow with 100% opacity), and the black hole. Also note that you specify where in the png file a sprite is (for stars, it's always 64x64, for planets it's always 40x40). This is what the galaxy looks like with those data:

I plan on adding more stars and stuff, but for now I'm focusing on fixing bugs and crashes with the new system, and displaying the descriptions you saw in the data file. I'm done for the night, but would like to hear your feedback on this!


  1. Very nice! Tell me... There are asteroids... but no moon? Just curious. :-)

  2. Moons aren't supported in the game. However, you could "fake" it by drawing a planet with a moon, and call it "Terran With a Moon" if you really want moons :)

    To add moons would introduce complex code and UI, just to add a new type of planet. The benefits don't outweigh the cost and complexity it will be to have them in this game. But you can add more planets in a star, just increase the min/max value for planets in a star.