XaiJu
thomasmoonkang
thomasmoonkang

patreon


Weekly Update #1 - Effect Apps

In One Step From Eden, I kept a list of all Artifacts on each unit which I'll refer to as "Being"s. Every time something was triggered, like OnSpellCast, it would go through all of the Artifacts on the Being. Each artifact had a number of Effect Apps which basically contained a Trigger enum and an Effect function.

In a lot of cases it would go through all artifacts on all Beings because the enemies might have Artifacts that triggered when the player Shuffled or Moved for example. There were Artifacts that triggered every frame so we'd have to loop through them every frame. I tried using a system where we only checked them every x amount of frames but it didn't make a noticeable difference. This system was super expensive so I moved to using delegates.

Instead of going through all of them and checking which ones should be Triggered, we can use delegates. We'll need a delegate for every Trigger


So we check for the Trigger once, then we assign the method to the multicast delegate.


We still use switch case for the triggers and effects..


Still have to figure out how to add Checks like (if health is below 50%). We can't do them before we add to the delegates since the check results may change during runtime. Maybe we can add them as part of the method passed to the delegate?

Almost every effect uses these effect apps, including the ones in Spells and Traits.


Here's an example of an effect app in json that heals all allies.


That's it for now. We've also decided on a couple features being melee units and opening up the grid (like Serif's boss battle) once the battle start.

CYA


More Creators