Best way to storage and use data for objects?

If you make a separate class for every character type, you’re misunderstanding what a class is designed for. That’s why making 50+ classes for each character sounds daunting – because it is!

What I would do is create a general “character” class for your game. Treat it as a base class. Then, if you have a few different character categories, those character categories can inherit from the base character class and implement their category unique attributes and functionality. Sometimes, the only difference between one type of character and another type might just be a few differences in variable values, so that difference may probably not be notable enough to warrant a separate class. So, with that in mind, you have to think carefully about what is a classification type variable vs what is an instance type variable.

For example, let’s pretend we have a fantasy game. We have swordsmen, magicians, archers, humans, goblins, horses, dogs, and cats. How would you design a class system to capture this?

I would probably create a “Creature” base class. That might be all I need. Everything else can be captured with data values. Swordsmen, magicians, archers could all just be a “profession” variable. humans, goblin or animal could be an enum value. Horses, dogs and cats could be another variable. You could put everything into this base class and let instance data define the actual creature. You could also create an “Animal” class which inherits from the “Creature” class to make horses, dogs and cats distinct from “humanoids” like humans and goblins. But, do you need to? That depends entirely on whether you actually need to make a functional distinction between the two classes.

In terms of instance data, you could look into data tables as a way to store class instance data values. Instead of creating a separate goblin blueprint, just to change a few instance values, you can have a row in your creature table which contains all of the goblin specific attributes. When you spawn a goblin from a creature class, you can just query this data table value to get these values. With this setup, you could easily support hundreds of character types through a few classes.