patch summary

Posted On 22 Apr, 2015

This patch focused on stability improvements. I just spent a few weeks hunting memory leaks and fixing bugs and the game runs a lot better now. We also added some new stuff so click to read more.

 The main goal of this patch: Find that damn memory leak

Everyone has noticed the so called “random” crashing of the game, but the truth is that the crashing wasn’t random at all. For a while now there has been a somewhat nasty memory leak that is guaranteed to eventually crash the game from out of memory exceptions. For this patch, I sat down and tested until my eyes fell out looking for the damn thing and I finally found it. It was an architectural issue relating to saving and loading of ships as you moved from sector to sector. Anyhow, the point is that the biggest feature of this patch is vastly improved stability. You should be able to play the game for much longer now without guaranteed crashing. There is still at least one known issue that can cause a crash, but at least I made the game save properly before it dies. That issue will take a bit more research since it seems like XNA is doing something that XNA should never do. Regardless, the game is much more stable this release and if you hate buggy alphas that are guaranteed to crash but you still want to watch development from an early stage, this would be a good time to check out the game.

The second goal of this patch: Move world generation into extensions

Last patch featured a fancy system for dynamically loading backdrops from external code and loading/unloading them on a thread to change them seamlessly as you go from sector to sector. This patch continued along that path and actually took a much bigger step towards realizing our ultimate plans for world structure. We have accomplished 4 things with this update:

  1. Terrain objects in a sector are now generated by extensions code, so the mod API will allow users to define how the world’s procedural generation results in actual terrain. That means the placement, the art assets, and the collision mesh of every object in the world can be generated by mods. You can change how the default sector types are generated, or you can define your own sector types and paint them onto the world map just like you do with backdrops. You can even make an asteroid field out of images of muffins and unicorns you drew in MS paint and the engine will handle per-pixel collision and everything.
  2. Textures used by both backdrops AND terrain objects are no longer part of the game’s memory and have been moved entirely into the realm of extensions via a new type of thing: TextureBatch. The process works like this: first define a texture batch with textures grouped together based on how they will likely be used, for instance all the textures for all the asteroids in a single zone. Second, you can create a backdrop and a terrain generator using that texture batch or multiple texture batches. Third, make other backdrops and terrain generators using the same texture batch. Finally, when you run the game it will know which texture batches are needed to render each sector and they will be loaded and unloaded on the fly. This guarantees the current sector being rendered can use effectively all of the memory instead of needing to reserve tons of memory for storing the art assets of sectors that aren’t even drawn.
  3. Light values and post processing settings have been moved to the extensions. This allows someone using the mod API to fully control every aspect of a sector’s visual environment. Dense colored fog, spooky green ambient light, or really intense bloom effects are examples of the types of things you can apply now on a sector by sector basis.
  4. The actual contents of grids outside of your immediate vicinity gets put on the hard drive and taken out of memory entirely. So in summary, as you move around the map new grids near you are generated using code from extensions, then when you enter a grid it is drawn using code from extensions and textures from extensions, and finally when you leave a grid it is stored on the hard drive freeing all of the memory and helping the game run nice and smooth no matter how much of the infinite world you explore.

Also new content!

So with the ability for the world map to be almost entirely configured using extensions, me and Jan could really start focusing on parallel tasks instead of waiting for each other to finish things. I went off to fix more bugs, and Jan started crafting the visual aspects of the game map and the layout of our world;

This new patch completely changes the layout of the areas around the player’s starting zone, and if you explore a bit you will find some new types of zones with new visuals and new types of terrain. A lot of this has been manually created by Jan to replace what would result from procedural generation, so overall the world should look a bit more diverse and colorful. Also, since this is the first patch after implementing the new world gen it is really only a taste of what we will be able to do in the future.

I’ve also thrown in a few new ship types to go with one of our new zones, with any luck they will explode you when you find them.

The grand summary

So now we have a world that supports some pretty intense modding possibilities. Once people get their hands on the mod API they should find it relatively straightforward to pick a section of the infinite world, plop down some custom textures, and very easily craft their own environments, zones and layouts. Meanwhile Jan has already been using this system to create new zones and new visuals for players to explore while looking for loot, and most importantly the damn thing won’t crash as often while you do it because nearly everything that went into this patch helps optimize the game’s memory use and prevent out of memory errors.

TL/DR: more shiny less crashy