I understand that you have a limited support team and that you guys are working hard to improve and push forward the documentation for the engine, however, there is a large difference in the amount of official support directed at C++ and blueprints.
For instance, in the following link is the official Gameplay Guide, at the bottom you can jump down and see the Gameplay How To’s:
https://docs.unrealengine.com/latest/INT/Gameplay/index.html
The documentation there clearly states the intent for C++ to be a part of that documentation, and previous staff comments have suggested that those bits of documentation would be coming “soon”, however, those pages and those comments are a few months old now. Why does the C++ documentation consistently play second fiddle?
I understand that you guys have a lot to do, but even basic C++ examples have not been addressed within the documentation, yes there are templates and example projects but those are big “chunk” examples, the problem with those examples is that for a beginner who has little understanding of the engine breaking those chunks into manageable pieces involves either jumping through a multitude of links in the documentation or meandering through the entirety of the code base, often which requires jumping from class to class to class to find the comment section that actually expands on what the functions purpose is or what parameters are looking for/mean (and usually fail to explain where to use the function or how to use it properly). This would be perfectly acceptable for more obscure functions and advanced use-cases, but this is for the most basic of functions. So after reading through the sticky, “UE4 Editor Terminology: We need your feedback!”, I wanted to offer a suggestion for your documentation efforts to help improve the engine’s usability for beginners looking to work on the C++ aspect of the engine.
I would like to put forward the idea of micro-tutorials (text based) for C++ (similar to the multitude of video series done for blueprint) that cover the most important classes and architectural aspects of the engine as well as their key functions. For instance lets take gamemode, right now we have the following page:
However, in that page there is nothing that examines concretely how to actually work with GameMode, for instance the page starts with:
Great! Nice start, stating the most basic premise of what a GameMode is, then we continue with…
Oh okay, gotcha, so that all makes sense, but how do we actually do any of that? Maybe if we continue on…?
…
Hmm… Nope. Nothing else that gives a beginner an inkling of how to actually have a GameMode interact with their game.
Maybe we try google? -“Unreal Engine GameMode”-
Well we get a link to the page we just passed over, then a promising one “Unreal Engine | How to Set Up a Game Mode in Blueprints”, ah, that must be useful to use right!?
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/SettingUpAGameMode/Blueprints/index.html
…
Hmm, well I can make a blueprint GameMode and set a Default Pawn Class and even assign a Default Game Mode, but there is no further progress on what a GameMode is actually suppose to do or how it should be used to communicate with the rest of our game. (Note that the above is actually from the gameplay guide which currently excludes C++ content)
Alright so we struck out, lets try again, lets venture to one of the templates, maybe one of those will have a good explanation of what we’re suppose to do with our GameMode…
I freshly opened up a Top Down template, so lets take a look at what’s in the GameMode header…
UCLASS(minimalapi)
class ATopDownGameMode : public AGameMode
{
GENERATED_BODY()
public:
ATopDownGameMode(const FObjectInitializer& ObjectInitializer);
};
Hmm… Not much of use for figuring out how to make a limit to the number of players, nor does it help us understand how to determine how players will enter the game, nothing to suggest how to pause the game either, and nothing in there telling us how to transition between levels…
Alright… Well what about the .cpp file?
ATopDownGameMode::ATopDownGameMode(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
// use our custom PlayerController class
PlayerControllerClass = ATopDownPlayerController::StaticClass();
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/Blueprints/MyCharacter"));
if (PlayerPawnBPClass.Class != NULL)
{
DefaultPawnClass = PlayerPawnBPClass.Class;
}
}
Yeah… Not much information in there about anything the entire GameMode information page was going on about…
Well its just a template right? Lets try the bulkier “Sample Game”. Who doesn’t love strategy games?
So we open up the Strategy Game solution and find the GameMode:
UCLASS(config=Game)
class AStrategyGameMode : public AGameMode
{
GENERATED_UCLASS_BODY()
/** Class for empty wall slot. */
UPROPERTY()
TSubclassOf<AStrategyBuilding> EmptyWallSlotClass;
/** Time before game returns to menu after finish. */
UPROPERTY(config)
int32 TimeBeforeReturnToMenu;
/** Name of the difficulty param on the URL options string. */
static const FString DifficultyOptionName;
// Begin GameMode interface
/** Initialize the GameState actor. */
virtual void InitGameState() override;
/**
* Handle new player, skips pawn spawning.
* @param NewPlayer
*/
virtual void RestartPlayer(class AController* NewPlayer) override;
/**
* Modify the damage we want to apply to an actor.
*
* @param Damage The damage
* @param DamagedActor The actor we wish to damage
* @param DamageEvent The event that caused the damage
* @param EventInstigator
* @param DamageCauser
*
* @returns The adjusted damage amount
*/
virtual float ModifyDamage(float Damage, AActor* DamagedActor, struct FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) const;
// End GameMode interface
/**
* Finish the game with selected team as winner.
*
* @param InWinningTeam The team that has won.
*/
UFUNCTION(BlueprintCallable, Category=Game)
void FinishGame(EStrategyTeam::Type InWinningTeam);
void ReturnToMenu();
/**
* Helper function to test teams (null = not in friendly team).
*
* @param ActorA First actor to test against
* @param ActorB Second actor to test against
*
* @return true if the two actors are on the same team.
*/
static bool OnFriendlyTeam(const AActor* ActorA, const AActor* ActorB);
/**
* Helper function to test teams (null = not in friendly team).
*
* @param ActorA First actor to test against
* @param ActorB Second actor to test against
*
* @return true if the two actors are on opposing teams.
*/
static bool OnEnemyTeam(const AActor* ActorA, const AActor* ActorB);
/** Helper method for UI, to exit game. */
void ExitGame();
/** Pointer to title text widget. */
TSharedPtr<class SStrategyTitle> StrategyTitle;
protected:
/* Helper to return the current gameplay state. */
EGameplayState::Type GetGameplayState() const;
};
Alright cool, finally we get to see what a gamemode might look like, awesome, but… as a beginner this isn’t particularly useful as most of the comments are simply explanations of the function’s effect or parameters, not a discussion on the composition of the function nor what the parts of the functions are doing, heck, StrategyGameMode.cpp has hardly any comments or explanations, not exactly a gold star in teaching materials. This means we’re going to have to first decipher the structure of the game to figure out how the GameMode is supposed to work… Hmm… Wait, I remember seeing something that covered the important bits of the Strategy Game!
Wait… looking through this there is nothing that actually helps to answer our question, “How do I properly work with/use a GameMode?” In fact that entire page doesn’t cover nor dissect a single line of code, a bunch of functions are brought up, but for some reason no one actually mentions where these functions are located in our source files. Darn, I thought this would be the one to really help me figure out how I’m supposed to work in the Unreal Engine.
Oh well, I guess I’d better start guessing and misinterpreting the engine!
I hope the above playful attitude didn’t insult anyone.
The point I’m trying to make is that while many people say to “just look through the source files and examples”, the problem with that is that the engine is so enormous that a trip through the all the functions located in simply the GameMode file of the strategy game would have beginners jumping through half the engine files trying to figure out what’s going on, right now there is no guided approach to actually learning the engine, it’s similar to giving a person a pencil and a book of Michelangelo’s sketches and telling them to just figure it out. Yes, that is how many people learn to draw (copying relentlessly) but the problem with that is that the approach is highly ineffective as it relies on bulk repetition and happenstance, there are reasons why people study anatomy, lighting, composition, because mindless copying isn’t understanding, nor is the approach new developers are forced through when facing UE4, so while you can learn UE4 through doing this, it isn’t a good way by any means, anyone who says otherwise is exhibiting a case of survivorship bias.
So, returning to the point of this post, can we please get targeted C++ training that not only gives an overview of the class but also how to use it, the important functions within the class, and then examples of proper use of the classes, for example maybe we have a basic example of a pong game that connects how to use game mode and a player controller and a game state together. Then another that explains how we would use a GameMode in an rpg, WITH accompanying code, that actually shows a concrete example of the way to communicate between the GameMode and other pieces of the game.
For starters the classes on the following page that get bold headers would be a good start for providing concrete code examples and explanations:
In case you don’t want to follow the link the classes in there are:
- Pawn
- Character
- Controller
- PlayerController
- AIController
- HUD
- Camera
- GameMode
- GameState
- PlayerState
That’s 10 items that help to form the core of the engine and yet, there is (from what I’ve seen) no official documentation that covers and explains both the theoretical and concrete use of these classes.
To explain what I’m looking for in the documentation lets ask some sample questions that they should be able to answer:
Pawn/Character:
How do I spawn a new pawn or character? How do I connect these new pawns/characters to the PlayerController or an AIController? Where should I place the code that would instantiate these new pawns/characters? What are the most important/useful functions and variables?
PlayerController/AiController:
What is the proper way to work with these controllers? What are some usage examples? How should I spawn multiple controllers to control multiple different AI? What if I spawn a character in the middle of gameplay (like a rts unit)? How does someone handle a manager class in UE4 (one responsible for making AI work together/cooperate)? What are the most important/useful functions and variables?
HUD:
Explain canvas versus slate versus UMG. Which should be used when? What is the workflow for working with each when using C++? What are the most important/useful functions and variables?
Camera:
How to deal with more complex camera behavior than “sit and stay behind this character and do nothing else”? How to make a zooming third person camera, how to make it transition to first person? How to make an rts camera, how to link that to an rts map? How should we handle jumping between different characters, do we use multiple cameras or detach the camera and connect it to the other character? What are the most important/useful functions and variables?
GameMode:
Explain the connection between GameMode and UGameEngine, as well as the connection with PlayerStarts? How might we change how PlayerStarts work, where would we do that in the code? How would we implement any of the examples you guys put forward in your GameMode “explanation” page? What’s the connection between GameState and PlayerState? Does GameMode act as a manager class? What are the most important/useful functions and variables?
GameState:
When do we use the GameState class? What should we use it for? What are some examples? How should we access our GameState? What are the most important/useful functions and variables?
PlayerState:
When do we use the PlayerState? What do we put in the PlayerState that we don’t put in our GameState and vice versa? Show us some examples and implementations. How should we access and work with this class? What are the most important/useful functions and variables?