Unreal Engine 5: Epic Games Game Engine
Tags: gamedev, cpp, programming, opensource
Published: 2023-02-27 07:03:16

## Intro
Today's discussion is about a game engine that I've had an interest in for a while and had a chance to work with for the first time confidently, Unreal Engine 5 or UE for short. UE is a gaming engine that was designed by Epic Games and is named after the game series of the same name Unreal. While designed with the FPS genre in mind, this engine has gone on the be part of many different successful titles including Gears of War(series), Rocket League, and very well known today Fortnite. A very impressive list of AAA titles however, we didn't come here to talk about the games. Instead we are here to talk about how to get starting in UE, and all the terminology that comes with it.


![Fornite Dance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9j7zkpbdfl6wuhox7yd8.gif)

## Tech Talk 

When creating a project in UE, you are given a choice of how to implement your code into your game. **C++** is the native language passed into the program, however we have another part that can be used in conjunction with the language called **Blueprints**.




![Blueprints](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ut7r1q5e75ti1ync5gq.png)

> _Example of a door blueprint_

Blueprints is Epic Game's language binder that allows you to link different aspects of your project together to give you a final product. Most of the Blueprint library is built-in C++ scripts that are free to use. You can also import other components into Blueprints through C++ script files that you create. Blueprints have various different sections that house smaller elements inside them. **Worlds** and **Levels** are the bigger pictures, which are the bones of the game.

![Worlds/Levels](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/53qwe0bezce1725y8v0w.png)

They are the maps and section of maps you want to render at a time. Think of the load screen as a way to switch between each Level in a World.

Inside a World or Level, we have **Brush** and **Actors**. While Brush consist of non interactive 3D objects in the game, Actors are object that can interact with each other inside the Level/World.

![Actors](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dp4mov5e81wgz3deieic.png)

> _These are various Actors_

Actors can be broken down to 2 categories: **Pawns** and **Characters**. Pawns are user and NPC objects, while Characters are specifically users. These actors are granted functionality based on 3 subclasses built into them; **Classes**, **Objects**, and **Components**.

The easiest way to explain these 3 concepts would be to compare them inside a coding language. For those for you who don't have a good understanding of C++ here the skinny. C++ is object-oriented, meaning that every created must start in an object. Objects are code blocks designed to hold functionality. These objects hold components, while classes hold the objects.

```
UCLASS()
class MYPROJECTCPP_API AWeapon : public AActor
 {
    GENERATED_BODY()

    FHitResult HitResult;
 protected:
   
    FString WeaponName;
    float FirstSpawnTime;
    float SecondSpawnTime;
    float FireRate;
    int32 DamagePerShot;

    int32 START_AMMO;
    int32 MAX_AMMO;
    int32 AmmoPerShot;
    int32 Ammo = START_AMMO;

    bool bInfiniteAmmo = false;
    bool bWeaponDisabled = false;

 public:

   AWeapon();

   AWeapon
       (
         float firstSpawnTime,
         float secondSpawnTime,
         float _fireRate,
         int32 damPerShot,
         int32 _startAmmo,
         int32 _maxAmmo,
         int32_decrAmmo
         );
   
   virtual void PrimaryFire(AMyProjectCPPCharacter* Shooter);
   virtual void SecondaryFire();
```

> _This is a class object of a gun in a game given a starting ammo count_

> source: https://forums.unrealengine.com/t/c-implementing-a-class-for-the-weapons-crash/49321

The above example is a class built in C++. This is a class for a gun Actor. Inside the class are 2 Objects built with different components inside them. These components are the characteristics for the Actor; different variables to different parts of the Actor. While this characteristics are static on the actor, there are ways to change the functionality when 2 different actors interact. This is called casting.

_EX: Fire is an actor, and if a player actor stand in fire they should trigger a Casting action that will cause them to take damage and/or set them on fire._

Casting (as explained in the example above), is a boolean call that changes the properties on Actor(s) when they interact with other Actor(s).

The last things we need to talk about is Game State and Game Mode. Game Mode is what you want menus and other text related screens to look like. Game State is the version of the game that you want multiple clients (or users) to see at the same moment. A less technical way of putting it is what you want 2 or more different people to see at the same time. This is especially important in multiplayer games online.

There are more commands and other parts to explore, but for now, let look at the actual application.

## Presentation and Application

Inside the project, we have a preview of the world/level and the various tabs that you can use to create an environment that you can interact with. Here is an example of the menu.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fznf4as0tw30f5zpibme.png)

While I won't go to into detail about each menu choice, I will talk about a couple of them that are important to actor creation; Modeling, and Selection.

Selection allows you to manipulate an Actor's placement, orientation, and size all inside of the level.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bp9ydh9tmpch4rrumy2d.png)

> lets us see different selected object or actors on the screen

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hokn2yv802goj1q145hu.png)

> Example 2 of selection

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdfs18q8lz7lvr676gw3.png)

> Example 3 of selection

Modeling is the creation of an Actor and assigning it properties. Modeling allows us to build our environment out with shapes and objects that can be interacted with.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/st8qgwk4hip04i4zec4n.png)

On the right side of the page is a class editor. This will allow you to change different aspect of your actor (see Class up above). You can also dive deep into a class and change individual objects inside it.

While this was a first step in explaining UE's different aspects, I hope that you guys have some small knowledge gained from checking out this post and will also tinker with it if you have small interests in game development.