I'm trying to implement a modular system to modify or add functionality to elements of my game. As a basic example, in my game you can place tiles and by default they grant vision of adjacent tiles, with my system this translates to a tile class that uses a resource to add the functionality to be placed, another for the vision, and more resources in case there were more "effects" required. When I want to add conditions for when to apply an effect or when to deny the effect I add a subresource to the previous resource the idea is I can use every resource value and function independently this allows me to mix and match resources to create new objects or to add some of these resources to other pats of the game when needed.
I came up with 3 options and I would like to hear some opinions:
- Use resources for every effect, holding both functions and data variables.
- Use resources only for variables and I would use References for the functions and feed them the resource variables.
- Use resources only for variables and then fetch for the functions on a mega script holding every effect function and another mega script for all the conditions functions.
Up until now I've heavily used resources and I've almost never used references because I find resources easier to use when connecting signals and dealing with multiple chains of subresources. For creating the reference instances using at runtime I will need a dictionary assigning each effect and condition an id and its class_name. I think all these options would work but I would like to hear some opinions.