Hey folks,
So i’ve been trying to work out how to build a modular spell system recently. I want to be able to make spells to damage/heal and buff/debuff, but i also want to be able to make different types of spells like Beams, Projectiles, AoEs etc and with different casting types like Fire and Forget, Channel etc and then to top it all off i wanted to add passive abilities like flight or wall climbing in the same system to.
I started off browsing the internet for tutorials and resources and came across an unfinished series by BurgZerg Arcade and i also found this video and downloaded the project files they linked. It seems like this is just using a massive chain of “if/else if” statements to cast the spell, which when combined with all the targeting types and effects that i could theoretically want to eventually implement would end up creating a huge tree of “if/else if” statements which doesn’t seem right. The other issue with this method is that i want to include passive abilities like flight or wall climbing under the same system and i can see that potentially maybe causing some issues down the line.
The other thing i looked at which seemed more like what i need was Skyrim. I started looking in the Skyrim creation kit to get an idea of how their spell/ability system works and the entire thing seems component based which sounds just like what i need. So for example Skyrims fireball spell has a damage, stagger and fear component attached to the spell with all the spell targeting and casting type etc handled by the parent object. And any buffs or abilities from weapons/armor or race etc are handled within the same system.
The thing that i really need help to understand is how to plug it all together. I can make components that can deal damage, fear, knockback etc no problem. I just need some help understanding how to make a main spell handler that for example i could give a beam targeting component, a channeling type component and then a damage component for one spell, but could then create another spell which passively grants flight for example.
I don’t suppose anyone could maybe help me with some pseudocode or something just to help me try and get the basic concept of how to do this?
Thanks