27 May

Week 8 Recap

Looking Back

Two months gone by, already. Time flies.

As expected, I have been busy with the loading and persistence aspect. This stuff is just hell to get right with performance in mind. Until a few days ago, I still had a mechanism which would unload terrain chunks from memory once they at a large distance from the player. Upon tracking back, those chunks would then be loaded again. First, this was a major improvement, since the chunks were not being completely generated from scratch, anymore. However, harddisk input / output tends to become a bottleneck very quickly. As it turns out, that was not even the biggest issue. Unity’s many flaws (compensated by its myriad of benefits) include the reliance on rather old Mono version, with its abysmally bad garbage collector. Frequently allocating large chunks of memory, e.g. for terrain loading, is therefore a surefire way to produce equally frequent, nasty spikes of performance drops when the garbage collector runs. Big no-no.

As a temporary solution, I simply do not evict any data, anymore. The memory footprint will appear high for a “simple” looking game, but at this time I am not willing to put in any more time into an issue which is largely out of my hands.

So, what will actually work now? Well, starting a game in one of the larger regions will take only slightly longer instead of multiple times as long as a small region start. When players move around the environment, more terrain is loaded incrementally, until the entire map resides in memory. Here is a little demonstration of the loading in the Unity editor:

The current settings in the standalone build should make it hard for players to overtake terrain building, so they should be able to seamlessly run from one corner of the map to the other. While this means that precious little time has gone into actual game features, the performance fixes will make testing a lot more bearable.

Speaking of testing, I have uploaded a new alpha build with all changes as of today. Check the forum and help me out, if you like.

Looking Forward

With the most glaring performance issues having been addressed, I have a good feeling about continuing on gameplay. Last week I mentioned the task system, especially its user interface, as a next big task for me. Next week’s goal will be enabling players to assign a “tend campfire” task to one of the companion NPCs. From there, I can iterate on the system and extend it for arbitrary tasks, as usual.

Thanks for reading and until next week.

Leave a Reply

Your email address will not be published. Required fields are marked *