Development news

May, 31

I always try to make bigger code changes right after releasing a new version, so they get tested as much as possible before seeing the light of the day. This time the first task was to factor out creature body simulation out of other creature logic (like movement and other interactions). It was partly to have cleaner code, and partly to introduce new features. In essence, all the code to simulate the body, like keeping track of body parts, health and attributes like size, weight, applying damage, etc. is now self contained and independent of other calculations.

This breaks ground for more detailed features, like new body materials, different damage models or attack types. Before, they had to be implemented as special cases, so it’s a nice step forward.

After working on bodies, I dove in to decrease memory consumption of the game. Alpha18 typically uses a bit over 1gb of RAM for the maximum campaign settings, but there is also a rapid increase during saving the game (up to 500mb). Most of the memory is used for storing the terrain, as there are about half a million squares altogether in all of the maps. I used some tricks to have much of the terrain objects share the same memory, so for example, if there are a thousand trees on a map, they are all actually represented by the same object. If you make any change to a square, for example burn a tree or drop an item, the game creates a separate copy of that square to be to modify it. Memory usage was this way reduced by half. I have further plans for another 50% decrease, which will give some room to increase map numbers in campaign.

Lastly, I started to port KeeperRL to SDL, which is the standard library in the game industry used for graphics, sound and other things. It should let me get rid of a few annoying bugs, and add some minor features, like a custom mouse cursor and more detailed minimap.

Last time I promised another hotfix update to Alpha18, but I decided to rush with releasing Alpha19 instead, as it’s not a huge update, and have most of the (known) bugs fixed there. I hope that 2-3 weeks will be enough to wrap it up.

COMMENTS