World Overhaul

Posted On 28 Apr, 2016

We have been hard at work designing the next big content patch for Zero Falls. This will be another big one, and we are still going to be working on it for a while. Here’s the short summary of what we are working on.

Upcoming video

First of all, I’ve already started making a video rant about what we are working on. By which I mean I have recorded a ~40 minute rant for which I need to edit together some decent footage before I can get it out to you. This update is probably big enough to warrant an hour long rant, but whatever. Here’s the condensed version of what is under development, and the next blog post can have video and artwork to show off.

Purpose of the update

This is our “make the world dynamic” update where we overhaul our game world in the hope of changing our static infinite map into something capable of more dynamic living components. In other words our main goal is to get the AI factions doing more interesting stuff, but we are overhauling and optimizing everything we have to touch along the way.

Philosophy of throwing out old code

If you have followed our update cycle for a few updates now, you probably know that we have a policy of absolute non-sentimentality towards our legacy code. When I write code I generally assume I’m not going to get it perfect on the first try, and when I find myself being held back by poorly written code, I often choose to give it the axe. Sometimes a module of our code starts to smell like old spaghetti, and I don’t put up with that. Instead, what I do is I follow a strand of that spaghetti until I get to the root location where things start to look like a big knot, I throw it all out, and I start building the system again from the ground up.

Every time I do this I copy from code that worked, and design using things I learned from my past failures, and the results have been universally better than what we had before. Recent examples you might look at for when I have done this in the past is when I recently made an order of magnitude improvement in concurrency by rewriting all threading, or when we rewrote our ship interior to be rendered on the GPU instead of on the CPU. In this update, the things on the chopping block are our World class and the screen for rendering the universe map, both examples of legacy code that were either horrible (universe map screen) or just buggy and disorganized and in need of redo (world code)

Stages of the update

  • TheĀ  first stage of the update was rewriting from scratch the system we use to load, unload, store, and generate the game world. This means we broke save game formats, because we are fundamentally changing how the world is represented under the hood. We did this so we could throw out some old ugly code, so we can support some interesting and big new features in the future, so we can make the game world more interesting, and just so that we can support the next stages of this project. We are mostly done with this stage
  • We have thrown out our code for rendering the universe map and started rewriting it from scratch using modern shader tech and art made by Jan instead of stuff I made by fiddling around in MS paint. It is going to look way better, and perform better too. Also the new map is going to offer mod support so that game extensions will be able to change the look of the world map in addition to changing its contents, this is one of the last steps needed before we can release the first stage of mod support tools. This stage is about half finished.
  • We are completely overhauling the save format and changing how games are loaded and saved. This won’t change much on your end, it is mostly needed to support the new loading screen which will be necessary when first starting a new game. Our world is getting more complex, which means we are going to need a pre-generation stage to prepare the world before you can enter it. This is the project I just started on yesterday.
  • The pre-generation of parts of the world allows for the next stage which is creating landmarks for the AI to interact with. Our map works on a system where stations and terrain don’t exist until a sector is generated, so by pre-generating part of the world we can drastically increase the complexity of our AI simulation by making them interact with lots of new stations and interesting locations. To this end Jan has been making a lot of new assets for stations of various types, and I have successfully trained the AI how to dock ships with things. The long term goal is to get the AI doing things more interesting than flying around in random directions and holding random cargo.
  • The final stage is another progressive overhaul of the tech tree including the first proper balancing pass for all weapons, and a pass at making all of the unlocks and the tech progression suck a lot less. In addition to making the world more interesting to interact with, we want to make the tech progression both easier on new players, and deeper for long term play, so you should expect a character wipe followed by sweeping changes to progression.

Some fun facts

  • We want the cargo inside cargo ships to depend on what those ships are doing.
  • We want ships to originate at a ship yard station, and we have designed shipyard stations.
  • The universe used to be generated one sector at a time by sampling a single simple noise system.
  • The new universe is generated on the GPU in 512×512 chunks which sample 5 different complex fractal noise channels with different parameters for each channel and 3-4 different noise functions
  • Map rendering is getting a graphics overhaul equally epic to the one applied to ship interiors.
  • Most of what we are adding is going to make the map more data driven, which means better mod support.
  • I’ve already found and fixed a huge bug which may have consequences similar to the order of magnitude performance increase caused by the threading overhaul
  • We’re making a ton of new stations, a ton of new modules, and a new biome in addition to improving the layout of the universe.
  • Probably a lot of the existing “random” bugs in the game are due to crummy world code which we have just replaced.
  • An offshoot of this upgrade is that there can be more than one world type, which could support the addition of future game modes other than sandbox story mode.