One of the tasks this week was to restructure the NPC and persistent human code (let's just call them all NPCs for simplicity). I'm working towards a system that simplifies the specification, generation, and serialisation of NPCs. At the moment the code (e.g., to make townspeople and the king in the castle) uses different generation and serialisation machinery -- but now that I'm clear on what I need I'm unifying it all. The basic requirements are:
- The top-level Game Planner will specify where NPCs appear. (e.g., a SilverSmith in Town, a CrazyCatPerson in a Tunnel)
- Main crafting NPCs will appear in Town
- Special crafting and other NPCs can appear in regions (e.g., Forest) or sub-regions (e.g., Tunnel)
- Some properties of NPCs are specified at Planner level (e.g., recipe list), but some are left to the region-generator (e.g., skin colour, outfit). (This is to simplify the Planner so it can just focus on the important properties.)
- Crafter NPCs are specified by a RecipeList (this is as it sounds, a list of the recipes the NPC offers.)
- NPCs has some persistent state (e.g, seed, name, health, agro status, crafter list)
- Attacking a townsperson should set the whole town on agro status
- NPC deaths persist. If a merchant dies, he's not coming back.
- Special enemies like the King in the castle, or a are all factored in under [ed: what does this even mean?!]
We also improved the appearance of ores -- one of the few remaining block types which haven't been updated in a couple of years. Some ores such as gold now produce light, so they are more easily found (see below).
I also improved the editor to help with development..
- Added some keyboard shortcuts
- Can spawn more npc types
- Can give items/armour/etc to npcs
- Can toggle diff npc behaviours (this is primarily for making gifs, videos, etc)
- Can move NPCs around