(Disclaimer: Simple action systems get the job done for most games. There's no need to make it more complicated than it needs to be.)
So, I've been taking a long look at game actions. Not the scheduling of future actions - just the actual execution of the actions taken by the player and enemies (and maybe other things).
I had a few goals:
- It should be easy to handle cancellation of actions, like when the player backs out from the targeting screen.
- It should be easy for an action to allow certain conditions to be overridden, like making an attack while ignoring all range limitations, or declaring that an attack will never result in a critical hit.
- It should not be fragile when things change, because things WILL change.
I have several pages full of text now, and I feel like I'm getting closer to something that'll work, but there are still some major design decisions to be made. Anyway, that's not what this post is about.
Those of you who have tried to handle action cancellations elegantly, how did it go?
What goals did you start with? I'm interested in exploring this space, to see whether some of these questions already have answers.
Thanks for reading.