C++ and The Unreal Engine

Danny Padron
3 min readApr 18, 2021

--

Working with C++ in the Unreal Engine has been really fun and enjoyable. Once VSCode was setup with the Unreal Engine, working on code for the structure of your game was simple and done through VSCode like always. Within the Unreal Engine editor itself there is many more options on what you can do with the world that you are creating. Once you have downloaded the Unreal Engine and connected to VSCode you will be able to see the project that you are creating within the Unreal Engine editor inside one of the many windows that it provides. This particular window is called the Viewport, this is where you will see the basic “level” or “world” that you have created for your game. From inside the Unreal Engine editor you have so many different tools to add in different Actors or to change the landscape. An Actor within the Unreal Engine is any object that can be placed within the level, they all have transforms, which means they have the ability to be moved around or rotated etc, and there are several different types of actors anywhere from “StaticMeshActors” , to a “PlayerStart” actor or even a “SpotLight” actor. Actors in a sense can be thought of as containers that hold special types of Objects called Components. These Components can also have different types to them which is what would control the actor from how it moves to how it even gets rendered into your world.

A “StaticMeshActor” is one of the more simple and more used Actors within the Unreal Engine. Even though the name implies that it is “Static” the “Static” in the name really only refers to the mesh, this mesh is static only in the sense that the geometry of the Actor itself can not be changed, but the Actor can move through the world. The “PlayerStart” actor is another one that is simple to use as well but still very vital for the project, because as the name implies as well this Actor is simply placed where the player will begin when the game is ran and begins. There is also different types of “LightActors”, which by now you probably have figured out that these are Actors that generate different lighting effects. Three of the Actors for lighting are the ‘PointLight”, “SpotLight” and the “DirectionalLight”. These names are also pretty self explanatory, but a brief description of each is that the “PointLight” is used much like a real world light bulb, the “SpotLight” emits the light from a single source point outward in a cone shape, and the “DirectionalLight” simulates light that is emitted from a source that is far away, the shadows are all parallel to the light which makes this lighting the best to use to simulate real world sunlight.

When we mentioned the basic idea of what an Actor is in the Unreal Engine we said that it is basically a container with different Components. Well these Components are pieces of functionality that we add to our Actors. These Components can not exist by themselves they can be added to the Actor and then the Actor will have access and be able to use the functionality within the Component. Some simple example of these Components are Audio Components, Camera Components, Movement Components, Physics Components and many others. A good example to think of when you think of Actors and Components is to look at the Actor as a car. The entire car as a whole is the Actor but that car has different Components to it. There are tires, engine, headlights, steering wheel, chairs, radio, all those are different components that make up the car. Working in the Unreal Engine using C++ has only been challenging in the sense that there are slight syntax changes that you need to be using when writing your C++ code so that the Unreal Engine will be able to work with it correctly.

--

--

Danny Padron
Danny Padron

Written by Danny Padron

Full stack web developer with experience in Ruby on Rails, JavaScript, React and Redux and learning more!

No responses yet