How C + + programmers get started unreal Engine 4__c++

Source: Internet
Author: User
Tags automake

Absrtact: A programmer netizen Xiao Bao brother share his UE4 fast start process, just notes, 52VR made a little more suitable for reading changes, sorted out to everyone.
First of all, this article is only for the more proficient C + + skills of programmers, he can not have any graphics or game engine experience knowledge. Secondly, this article is only a focus on the engineering aspects of the introduction, not much theoretical knowledge of the introduction, the purpose is simply to let a completely without contact with UE4 C + + programmers can quickly start to develop UE procedures. Again, this article is only a personal experience, and may even have to understand the wrong place, because I have only learned UE4 one months, but really can let me in a short time to engage in the development of UE4. Finally, from the above, the master not to spray, if there is a bad mood, bypass can be. If you have the elegance of leisure, you can easily guide the guidance, generous gratitude.

I am studying UE4.10, because the computer only downloads this, see Official document is 4.9.

The following is the chronological order of My Learning process: 1 Create Project

For programmers, whatever the engine is, if I use it to develop something, first I have to create a project and write all the relevant code into this project. This is the first step we need to know. So how do you create a project in UE4? When you start the engine program, you will be able to jump out of a window that allows you to choose to open the existing project on your computer or create a new project. There are only two types of UE4 project: Blueprint, C + +. There is no substantial difference between these two types of projects. The only difference between the two types of UE4 engineering is that the C + + type of project will automatically pop up Visual Studio to open the UE4 project when it is created. That's all.

For programmers, when the Blueprint type project is created, there will be a [create Visual Studio Project] in the Ueditor File menu of the project, and the Chinese version is [build Visual Studio Project], and I'll only write it for the English version. Click on this menu item and the corresponding Visual Studio project file is created. Accordingly, the File menu also has the Open Visual Studio menu item, which is to open the project's corresponding code file in Visual studio. Other menu items to put aside for a moment, then back to say a few words to understand. 2) The engineering configuration of UE4

No matter whether the blueprint type or C + + type, the project is created anyway.

Here, we'll start by writing code to add new functionality to this project. Let's build this project directly: the Build button on the Ueditor Interface toolbar or the Build button for Visual Studio. Without any suspense, the result must be a successful build.

Oh, speaking of which, mention, UE4.10. Visual Studio 2015 must be installed above. We open the corresponding Visual Studio project (if it is a blueprint type, build the Visual Studio project in the way described above).

In Visual Studio, we can see a few of the code files in this project, as shown in this picture, Virtualcamera is my project name. Look at that. The Target.cs suffix file, where target is the meaning of target in the makefile file. We know that handwritten makefile files are more laborious in some cases, so programmers have created many Automake tools to automatically generate makefile files. As a result, UE4 also built a automake tool to generate makefile files. This Automake tool is written by C #, which describes the rules of Make in C #, such as this Target.cs is used to describe the final product in makefile, can have multiple Target.cs, but they do not necessarily work at the same time. For example, when the VS compilation type is selected as [Development] instead of [Development Editor], The Target's make rule, described by the Editor.Target.cs file, does not work, and even if you delete the. Editor.Target.cs file from the hard drive and VS, the project compiles and runs successfully. There's something similar in the file list. Build.cs file, which describes the make rule similar to the intermediate target file in makefile. These CS files are in the Add Blueprint class or C + + code automatically generated, do not bird them, just want to know that these CS files are UE4 Automake tools required on the line, as long as these CS files, our UE4 project can compile the correct operation. What I mean in this sentence is that the compilation of UE4 works is completely independent of the Visual Studio project file, that is,. vcxproj files. That is to say, UE4 uses its own automationtool to read the make rules described by the CS file for compilation. However, any project opened with Visual Studio would necessarily require a. vcxproj file, and in combination with what we have just said, we can make clear that the role of Visual Studio here is simply to facilitate our reading and writing of source code, where visual The convenience of studio is still huge, isn't it. Because VS provides strong support for reading and writing source code. I didn't tell you at the end of the last section. There is also a [Refresh Visual Studio Project] in Ueditor's File menu, which is the function of traversing our UE4 engineering directory structure, depending on the results of the traversal, Refresh the. vcxproj file, and then let vs reload the updated Proj file so that as soon as we go to the engineering directoryAdd or remove code files, just click on the menu item and reflect this change in vs.


