Friday Facts #177 - Difficulty settings

Posted by Rseding91 on 2017-02-10, all posts

0.15 status

Work has been going swiftly on 0.15, but there are still many major topics we have left to close. We mentioned previously that our estimate for release would be near the end of February, and while this has been our internal goal, we won't quite be able to make it.

One of the main reasons for this delay is us underestimating how long it would take to stabilize 0.14 and the new multiplayer code. We thought that because it was a relatively small 'major' release, that it would not take much time to make it stable. However the great community members playing the experimental version kept finding bugs for us to fix, and even now there are still several 0.14 bugs being identified and fixed in 0.15.

The extending bug fixing of 0.14 was no doubt necessary, but it has led us to be somewhat behind schedule on several features of 0.15. Our current optimistic estimate is that we will be able to release an experimental version of 0.15 at the end of March, and we will keep you all up to date on its progress.

Difficulty settings

I recently finished the backing logic changes to add the new 'advanced' section of the generate-map GUI. At the moment it includes settings to adjust pollution, evolution, biter expansion, and recipe/technology complexity. Pollution, evolution, and biter expansion have always been adjustable either through mods or console commands but recipe and technology complexity is something completely new.

The options include: simple, normal, and complex. At the moment the base game only has definitions for 'normal' but we may expand it.

The different options allow for 3 distinct technology or recipe trees. For instance complex could have technologies that don’t exist in simple/normal, with differing prerequisites and resource amounts. Another example could be a 'simple' gun turret recipe could just require iron plate and iron gear wheels. What I’m trying to say is: it’s not a simple "item craft time is twice as long" type system. The new settings are completely optional for mods so it has a no impact when not used.

One of the main motivations for adjustable recipe complexity, is allowing shorter game lengths for those who can't sink 3+ hours in a single session. Especially for any competitive multiplayer, reducing the time investment for some scenarios will help bring in more players.

Modded load-map performance

While reading the forums recently I came across someone offering modding help that commented something along the lines of "don’t save a lot of game references because it’s really slow to load them". I quickly loaded up the game with the profiler attached and sure enough it sat for a few minutes loading a map that would normally take half a second to load.

Some digging later and I found the cause: a simple Lua function 'set meta table' that we used when restoring the saved Lua 'global' table had O(N) operation time depending on the amount of other tables you created before calling it. When we load the game we end up iterating the entire 'global' table in the opposite order they’re created which ends up being the worst possible scenario for performance. Some re-working of how the Lua function works internally and now it always runs in O(1) time at the cost of a tiny amount more RAM used.

The end result being: loading modded games should be faster in general and much faster if you’re using mods that save a lot of game references.

So let us know if you have any thoughts and opinions you'd like to share over on our forum.