#videogame #gamedev #unreal
Last edit: 2020-02-01
January 18, 2020
published by: Yonseo
Like most things to get started using a library or a software you read the documentation. Here's a link of what I'm going to be covering.
Here's a link to the project files for this tutorial.
First thing to know about Unreal Game Engine is that Actors are objects in a scene. Objects can be anything from a light post, a bear, a person, a chair, etc. You can attach scripts to Actors.
For example, if I have a box in a scene it will do nothing but appear on the screen. To give it a function or something to do we can code a script and attach that script to the Actor.
This is how objects interact and function in a scene. Like actors in a film, except we use objects and in game engines objects can be anything we create.
To develop games in Unreal Engine you need an IDE (integrated development environment) where you can type and compile code.
There are two code editors, one is Visual Studio(for Unreal Engine Development) the other is Visual Studio Code(general purpose code editor). I'm using Visual Studio Community edition.
You can download Visual Studio here: https://visualstudio.microsoft.com/
To confugure Visual Studio to work better for Unreal Game Development: https://docs.unrealengine.com/en-US/Programming/Development/VisualStudioSetup/index.html
I created a project with a parent class Actor and named it MyProject (project names cannot contain any spaces). This will create the Actor class for me and launch Visual Studio.
You will see this message below appear at the bottom right of your Game Engine window.
If Visual Studio does not open automatically then refresh your project as shown in the picture below. This option is to sync Unreal Engine to your project in Visual Studio. It's important to refresh your project when changes are made or when you first open Unreal Engine.
If you don't see "Refresh Visual Studio" or "Open Visual Studio" options then go to Edit > Editor Preferences > General> Source Code.
From here you can select the default editor you want your project to open with. I'm using Visual Studio 2019. Click Set as Default. You may need to restart Unreal Engine to save changes.
Now you can open your project with Visual Studio through the file menu. Remember if you're having problems with opening Visual Studio with Unreal Engine you need to refresh your project first.
Your project directory should look something like this.
I've copied and pasted the code provided into the actor c++ script which you can see below. At this moment I'm working with c++ code but I am not programming. Later, I will go over programming in c++ to change some things about our cube.
The actor header script.
We have two files, one is .cpp (c++ file) and the other a .h (header file). A header file is like an index in a book where you can check what topics/subtopics are on what page. The difference here is that we can access the index and specific data without turning the page because the header file is included on line 4 in my FloatingActor.cpp script by using the tag #include.
You can build your project by right clicking and selecting build. It's important to save before you attempt a build.
Alternatively you can build in Unreal Engine by clicking the Compile button in the toolbar. Always save your work before you attempt to Compile.
A mesh is a 3 dimensional polygonal object that is connected by vertices. The faces that fill the vertices are called polygons. The vertices of an object CAN be animated but if static it can NOT be animated therefore making it a static mesh. Static meshes can be scaled, moved, or reskinned in realtime making it an editable object.
Last edit 1:52pm Jan.21
To open your project folder in Unreal Engine click on the folder icon shown in the image. This will display a pop up and under C++ Classes you will find your project folder.
You should see an object named FloatingActor. Drag and drop FloatingActor onto the 3D window. This will create an instance of the FloatingActor object and rename it to FloatingActor1.
An instance is a copy of an object that retains all of that objects properties.
We can think of this as a grain of rice. There is white rice, brown rice, short grain, medium grain. There are multiple of the same type of object which retain the same qualities of that one type of object. If we wanted to change white rice to brown rice I would only need to change the objects property (in this case the color property) to a brown color. By changing this one objects property all other instances will change to be the same as the original object.
It's important to know that the original object is not used in game but rather instanced to create duplicate objects. You will see that when the FloatingActor object is dropped onto the 3D window it is renamed to FloatingActor1. This is how instances are used in Game Development.
#videogame #gamedev #unreal
Last edit: 2020-02-01