Saturday, January 31, 2015

Steps Towards First Prototype

Today we began working on an initial playable version that shows a hint of what we're trying to accomplish. Through entirely blueprint interfaces we've implemented our Pawn and a Sphere Actor and prepped both for collision. Currently we're learning how to use shaders in UE4 by checking out Unreal's amazing Math Hall demo - Math Hall.


What Is UE4?

As Unreal is a powerful set of tools, it can take some time to learn how to use them or understand what others mean when they talk about it. Hopefully this writeup will provide some context to the work we discuss.

Our Unreal 4 Simple Survivor Guide



First thing is the large viewport, where you can see the scene. Clicking on an entity in the viewport will allow you to manipulate it using a series of X/Y/Z arrows that work as handles, which you drag in the respective direction. Hitting space will swap it out for rotating and scaling handles.
On the bottom left is the content browser, where the bulk of the work will take place.

Right clicking an empty part of it will allow you to add new objects to your project, also known as blueprints.
Blueprints are like classes in code, as in you define this type of object and can place as many of it as you'd like, but all are defined by this initial one.
Pressing blueprint in the right-click menu presents you with a menu which asks which object this blueprint is a type of, as seen on the right.

An Actor is a blanket term for object. It can be anything that you see in the scene.

Pawn is the object that the player controls. Within a pawn you add components such as collision, the camera, a mesh (the model you see) and define the movement/camera controls.

The Player Controller is the metaphorical soul to the Pawn's physical body. The controller will possess the pawn and then all the Pawn's functions will begin. An easy example is hopping into a vehicle in a video game - the vehicle is now the Pawn, or your physical existence in the game world with it's own camera and set of controls. Controller also can save certain things regarding the player's profile, but that's beyond the scope of this simple project.

The Character is a very specialized type of Pawn with a lot of prebuilt properties (like camera, walking, etc), and is also not necessary in this project.

The Game Mode describes rules for the game itself - when to end, what to do when it ends - load new map, display victory screen, etc. It also controls what type of Pawn and Player Controller to use. You want to set your Game Mode you make to spawn your Pawn. Setting the game mode to yours is accomplished by accessing world settings and setting it through the window that opens.

There are plenty of other tutorials on how to make the most of the blueprint interface, and since this is just a survival guide to give context to what we're doing, we'll keep it simple: Below is our Pawn's blueprint "code" for implementing moving and turning the camera.
You use white lines to control the program's flow, and can right click to bring up any variable or function in the current scope. Through this you can effectively (and slowly) code without typing a letter of C++.


On the top right you can see three tabs. The Components tab is for editing components of the Pawn. You can simply select "camera" from a drop down menu and have a functioning camera, and collision and meshes are just as trivial. Defaults allows you to set default values for variables you declare throughout your blueprinting. Graph is the currently open window, which has 3 tabs in this image. You can declare functions through the interface, which is where the "Enable Movement" tab comes from, so you can ignore it for now/forever. The two important tabs are Construction and Event. Construction is ran through at creation of the object, and Event is a large field to place Event calls on, such as "InputAxis LookRight" as pictured above. Using these two you can give pretty much any behavior to your Pawn.

This should be enough to give an understanding of what we discuss as we work.