3) Unrealautomationtool

Project build is a very long process, which is divided into several stages, I only care about the most important stage, is the code file compile process. Here to introduce a few nouns: UBT (unreal build Tool) also called Unrealautomationtool, this tool is the main function of the organization build process, straightforward point is to call different tools in a certain order to complete the entire build process. The first call must be the resolution of the various CS file tools, the result of the analysis is the build target, build who, and then build who. The order of the build and the goal is set to start the real build action, that is, compile code files, link out of the target. Compile's first step is to call the UHT (Unrealheadertool) tool, which is similar to the preprocessor in C + +, UHT read the. h file, and parse some of the meta information in it (UE4 defined, such as [uclass],[ustruct][ Blueprintcallable],uproperty,ufunction and so on), these meta information is not a part of C + + language, C + + compiler naturally unrecognized, so the UHT tools need to parse the meta information First, Generates the corresponding. generated.h file, in which the contents of the. generated.h file are just those meta messages that are modeled with legitimate C + + code. All the meta information text in the original. h file will be deleted. This step is completed, out of the legal C + + code files, you can send directly to the C + + preprocessor processing, and then compiler, linker. The goal of the final output build, complete the build process. Please refer to the following figure:

(Click the image to see the big picture)

4) still have to talk about blueprint

Here, for C + + programmers, is mastered the overall development process, know how to start, how to end.

So the rest is to learn how to add code to the project and learn how to write code-learn what APIs to use and how to use them. This is the most important piece of UE4 development, nonsense, the previous said all can be regarded as common sense, not UE4 development. However, only when we know the common sense, we can really begin to learn to develop.

First of all, learning UE4 the fastest shortcut is blueprint, this is my 1 months of UE4 the greatest feeling.

In UE4 's official document, Blueprint says first of all: in UE4, Blueprint supports almost all of the features that C + + supports, namely BP (Blueprint shorthand) is almost equivalent to C + +. Changed, however, said that BP has its application, not all occasions are suitable for BP, because in some cases the performance of BP is slower than native C + + code.

Suitable for use in the case of BP: The main performance requirements are not particularly high application scenarios, such as the majority of event response and so on. However, in my opinion, most of the development task is not the response of the event, which means that BP is suitable for most of the UE4 development scenarios. And, as they say, BP is too slow to be a purely unfounded bias, and I admit that some BP may not have native handwritten C + + code fast, but does not represent low BP performance.

In terms of development efficiency, it is needless to say that BP is the best place to use the benefits of BP. Especially for beginners, write C + + code do not know what can be invoked, let alone write efficient C + + code. Therefore, it is necessary for beginners to learn BP. Its most important role is to enable UE4 novice to quickly grasp the engine at the level of the Code provided by the function.

However, after recognizing this, I did not immediately start to study BP, but first to learn how to let C + + code and BP interaction, the specific knowledge to see the official document, I just list my experience.

Also mention: Anything that can be put into the unreal scene is actor object, corresponding to C + + Aactor type. Actor is just a shell, it provides all the functionality is provided by the component it contains, different component can provide different functions, and finally show that actor has all of these component provided functionality. The general classification of component, see links, this and unity of the components are somewhat similar. I can assure you that the documents are really understood here, the part of C + + programming does not have any problems from the point of view of hands-on. Next look at the BP document chapter, the Master of BP is not any suspense, but also a very happy process, there will be no difficulty.

#5) GamePlay

As for the game mode, the documentation here also needs to be read in advance before looking at BP:

There is also a map of the brain, we look at: (click on the picture to see a larger image)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.