sexta-feira, 6 de junho de 2014

Initial preparation of the game

Let's start building the sample game that will contain the rules that were described in the previous article.

The first step is to create a new project. Choose the "New Project" option and search for the template named "TP_ThirdPersonBP". This template contains a character and a third-person camera that rotates around the character.

Choose a name for your project and click the "Create Project" button as image below.


The template contains a simple scenario with some objects and the text "Third Person Template":


For our game remove the text and the visual objects that are in the middle of the scene leaving only the floor and side walls. To remove an object, simply select it and press the "Delete" button. The scenario will be like this:


This template has a blueprint named "MyCharacter". Access the "Blueprints" folder on the "Content Browser" to open it. This blueprint represents the player and contains a simple "Skeletal Mesh" with movement animations.


It is necessary to measure the area of the game to use in the blueprint "Statue", because it will be appearing in a random position in the game. We need this information so that the statue appear correctly within the four walls of the scenario.

To measure it is necessary to change the "view" of the level editor. Click a button labeled "Perspective" which is on the top left of the level editor. Choose the "Top" view:


The editor has a ruler that is triggered by pressing and holding the middle mouse button. The Unreal Engine 4 uses centimeters as the unit of measure.

The image below shows the editor in the "Top" view. The red line represents the X axis and its positive values ​​are on the right. The green line represents the Y axis and its positive values ​​are below. The meeting point between the two axes is the origin where (X = 0, Y = 0).

The blue rectangles in this image represent the walls of the scenario. We need to measure the distance between the origin and the walls. Let's start by finding the positive value of X. Place the mouse cursor at the meeting point of the axis, hold the middle mouse button and drag to the right until you get close to the wall. The goal here is not accuracy.  It is necessary to leave a space so that the Statue does not overlap the wall.

The positive value that I found for X was 600.


For the negative value of X place the mouse cursor on the origin, hold the middle mouse button and drag to the left until you get close to the wall.

The negative value that I found for X was 2200.


To find the positive value of Y it is necessary to measure the distance from the origin to the wall which is below in this top view. 

The positive value that I found for Y was 1800.


The negative value of Y is above. The value found was also 1800.


With these measures we define the coordinates of the area that the game will use.

The position of X can range from -2200 to 600.
The position of Y can range from -1800 to 1800.

There is another measure that will be useful in the creation of the blueprint "Statue". We need to check the distance from the origin to the floor of the scenario. To do this change the editor to the "Side" view and zoom the image.

In this view we have the Z and Y axes. The Z axis is vertical and is represented by the blue line. Its positive values ​​are above.

Place the mouse cursor at the meeting point of the Z and Y axes, hold the middle mouse button and drag upwards to reach the top of the rectangle that represents the floor of the scenario.

The positive value that I found for Z was 125.