Hi! I'm going mad trying to make an effects system for a card game, I've remade it 3 times and it's slowly driving me round the bend, I'd like a hand with design I think I might be over engineering it or way off on my understanding of what is needed!
A bit about the problem:
-
Making a card game and want to build a card effects system.
-
I'm basing it off hearthstone's as in a card is played and has an effect, the conditions for the effect need to be checked (is card X on board?, is hp below a certain amount? has a card been destroyed?)
-
In hearthstone this can trigger an effect chain like a stack of dominos which is where a lot of the complexity is coming from.
The Issue ive been having is in my three attempts at this complexity quickly spirals until i stop understanding my own code, i feel like ive been stuck on this so long now even another opinion would be a help, I've been lost in the world of observer pattern forms for two weeks. I also feel my lack of experience with the Godot signals system is maybe causing me to miss an obvious solution to cut down on complexity.
What I'm looking for:
-Ideally a centralized way to track game changes that effects might rely on i.e not signals all over my code when events happen.
-A way to process these effects in batches ( I think ill need this?) so I can get closer to that hearthstone behavior.
-Expandability, as in adding a new effect is adding a new effect function and subscribing to a signal, not 5 code changes over 4 classes.
I understand this is quite a broad area to ask for help on but id be grateful for any ideas or recourses on the topic, Thanks!