04-13-2013, 04:56 PM
I've started rewriting the code so that the entities are ticked within their respective chunks' ticks. Oh dear, had no idea it was sooo difficult. Had to change entity ownership paradigm, now entities are owned by their respective chunks, instead of the world directly; the world no longer has the list of entities, so it cannot service the ForEachEntity() and DoWithEntityByID() calls directly. Now player entities relied on some weird constellations that made them tick twice in each tick in the old scheme, but now they ticked just once and failed to save the player data. Ugh! Fixed that, and suddenly I found out that entities loaded from the disk are added to the list twice, so they tick twice and the server crashes when chunks are unloaded, because those entities get deleted twice. While fixing this, I came across the code to move entities from one chunk to another, that will need some care, too. it's just, I fix one thing and ten more issues arise. If I ever manage to do this, it'll be a huge mega-commit...