Question about best design for many character types

I am working on a game where there are multiple character types, like Explorer and Warrior and Woodworker. I can implement this in two ways - there could be a single BP_Character blueprint with variables (enums) for CharacterType, or I could have a separate blueprint for each type of character (BP_Character_Explorer, BP_Character_Woodworker). In terms of design patterns, what is the best approach? It seems like the one-character-blueprint approach would require a different AIController for each CharacterType, whereas the many-character-blueprint approach would allow me to define the behaveour in the event graph of each blueprint. Both would work, I am just curious, what do you think is the best approach? Thanks.

Hey there, it really depends on the complexity of each character type. If you have completely different movesets and skills and whatnot then creating a child class is the best approach imo. If they are rather similar then you can get away with the enum for the character type, which implies doing switches/ifs every place you want to distinguish the logic. The same logic applies to the AI Controller / Behavior Tree.

I second using child classes. use the parent character class to control the behavior and variables that are common to all character types. then define the specifics in the children. that way if you need to modify say the movement system you can change it in the parent class and not have to worry about changing it more than once.

Good to know :slight_smile: Please mark the answer as correct and upvote it if you found it helpful :slight_smile:

Thanks for the answers. I have indeed settled for that approach - I have a base character class for common stuff, but child classes for each type of character. And I have no ‘character type’ variable in the base class, each child class, by its existence (eg. BP_WoodCutter) implies the type in itself. Works well.