Skip to main content
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 ...
Philipp's user avatar
  • 123k
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 ...
DMGregory's user avatar
  • 141k
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 ...
Toph's user avatar
  • 623
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... ...
DMGregory's user avatar
  • 141k
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.: ...
Applekini's user avatar
  • 8,543
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 ...
DMGregory's user avatar
  • 141k
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 ...
Kasper van den Berg's user avatar
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 ...
Joe's user avatar
  • 435
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 ...
Jody Sowald's user avatar
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 ...
liggiorgio's user avatar
  • 5,544
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 ...
Engineer's user avatar
  • 30.4k
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: ...
Dimu Designs's user avatar
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 ...
Ratbyte Boss's user avatar
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 ...
DMGregory's user avatar
  • 141k
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 ...
Theraot's user avatar
  • 28.3k
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 ...
Chrᴉz remembers Monica's user avatar
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 ...
Cort Ammon's user avatar
  • 1,247
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 ...
Philipp's user avatar
  • 123k
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 ...
DMGregory's user avatar
  • 141k
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 ...
Chris Uchytil's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible