Desing of a character

I want to test my programming skills with unreal but focus on my programming. For that, I’m thinking of making a mostly text-based game with a top-down map where you move in.

Since characters don’t really have a visual representation, I want to be able to describe them, but I’m not sure on how to approach the setup of their bodies in a meaningful unreal engine way.

  • Do I create a body component that contains all the bodyparts ref?
  • Do I create a component of each body part and assign them one by one?
  • Do I create a body component that creates all the other body parts as a component in a hierarchy like we did with the tank/turret mesh in the course?
  • Do I just not create any component and shove all the bodyparts in my pawn class?

Also, what’s the best way to create a list of the same body parts, meaning, let’s say I want to describe hair. I make a hair class where depending on your hair length you have, their’s different hair cut possible, but how do I design all the different hair cut?

  • Do I create a base class for hair and extent all my hair cut in blueprint? If I do that, how do I iterate through them I the case that I want to create an ingame character creation? In the editor, I can do a TSubclassOf to select the hair cut, can you do the same in runtime?

  • I notice that there was a thing call dataTable in unreal, would it be a good idea to use that as a list of hair cut? I played a little bit with it but don’t find it really intuitive and don’t have access to the table data in the editor(from what I could find in the interweb).

  • In C# you can create a class that has static members of itself that you can then iterate through Example. I use that a lot at work but I’m not sure how to do it in C++ and I’m not sure if it’s good practice.

@DanM?

Not entirely sure what you’re after to be honest. Could you give a short example in C# or some other language? It’s hard to visualise what you’re after.

Basically, if I were to code this in C# I would do it like this(using hair as example):

class HairStyle
    {
        private HairStyle() { }
        private HairStyle(string name, int minLength, int maxLength, string description) 
        {
            this.Name = name;
            this.MinimumLength = minLength;
            this.MaximumLength = maxLength;
            this.Description = description;
        }

        public static HairStyle BALD = new HairStyle("bald", 0, 0, "Lack of hair");
        public static HairStyle MESSY = new HairStyle("messy", 1, 3, "messy hair");
        public static HairStyle PONYTAIL = new HairStyle("pony tail", 5, 10, "attach in the back");

        public static IEnumerable<HairStyle> AllHairStyle
        {
            get
            {
                yield return BALD;
                yield return MESSY;
                yield return PONYTAIL;
            }
        }
        // Variable
        public string Name { get; }
        public string Description { get; }
        public int MinimumLength { get; }
        public int MaximumLength { get; }
    }

Then I would just store the wich hairstyle the character is using.

Now, after much reading, I think that what I need to do to is create a first hairstyle as a component and then duplicate this component in the Editor as we did with the bullet in toon tank. This is unless there’s a better way that I don’t know about.

Now I have another question since my component is kinda simple (doesn’t need a transform, mesh material or anything like that since it’s a textbase game) I would like to organize my component like a static mesh and by that, I mean like this(still using hair as an example):
image

Like this, I feel that it would feel more natural to create a static character, but from what I tested, only certain components can be put in a hierarchy like a static mesh. Is there another component from which I can inherit from that allow to make an hierarchy out of my basic component?

Privacy & Terms