I put some pots in the dungeons.
This also shows gated dungeon progression, where the door to the next room doesn’t open until all the enemies in the room are dead.
This ended up being way trickier than I thought it was going to be. There’s complexity with the clients and server agreeing that a player can pick up an object, with spawning the picked up object as a new object separate from the one that was on the ground (so that the one on the ground can be cheaper), with synchronizing the animations and the spawning of the new object, with associating the picked up object with the player object, with checking for pick up-able objects on the runtime version of the map vs. the permanent version of the map (the rocks don’t disappear from the permanent map so if you walk away from an area and then back, the rocks will respawn), with the animation state transitions and animation triggers getting stuck in a latched state… and there are still bugs I need to work out around things like preventing the player from picking up an object if they’re in the middle of being injured or have already started to pick up another object, and dropping the object if the player performs an attack while holding an object (or maybe prevent the player from performing an attack until they drop the object). Then I’ll probably want to have some objects that don’t break when they hit the ground, that you can pick up again!
But for now I’m happy because this is an important mechanic, and the foundation of it is more or less working!
Underlying these animations is what I’m calling the “unit action” system, which handles actions like attacking, flinching from getting injured, and dying. The player or enemy units can perform an action, queue an action if there’s already one being performed, check what the current action is, and receive callbacks at points in action execution. The actions drive some of the game logic like turning to face the current target, and also drive the animation system and some of the positional transformations like lunging when attacking.
A few systems coming together here. NPCs get generated and given names. Quests get generated and assigned to NPCs. Each quest has the kind of item to get and the number to collect. The NPC’s dialogue tree adds dialogue options based on the current state of the NPC’s associated quests and other state such as whether the player has enough items in their inventory to complete the quest. Selecting the dialogue options progresses the state of the quest and removes the items from the player’s inventory.