Unreal engine 4 код программирования

Programming Basics

Information for programmers developing with Unreal Engine.

Choose your operating system:

An individual game is defined by a game project that contains all of the code, content, and settings specific to that particular game. Gameplay code is contained within one or more gameplay modules, and each game project must contain at least one module. The content, such as art assets, sounds, etc., is imported into the editor and saved into packages and maps. Configurable settings for the game are defined in configuration files which are loaded at startup. Together these form the basis for every game made with Unreal Engine.

ProjectModuleClassOrg.png

The Creating a Game Project page walks you through the steps of creating a new game project. Once you have created your game project, you should familiarize yourself with the Directory Structure of the project. This will help you to know what any existing files represent and what goes where when adding new files to the project. You can also supply Command-Line Arguments when running the editor with your project to do things like jump straight into game preview mode or start on a particular map.

Modules

In the same manner that the engine itself is comprised of a collection of modules, each game is made up of one or more gameplay modules. These are similar to packages in previous versions of the engine in that they are containers for a collection of related classes. In Unreal Engine 4, since gameplay is all done in C++, modules are actually DLLs instead of proprietary package files.

Читайте также:  Программирование слуховых аппаратов phonak

See the Gameplay Modules page for details on creating and using gameplay modules.

Module APIs

Functions and classes that need to be accessed outside of their module must be exposed via the *_API macros. Each item that is exposed comes with a compile-time cost, so be sure to only expose what is needed. If you only need access to a single function in a class, exposing just that function instead of the class can save a significant amount of time when compiling.

See the Module API Specifiers page for more details on exposing classes and functions to other modules.

Classes

Gameplay classes are defined using standard C++ header files and syntax in conjunction with special macros defined in the engine to help with defining aspects of the classes unique to Unreal Engine.

See the Gameplay Architecture for a complete explanation of class structure and creation.

Class Implementation

At the most fundamental level, an Actor is any gameplay Object that you can place in a level. All Actors extend from the AActor class, which is the base class of spawnable gameplay Objects.

Actors can be thought of, in one sense, as containers that hold special types of Objects called Components . For instance, a CameraActor contains a CameraComponent.

camera_actor.png

The functionality of a camera, like the field of view, is all contained within the CameraComponent. That means that the CameraComponent can be included in other Actors, like a Character, to give the same camera functionality to those Objects.

pawn_actor.png

Different types of components can be used to control how Actors move, how they are rendered, and many other parts of their functionality. All Objects, including Components, extend from the UObject class, which is the base class of all gameplay Objects. This means they cannot be directly instanced into the world; they must belong to an Actor.

Each Actor or Object is a single instance of a class. The class sets up the template for the Actor or Object. It defines the variables that can be set for that Actor or Object, and the functions that can be carried out within that Actor or Object. You can create new classes, or types of Objects and Actors, with C++ code. Blueprint Classes primarily allow you to create classes that set up new Actors, although you can extend a few Objects with Blueprint Classes as well. You can also combine the two, by creating a new C++ class and then making a Blueprint Class derived from that C++ class. To learn more about creating classes so you can make new kinds of Actors and Objects, see the Class Creation Basics page.

For more on Objects, Actors, and Components, see the Unreal Architecture documentation.

Help shape the future of Unreal Engine documentation! Tell us how we’re doing so we can serve you better.

Источник

Programming Basics

Information for programmers developing with Unreal Engine.

Choose your operating system:

An individual game is defined by a game project that contains all of the code, content, and settings specific to that particular game. Gameplay code is contained within one or more gameplay modules, and each game project must contain at least one module. The content, such as art assets, sounds, etc., is imported into the editor and saved into packages and maps. Configurable settings for the game are defined in configuration files which are loaded at startup. Together these form the basis for every game made with Unreal Engine.

ProjectModuleClassOrg.png

The Creating a Game Project page walks you through the steps of creating a new game project. Once you have created your game project, you should familiarize yourself with the Directory Structure of the project. This will help you to know what any existing files represent and what goes where when adding new files to the project. You can also supply Command-Line Arguments when running the editor with your project to do things like jump straight into game preview mode or start on a particular map.

Modules

In the same manner that the engine itself is comprised of a collection of modules, each game is made up of one or more gameplay modules. These are similar to packages in previous versions of the engine in that they are containers for a collection of related classes. In Unreal Engine 4, since gameplay is all done in C++, modules are actually DLLs instead of proprietary package files.

See the Gameplay Modules page for details on creating and using gameplay modules.

Module APIs

Functions and classes that need to be accessed outside of their module must be exposed via the *_API macros. Each item that is exposed comes with a compile-time cost, so be sure to only expose what is needed. If you only need access to a single function in a class, exposing just that function instead of the class can save a significant amount of time when compiling.

See the Module API Specifiers page for more details on exposing classes and functions to other modules.

Classes

Gameplay classes are defined using standard C++ header files and syntax in conjunction with special macros defined in the engine to help with defining aspects of the classes unique to Unreal Engine.

See the Gameplay Architecture for a complete explanation of class structure and creation.

Class Implementation

At the most fundamental level, an Actor is any gameplay Object that you can place in a level. All Actors extend from the AActor class, which is the base class of spawnable gameplay Objects.

Actors can be thought of, in one sense, as containers that hold special types of Objects called Components . For instance, a CameraActor contains a CameraComponent.

camera_actor.png

The functionality of a camera, like the field of view, is all contained within the CameraComponent. That means that the CameraComponent can be included in other Actors, like a Character, to give the same camera functionality to those Objects.

pawn_actor.png

Different types of components can be used to control how Actors move, how they are rendered, and many other parts of their functionality. All Objects, including Components, extend from the UObject class, which is the base class of all gameplay Objects. This means they cannot be directly instanced into the world; they must belong to an Actor.

Each Actor or Object is a single instance of a class. The class sets up the template for the Actor or Object. It defines the variables that can be set for that Actor or Object, and the functions that can be carried out within that Actor or Object. You can create new classes, or types of Objects and Actors, with C++ code. Blueprint Classes primarily allow you to create classes that set up new Actors, although you can extend a few Objects with Blueprint Classes as well. You can also combine the two, by creating a new C++ class and then making a Blueprint Class derived from that C++ class. To learn more about creating classes so you can make new kinds of Actors and Objects, see the Class Creation Basics page.

For more on Objects, Actors, and Components, see the Unreal Architecture documentation.

Help shape the future of Unreal Engine documentation! Tell us how we’re doing so we can serve you better.

Источник

Оцените статью