I’m making a game with lots of different types of magic spells. The way I have it structured right now is that each spell and its data is stored in a Lua module, along with a function that performs all the animations needed for that spell.
The issue I’m running into is that I need to instantiate objects for these animations. I could create a new game object resource for each spell, along with all of the components they need. But then I need a factory component for each one of these objects, meaning I have dozens of factories on one game object. Not very lightweight.
I thought that maybe I could have a single game object resource called “spell” that could be loaded with data from every spell type, because then I just need 1 resource and 1 factory, but I have no idea how to load this spell data at runtime. Each spell will need its own particle effects, which would mean I need to have every single particlefx
component on the one resource, which seems like moving the problem.
How would you structure this type of game?