Hello guys,
Would you have some guidance about the system I’m trying to build ?
I’m building an auto adventurer where the play only sets parameters, the combat are turn based.
The character will decide on his own wether he should attack, heal, use a bomb or whatever.
For this, I want my player to only be able to set (pre-fight) “how much of a big spender” he is (in terms of item usage), and wether he is more offense oriented or defensive.
How would you approach this, design-wise ?
Note 1 : I’d like to avoid visual fsm
Note 2 : I’m a scriptable object fan
You could build it out of a base Condition class, which you extend for conditions such as “HP below / above X” and “just a random chance”, and then a base Operation class, which you would extend for operations such as “use potion” or “attack” or whatever.
These systems can be tricky to stand up “all at once,” even if you diagram them all at once. You sort of have to design, create, test, then iterate back on the original design to see if it works. Fortunately Unity makes it so easy to define a bunch of chunks like this, slot them into a test “runner” script and see how it goes.
Back at you! Nothing like a bit of gamedev over the holidays!
I say it is SOs all the way until it is something that lives in the scene.
And even then a generic MonoBehaviour that can be configured via SO is often the best solution, rather than injecting all the various bits of the SO’s interior “guts” into the MB.
For injecting bits of useful data into MonoBehaviours that you create in code, I like this pattern to keep me honest:
Factory Pattern in lieu of AddComponent (for timing and dependency correctness):