Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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.

Product Version: UE 4.18
more ▼

asked Jan 02 '18 at 11:45 AM in Blueprint Scripting

avatar image

5 1 2 5

avatar image LonesomeSoldier Jan 05 '18 at 12:21 PM

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.

avatar image xlar8or Jan 05 '18 at 12:25 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jan 02 '18 at 11:53 AM

avatar image

6k 161 129 304

avatar image ThompsonN13 Jan 05 '18 at 05:03 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question