Post
avtar img holder

Yonseo

2020-01-18 10:24:08
  • Last Edit: 2020-02-01 03:21:00
  • First time using Unreal Game Engine

    avtar img holder

    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

    https://docs.unrealengine.com/en-US/Programming/QuickStart/index.html

    Here's a link to the project files for this tutorial.

    https://github.com/yonseo/unreal4_floating_actor

    What are Actors?

    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.

    What is Spawning?

    When an object spawns onto the scene it means it will appear from no where and render instantaneously. Because we are working in a Game Engine we can place objects anywhere. This is where they will spawn. We can control where and when objects spawn by either moving them into the desired location or coding a script and attaching it to the Actor object.

    Visual Studio IDE

    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

    Opening projects with Visual Studio

    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.

    Working with C++ Scripts

    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.

    Building and Compiling Code

    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.

    What is a Static Mesh?

    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.

    Working in Unreal Editor

    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.

    What is an Instance?

    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.

    Press Play

    Press the play button and watch the cube spin as it floats up and down. This is all done by the script that is attached to the object. On the next post we'll look at how to edit c++ scripts to change the objects function.

    Last edit 3:21pm Feb.1

    Latest Posts

    avtar img holder
    First time using Unreal Game Engine
    Category
    avtar img holder
    React JS Study Notes
    Category
    avtar img holder
    Creating a Component in React JS
    Category
    avtar img holder
    Javascript for Bubble Tea
    Category
    avtar img holder
    Github Commands
    Category
    avtar img holder
    FuelPHP Login & Authentication
    Category
    avtar img holder
    Intro to C++
    Category

    COPYRIGHT © 2019Taiyaki.io All rights ReservedHand-crafted & Made with