Displaying actor actions simultaneously
I thought I could get away with coupling logic and presentation for actor actions. For example, a melee attack works as follows:
- Start the attack animation
- When the attacker appears to make contact with the target, determine if the attacker hit and, if so, the damage done; start particle effects and display the damage amount as floating text
- When particle effects are almost done, add damage residue (blood) to nearby cells
- If the target’s HP <= 0, replace the target with a corpse
These steps are triggered by the action itself, animation callbacks, or event handlers.
Despite being an anti-pattern, this design has worked well. I would have gotten away with it had I not recently decided to display every actor’s actions simultaneously. I, and most players, don’t have the patience to sit and watch every other actor on the screen act, sequentially, before being able to act again. Presenting the player’s action and other actors’ actions at the same time solves this problem. Note that actions are still turn-based; selection and resolution still occur for one actor at a time.
It’s been a challenging change to make. I can’t simply add or remove; I have to untangle. My solution, in short, is to split turns into two phases, one to decide and resolve actions, and another to present all actions. There are complications to work through. For instance, if a melee attack causes enough damage to kill the target, I now have to postpone the event-driven death animation and corpse creation until the presentation phase. Events are used extensively, so there are likely many issues I haven’t encountered yet. So far, movements and melee attacks can now be presented simultaneously.
History generation brainstorming
Map generator work came to a halt when I tried coming up with a contextual and meaningful way to stock the dungeon. It’s disappointing because I’ve had great momentum in this area over the past two months. I’m reconsidering an idea I previously tossed out – dungeon history generation. The basic concept is that a series of randomly generated events would result in a collection of related places, actors, objects, items, and quests that would be used to theme and populate the dungeon. I spent a good chunk of time researching and brainstorming on this topic this week.
Next week will be tight time-wise. I’ll continue working toward full support of simultaneously presenting actor actions and fleshing out the history generation.