InverNessian / SafeguardsOfLeyto

For development of my game by the same name.
1 stars 0 forks source link

Breaking Up UnitData #15

Closed InverNessian closed 5 years ago

InverNessian commented 5 years ago

This class was too monolithic. Breaking it into smaller components makes things easier and more efficient.

The new format will be: HealthManager- MB that holds unique HP values. Derives its Max value from StatsManager. StatsManager- MB that holds ref to StatsData SO. Holds data that units use, like level, movement and base values. Does NOT include growths. GrowthManager- MB that holds ref to GrowthData SO. Holds data that only characters use, like EXP, growth rates, progress, and supports. Equip- MB that holds a ref to an Item SO. Holds data regarding effect, cost, and stat modifiers.

This format allows us to have multiple units reference the same SO, saving on RAM usage. This also allows us to have individualized HP values, since HealthManager is an instanced MB. We can even have them attached to Obstacles!

Much of this design is intended to work alongside Editor setup. IE HealthManager has a check OnAwaken where if it's value == 0, it tries to fetch a Max value from a Stats object. Also, enemies are assumed to have all their attached Equips and Managers. This can be easily done by creating a prefab for each enemy type.

The biggest issue here will be adjusting CombatController to handle the new format. It may be worthwhile to look into non-static events as a way to systematically proceed through attacks in combat. The current way is just inefficient.

InverNessian commented 5 years ago

I have implemented all of this except the CombatController fixes, which can wait for a bit. Since it's working right now, I can come back to it later.

InverNessian commented 5 years ago

This is now complete.