← World map and portals · all tasks

The entity class restructure — ComplexItem, LivingCreature, Player

done priority 3 estimate M

world-map-and-portals/007 · created 2026-08-15 · updated 2026-08-18

What landed

Kris’s structure, adopted with four deviations, all flagged rather than silently taken:

ComplexItem            data + serialisation only
  +- LivingCreature    things that move and (later) can be hurt
       +- Player       account, seed, display name
       +- Creature     autonomous, flow-field driven
SimpleItem             a sibling, not a child

The wire contract did not change. to_dict() output is byte-identical and kind still says player / creaturefrom_dict defaults it to "player", so renaming it would hydrate every persisted creature in production as a player.

entity_factory.gd is the one place a wire dictionary becomes a typed object. A spike confirmed the base-preloads-its-own-subclass cycle does work in Godot 4.7.1 headless, so the separate factory is a design choice — one registration point for a new type — rather than a workaround.

Verification

godot --headless --path game/world --script test_runner.gd — 116 passing, including test_entity_hierarchy() (round-trips, factory dispatch, a kind-less legacy snapshot, an unknown future kind falling back to the base, and movement treating players and creatures by the same rules). The director’s 139 tests, which spawn the real Godot world server, are green throughout.

View source in repository · also available as raw markdown.