0%

unreal src

Abstract

Finally, built unreal engine source code successfully. First time clone source code from github was the main branch which is UE5, but I haven’t installed vs2022 yet, so the build tool cant generate vs sln file. Error message point out that the version of MSVC is less than 14.2. Anyway, I decide to turn to clone the UE 4.27 which is the most recent version before UE5. And I found a website to learn the operation about git. It explain the branch setting in local repository and how deal with the commit conflict when operating an open-source project with other developers. I have learned for hours, made a temp repository, but the command I really need below is from google, haha.

1
git clone -b 4.27 https//....

So in this part I want to record unreal source code which I found. As we know, the inheritance relationship in the whole is complex. It seems impossible to draw a graph or make a data table to show the inheritance. Fully understanding the engine seems to take a very long long time.

  1. GameModeBase

    When create an empty cpp project, the default mode is GameModeBase. As game play, we can control a camera move, so I guess the camera is generated by default. First, as DefaultPawnClass is declared as a TSubclassOf<APawn> type, and is defined = ADefaultPawn::StaticClass() .

    The class ADefaultPawn is inheritance from class Pawn . According to the doc,

    DefaultPawns are simple pawns that can fly around the world.

    It’s right, the flying camera. Let’s see the cpp source code.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    //DefaultPawn.cpp
    ADefaultPawn::ADefaultPawn(const FObjectInitializer& ObjectInitializer): Super(ObjectInitializer){
    //construct function initalize the collision component,movement component
    //choose a spheremesh as the default subobject
    }
    void InitializeDefaultPawnInputBindings(){
    //initialize move forward, right,up, turn and lookup
    }
    void ADefaultPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent){
    //bind axis
    }
    void ADefaultPawn::MoveRight(float Val){} //same as move forward, move up and so on

    But there’s nothing to do with camera. Of course, camera is auto setup in the class PlayerController .

    It’s going to be the topics in the future!