Trying to create a step-by-step calculating system

I have a game mechanic where every skill is passive and acquired after defeating a level. I have a system where the base damage is calculated by a die. But after unlocking skills and getting some damage multipliers, I want to calculate my damage like Balatro, in order and step-by-step. Base damage is 5, and then x2, and then x3, and then x7, etc. You’ll get 210 eventually but the steps should be shown in order. There will be acquired skills that will affect the new calculations whenever a new passive is taken effect.

I want to show every passed calculation on the same UI element too but if I can’t, well that’s another question.

What is the most logical way to do this? Creating an array of skills and then looping that array? I’m a bit lost. Every help will be appreciated!

I would first check the GAS, maybe it’ll suit you.
It’s not built exactly for such purposes, but in general counting modifiers, multipliers etc is a big part of it.

The concept is similar to modifiers in 3d modeling programs.

For each property, you define a base value, a modfied value and an array of modifiers.

All modfiers inherit from the same base class, and the base class should have a virtual Apply function that takes in an input and returns a calculated result. (You can use instanced struct for this in C++).

Every time a modfier is added/removed/updated, the modified value should also be re-calculated.

You might not need GAS for a simple functionality like this unless you plan to fully incorporate that gigantic system into your game codebase.

Thank you. I checked GAS before and decided my system is not complex enough to make me learn it :slight_smile:

I found another way to do it. Created a new macro with Delay, so now my skill are executed step-by-step. I’ll be sharing it here.

Ah yes I’m using a simple solution for creating skills cos’ they will only affect few of the variables that I’m already using in the encounter mechanic.

I was trying to find a way for executing my skills step-by-step. And I think I’ll found it. I’ll be sharing it here.

Changed the ForEachLoop node

to something like this:

Added a Delay to create ForEachLoopWithDelay

This way every skill from the Array will be executed step-by-step with Delay. Thus giving me a time to show calculations one-by-one, not all in one instant.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.