Hello! I skipped another weekly update because I didn’t have enough interesting things to share. I might as well make bi-monthly updates instead, to make posts more worthwhile. I only have a dozen hours to work on the game in an average week, so it doesn’t always amount to something interesting to share.
The last two weeks were still quite productive. Most of my time was spent on fixing bugs on the features that I added recently (such as tile effects). I also worked on the following things:
NPCs are now immune to certain abilities, status effects and tile effects, based on their element type (fire, ice, poison, etc.). For example, a spider can throw spider webs on the floor, but they no longer become entangled in their own webs. Fire elementals are obviously immune to fire spells and can go through fire fields that would normally block other NPCs. The next logical step will be to add weaknesses, which will come a little bit later.
Even after two years of development, save games are still a work in progress. Save games need to be flawless as it can be the most frustrating issue for users when they don’t work properly. I tend to focus on improving gameplay first, as if the game isn’t fun, save games are useless.
Because I want to make sure save games are rock-solid, I added a ton more unit tests to validate the data written and read from the disk. This also led to refactoring some objects to improve performance. Sometimes this means having to write less maintenable code and losing some flexibility to improve performance.
By the way, if you are a .NET developer developing unit tests, I strongly recommend using Compare Net Objects if you need to compare objects with several levels of depth. It has made writing those unit tests a lot easier.
Divided Kingdoms is an open world game, built with seamless chunks of data that can change over time. This means I can’t just save the seed and recreate chunks later, or simply load/save an array with finite length. Roguelikes such as Cataclysm: Dark Days Ahead (one of my favourite roguelikes) have the same challenge. Performance is also key as chunks need to be loaded as quickly as possible when the player holds down a movement key, including loading and destroying game objects.
That’s why I chose to persist chunk data to disk in binary format with a custom serializer to get maximum performance. I also compress the stream using Gzip to reduce the file sizes; running around the world generates chunk data which can get quite big over time.
The game is also able to load chunks that are outside the visible area (i.e. game objects rendered in the scene) and simulate events that happen in these chunks. For example, when you enter a city, the game will load all chunks of the city, but will only load game objects that are visible by the game camera. Once you leave the city, all of its chunks are ‘frozen’ in time and NPCs are ‘rehydrated’ once you go back.
In the near future, I want the game to be able to simulate events in cities while the player is away. NPCs should also ‘teleport’ where they should be according to their schedule.
I’ll try to make a more in-depth post in the future about how the chunk system works if anyone is interested.
In-line sprites in text areas
I’ve migrated several text meshes to TextMeshPro, which has the ability to add in-line sprites in bodies of text. This allows adding sprites that identify element types of attacks directly in the text descriptions. It also improves the rendering of text when zooming in on meshes with a more subtile outline effect. The message log now looks like this:
In the last few weeks, I also worked on several logos for the game. After considering many choices and asking the advice of people, I finally chose a font to create the logo for the game. Here’s how it looks:
I will most probably end up hiring someone to a make better logo later on, but for now that will do!
I’m going to work on the web site design soon; the blog is using a generic WordPress theme and I’m already tired of it!
That’s it for now. Take care and see you in two weeks!