I imagine this is a common problem in many games, but I’ll use an example from the survival game genre.
Suppose your characters health is defined by several different states. A state to describe body temperature, a state to describe current hydration levels, and so on.
I think you would describe those states as “finite,” which indicates only one state is true at a time. You cannot be thirsty and hydrated at the same time. You cannot be hypothermic and sweating at the same time.
So easy-peasy for that.
But now consider something like illness/injury. You could have a fever and a broken leg at the same time. So I think it won’t make sense to try and use a state pattern here. We might encapsulate each of these unique states with its own object, but I think that we would need to hold an array of these state objects, rather than just a single variable.
That sounds dead simple and I can’t imagine any problem with this setup. My curiosity is just that, this must be a very common thing many developers have to deal with. There is probably some common methodologies for dealing with it then? If so, can you point me to any vocabulary I can google? Or maybe epic has some example projects that showcase similar ideas?
Thanks for any advice and if you’ve done something similar in your own project I’d love to hear what you did.