|
Post by Firefox on Jun 7, 2021 0:00:04 GMT
Hi, so I've been looking through this project and am really impressed with the architecture. I understand that the following question is quite intensive, but I am honestly interested in hearing how you would handle such problems.
How exactly would you go about implementing...
- Buffs (Modifications to Cards that can be removed, including stat changes and new Abilities).
- Triggers (Abilities that act as reactions to specific GameActions).
- Auras (Continuous Abilities that apply Buffs to relevant targets).
With the addition of these 3 concepts on top of what you already have in this project, you would be able to model the large majority of effects seen in card games.
|
|
|
Post by Admin on Jun 7, 2021 13:06:13 GMT
The implementation of each feature can be an intensive effort given how well you understand the architecture that is in place, but the concept of how to implement them is actually not that hard. It all comes down to two problems, how to model the data that reflects what you are trying to do, and how to trigger the code that applies it.
For example, when implementing mana, I created a "Mana" class that held all the data that reflects what I wanted to do, and then created a "ManaSystem" that could listen for a variety of game events to trigger the logic it needed to function.
The same thing can be said of each of these three things.
For a Buff, you could create a model that holds the amount of change it wants to make, and what stat type and card it wants to target. A Buff system could then apply and or remove the data at the correct times.
Likewise, triggers and auras each have the same basic concept. Model it as data as well as you can, then use a system to know how and when to apply it.
If you give it a shot and have more specific questions on implementation, I'll be glad to try to help. Good luck!
|
|
|
Post by Firefox on Jun 19, 2021 4:36:23 GMT
Alright then. I have a pretty good idea of what I can try. I just have another question though. How would you imagine handling "chained" Actions? By that I mean effects such as "Draw a Card and reduce it's cost by 2". In this case you would have a "Draw" action and some "Buff" action. The result of the Draw action would somehow need to find it's way into the Buff action.
|
|
|
Post by thom on Jun 19, 2021 18:17:39 GMT
been awhile since I have looked at this, but you wouldn't want to "couple" the draw action and buff action (you'd end up having to code for an infinite amount of possibilities based on your different actions) but rather use your trigger to listen for the appropriate action. for instance, you might have a card that "draws a card" and a buff that "reduces cost by 2" then you can have a trigger that listens for draw a card (just once, in this case) on the card that fires "draw a card" and then applies the buff to the target of the trigger (the newly drawn card) within that system.
|
|