D2 log 002 – Entity system ready

Phew, new entity system is up and running.

First I wrote standalone code for basic entity management and a few unit tests to make sure it worked properly.

Next step was to integrate it into the existing codebase. Quite a transplant!

There were raw Entity pointers throughout the codebase and lifetime, ownership & validity checks were not exactly a solved problem – at least not systematically.

I also had to make sure the serialization still worked and preserve the same entity IDs across load/save cycles. Perhaps not 100% necessary but I want the diffs to look tidy.

Last major issue was the level editor, which needs to hold on to entities for a little longer than the rest of the game for undo/redo support. I added custom methods to remove them from the entity list without deallocating and to add them back with the same EntityID.

The level editor.

On to the next one. Time to clean up the filesystem layer.