21
votes
Accepted
How to avoid cycles when one character stat can be enhanced by another?
One solution can be to differ between the immutable base value of a stat and the modifiable modified value of a stat. That way you can have cyclic dependencies when those dependencies are on the base ...
15
votes
Accepted
How do you determine what order to process chained events/interactions?
I don't think I'd put all of these effects into a single container at all, because as you show, any one container behaviour is unlikely to fit every use case you care about in your game.
Instead, I'd ...
12
votes
How to avoid cycles when one character stat can be enhanced by another?
This isn't just a problem for video games; this can happen in board games too! So forget implementation details like hash sets for now. Your first problem is determining what the result you want will ...
6
votes
How to store condition dependent item information in JSON
I wouldn't do this based on item name. Instead, I'd implement a system of modifiers to describe what an item does, something like...
...
4
votes
Handling status/effects on a turn based RPG game
My suggestion is to not overcomplicate things. I would just use flags to indicate that an entity has these effects and then apply their effects during events, e.g.:
...
3
votes
Formula for stacking percentages to keep them from getting out of control
One simple way to approach this is to say that subsequent items in the stack apply to the percentage that's left after the earlier items in the stack took their bite.
So the first buff in the stack ...
3
votes
Accepted
Effect Replacement System
Split the actions, such as "main weapon melee attack" in the OP's example into smaller actions and conditions. Recombine them using a behaviour tree. For example:
Normally the purpose of a behaviour ...
2
votes
Modify the effect of a card being played
Delegates can be used to achieve what you're doing but the code here will most likely not 'just work' with what you already have. In addition, I've had to make several assumptions about how things ...
2
votes
Modify the effect of a card being played
As the comments have indicated, delegates may be your saviour, but let me add a little context and maybe a few extra pointers.
delegates are nice because you can form a subscriber system whereby the ...
2
votes
How do I create a powerup that affects speed for a limited amount of time?
A simple implementation can be done on the playership object. You need to track the power-up additional speed (let's call it ...
2
votes
Should state and behavior be combined for Buffs? Cannot decide between data-driven and OOP approach
Option 1: TL;DR, just use classes, and only classes
If you don't care a whit about performance, go with the class-based version and forget the rest forever after, because it is far and away the ...
2
votes
Implementing Runescape-style stat-based conditional buffs within an ECS
Here's one way to approach it.
First throw all your base stats into one component as follows:
...
2
votes
How do you determine what order to process chained events/interactions?
Is it real time or turn based?
I do turn based games and the way I solve this is to give each action, order, event or occurrence a "sequence number" it can be an int, lower=faster.
All ...
1
vote
Handling status/effects on a turn based RPG game
I'd agree with Applekini's answer that unless you have a very large set of these effects or they need a lot of variability, hard-coding a flag/check for each effect type in the appropriate step of the ...
1
vote
Accepted
How to implement something like Noita's spell system?
Disclaimers:
Be aware that barring the developers of Noita, we can't answer how the game does it. We can only help you find a way you could do something similar.
My experience with Noita is limited ...
1
vote
How to avoid cycles when one character stat can be enhanced by another?
Another idea which evaluates phillips answer even further: Add a second layer of stats. Stats of the second layer are determined by the stats of the first layer. One stat of the first layer may affect ...
1
vote
How do you determine what order to process chained events/interactions?
With everything in game development, it depends. Your goal should be to make an engaging game. The data structures follow.
I find FIFO works better for automatic actions, while LIFO works better for ...
1
vote
How do you create a power-up system that isn't welded to the Player script?
One option would be to implement each active powerup as a separate MonoBehaviour which you can attach to any gameObject. That gameObject can be the player, or it can be any other gameObject. So you ...
1
vote
Accepted
Attaching scripts which trigger on specified events to objects
First, I'd recommend making each card a GameObject. You'll likely want one anyway for the sake of having a visual object with a position/orientation in the scene ...
1
vote
Effect Replacement System
After trying a few things I think I found a method I am happy with. I've broken the single Attack() function into several smaller functions. Each action has a default followup action that occurs when ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
effect-modifier × 26architecture × 8
unity × 7
c# × 7
c++ × 5
software-engineering × 4
rpg × 4
design-patterns × 4
game-design × 3
game-mechanics × 3
card-game × 3
javascript × 2
data-structure × 2
entity-component-system × 2
java × 1
xna × 1
mathematics × 1
python × 1
optimization × 1
gamemaker × 1
mmo × 1
component-based × 1
events × 1
lua × 1
objective-c × 1