Download

What C++ class to use?

I can’t seem to figure out the core differences between each type of class. For blueprints it is fairly straight forward because it is visual, but in C++ they are almost all identical except 1-3 lines of code.

Is there a list or cheat sheet that explains what each class is intended for? Right now in particular I am trying to figure out the best class to use to store variables/variable references.

Generally - you would construct your own classes - encapsulating both data (variables) and functionality (methods).
Unless you are asking about specific Unreal engine classes…

You can use the editor to help you out, by going to file -> add code to project. You will get a list of different class types you can extend from with a brief description of what they do. There is also a complete engine and API specification available with a breakdown of every class, the data it contains and the functions.

Generally speaking, you should not modify core engine code, but rather extend it. For example, to create a new character class you would create AMyCharacter which extends ACharacter. This is because if you want to create a new project later on, and you’ve modified the engine with game-specific stuff, you’ll have a hard time undoing that work for the new project, or you’ll have to install a second copy of the engine.

As far as where to store data and functionality, that’s a design decision rather than a hard and fast rule. The basic rule of thumb is to store the data in the most logical place. So character health should be stored in the character class, current ammo in the weapon class and so on. That will then give you a basis to start understanding how objects should communicate with each other, how the HUD class can retrieve the player’s weapon’s current ammo for display purposes etc.

I am talking about the extended classes.

I didn’t know that it was called extending the class. The documentation listing what each class is meant for is what I am trying to find. With such brief descriptions of what each class does I am kind of confused as to what class does what other than a few obvious ones like Actor. Can you give me a link to the documentation that says what each class is for? With Blueprints it is fairly obvious, but with C++ classes it isn’t.

You can find the complete documentation here:

and the API reference here:

This gives you a full breakdown of every class.

How strong is your knowledge of object orientated design and principles? If you’re unfamiliar with them then I would suggest you brush up on it first as you will struggle when you try to then design your game.