Hello over here
We’re unsure of what is the best practice performance-wise to achieve a particular goal and we would like your help to figure it out.
We already know how to do everything I’m mentioning, we’re just unsure of the road to take.
The situation
We have Player, **Enemy **and Weapon classes.
Each of them have an array of a Stat class like “health” or “damage” (with current / max and starting value of that stat).
We have a StatModifier class that can modify any stat we want.
We have a Perk class that has a list of stat modifier.
The question is: what type of object should be Stat, **StatModifier **and Perk in our case?
With several conditions to keep in mind:
- these classes will have their properties customized in the Editor and at Runtime
- we will need to create hard coded StatModifier (meaning inheriting properties of StatModifier)
- we need to keep track of the current StatModifier applied to any entity at any given time
- we need to keep track of every stat of every entities that hold some at any given time
- StatModifier can be added and removed to a Stat at Runtime
Here’s what we’re thinking regarding Stat, StatModifier and Perk:
- Using Actor -> Not possible performance wise if I’m correct considering each enemy will have something like 10 stat spawned with several statmodifier and maybe one perk each
- Using Actor Component -> Sounds possible but I’m unsure of the cost performance-wise and it’s not the best usability once implemented
- Using Object -> I’m not sure of the cost performance wise considering the amount of Stat / StatModifier and Perk spawned in the world
- Using Structure -> Sounds really interesting performance-wise but we’re not sure if it will fit our needs in the long-term because we never dag much in that area
What should we use? Is there even another way we didn’t think of?
And here it is.
If you have any hint or information, thank in advance. If you have any question feel free to ask!
Looking forward your answer