Devlog | M6b

Levelling up, and a bug from M4

M6B in Play

Killing thugs now means something. Each kill gives XP, 4 kills reach level 2 and 9 reach level 3, and each level unlocks an ability on your toolbar.

I only save XP, not the level, because the level follows from it, so the two can never disagree. Kills also raise a small server event, which is what quests will listen to later.

While checking this, something strange turned up. I'd reset my XP to zero and stopped the game, and the save still said 120.

It turned out saving on stop had never worked, ever since M4. A player gets destroyed with their connection, and that happens before the save runs. The only reason saving looked fine was the 30 second auto-save. On a real server, a disconnect would have lost everything since then.

The fix is a snapshot that stays behind after the player entity is destroyed, and the server saves that. It turned up by accident, and I'm glad it did.