Learn Unreal with our new book series 📖

It’s that time of year… we at Mammoth Interactive have published new books! Available in both Paperback and eBook format, check out “Introduction to Unreal” and its sequel “Build 6 Games in Unreal.”

The Unreal Engine is a powerful program for building games. Learn how to navigate the Unreal editor by building a Coin Collector game!

First we set up the Coin Collector game’s design in Unreal. You learn how to position a camera in a game so that the user sees the game from your desired viewpoint. We make Blueprints to save objects. We give shape and color to the characters and objects in the game.

A sneak preview of the Paperback edition.

A sneak preview of the Paperback edition.

Then we use C++ scripts to give the game custom functionality. You learn how to process collisions and keep track of the number of times two objects collide. We make a coin disappear when the player touches it. We add a text box to the game to display the score. As well, we enable the player to restart the game with a hotkey.

By the end of this book, you know how to create a game from scratch that responds to user input through keyboard controls.

 

Learn how to navigate the Unreal editor while building 6 basic games. This book is an extension of “Introduction to Unreal.”

A sneak preview of the eBook edition.

A sneak preview of the eBook edition.

We make the following games:

  • Coin Collector Game
  • Shooter Game
  • Platform Switcher Game
  • First Person Shooter Game
  • Turret Game
  • Runner Switcher Game

Both of these books make creating your own game easy and efficient. You learn both the coding and artistic sides to game development. As such, you gain a unique perspective that is familiar with the different skills needed to make a game. Grab your copy today. 📖

 

Our biggest SALE yet. Get up to 96% off.

↓ The first 1000 to enroll get up to 96% off. ↓

Learn how to make 20 games in GameMaker.

✔ make games including: shooter, rollerball, platformer, platform shooter, cross shooter, turret, color shooter, color matcher, apple catcher, dodger, collector, double shooter, side scrolling shooter, balloon burst, penalty, flappy bird, double jumper, ricochet shooter, ship dodger, jumper, and gravity switch.
✔ get introduced to coding
✔ get 96% off

The Complete Java and Android Studio Course for Beginners

✔ learn the fundamentals of coding: variables, statements, functions
✔ build different apps, including calculators, games, and maps
✔ get 94% off

Build “The Legend of Zenda” in Unity3D and Blender.

✔ learn Unity, Blender, and C#
✔ design characters, weapons, and enemies
✔ draw video game levels
✔ get 96% off

Ultimate TVOS Guide for Beginners. Learn to code in Swift 3.

✔ be able to code in Apple’s programming language
✔ navigate the Xcode interface
✔ make a Quiz app, a Dialogue Tree app, and an Interactive Story app
✔ get 96% off

Some of the code you'll build.

Make a Ninja Survival game in Unity and Blender.

✔ learn Unity, Blender, and C#
✔ set up and code a fully functioning game from scratch
✔ draw ninjas, enemies, and other art assets
✔ get 96% off

Learn how to make a Super Marlo Run game.

✔ learn Unity, Blender, and C#
✔ make speed blocks and enemies
✔ design the background and interface
✔ get 96% off

Creating a C++ Script | Unreal Tutorial

Scripts are so important when it comes to making a game in Unreal. For an in-depth lesson on Unreal, consider enrolling in Mammoth Interactive’s Unreal course

If you want to add a player to your game, you need to write code to give the player its own behavior. Default modes contain logic from Unreal. To create a new mode with custom behavior, you need to write a script.

Go to C++ Classes > CoinCollector in the Content Browser. Right-click in the Content Browser. Select “New C++ Class”.

Select “Pawn” from the “Choose Parent Class” to extend a pawn. With the Pawn class, the mode to be able to receive input from the player. The player will be able to move the mode.

Press Next. Name the pawn “HeroController”. Our player to be a hero who collects coins. Press “Create Class”. Unreal will create the script. Note that it does take some time for Unreal to create or compile a script.

We will enable HeroController to move based on user input. When the code compiles, you can open Xcode to view the files of the script if you are on a Mac. If you do not own Xcode, you can download it from the App Store. Xcode is a free program that you can use to write code.

If you are using Windows, you can use Visual Studio to write your code. Visual Studio should already be on your computer.

The Files of a C++ Script

Two files will open with the script: HeroController.h and HeroController.cpp. These are two different files for a single class. .h files are header files. They are used to list variables and methods in a class.

.cpp files are implementation files. They are used to implement those methods and variables. HeroController.cpp contains the implementation of HeroController’s behavior.

We will begin coding in HeroController.h. Some default code is already in the file. class COINCOLLECTOR_API AHeroController : public creates the class. Then there are five public functions:

  • The ACoinController function is a constructor. ACoinController is called when the script loads (when the object is created).
  • BeginPlay is a function that is called when the game starts (after the constructor and internal processes complete). A function performs a method or operation. You can use functions to set the behavior of an object.
  • Tick is a function that is called every frame (every time the game is processed by your computer, smartphone, or console).
  • SetupPlayerInputComponent is a function that is called to configure the input. Whenever we want to make HeroController move left, right, top, or bottom, we need to register the input bindings in this function.

Note that typing // in front of a line turns the code into a comment, which is not read by the compiler. You can use comments to organize code.

To learn how to build 6 games in Unreal, enroll in our Unreal course.

Navigating the Editor | Unreal Tutorial

Unreal is a free program  you can use to make powerful 2D and 3D games. To learn how to build 6 games in Unreal, enroll in our Unreal course.

When you create a project in Unreal (like we did in the previous tutorial), your screen will look like the following image.

The left window in the Unreal editor is the Modes window. The Modes window contains a list of elements that you can drag into the game. Click and drag the right side of the window to increase the window’s width.

One object you can add to your game is a cube. Drag and drop “Cube” from the Modes window to the Viewport, which is the window in the center of the screen.

The Viewport shows the game from the developer’s point of view. In the Viewport, you can click and drag the cube to move it.

If you right-click and drag your mouse in the Viewport, you can look around the game’s world. You can also hit the W, A, S, and D buttons while holding Right Mouse Button (RMB) to move around.

The default tool selected in Unreal is the Translation tool, whose icon is pointed at in the next screenshot.

Click on the icon to the right of the Translation tool to select the Rotation tool. Your Viewport will look like the following image. You can click and drag the wheel that appears on Floor to rotate the object.

Click on the icon to the right of the Rotation tool to select the Resizing tool. Your Viewport will look like the following image. You can drag the handles to change the size of Floor.

Delete Cube from the Viewport by hitting Delete on your keyboard when Cube is selected. Another mode you can add is Empty Actor. Drag and drop “Empty Actor” from the Modes list to the Viewport.

An empty actor contains a position. It is something that you can place in a level and that you can dynamically spawn. Every object in your game needs to be an actor so that the object has a position.

In the Viewport, Empty Actor looks like a sphere. However, Empty Actor is not a 3D object. The game’s player would not see the sphere. The sphere is just there to inform you the developer that the empty actor is in the scene.

Delete Empty Actor. Another mode is Empty Pawn. Pawns are actors that can receive player input. Pawns can jump or move when the player presses a button or hits a key. Empty Character is a pawn that contains a mesh (3D mesh) that can look and move like a human.

Below the Modes window and Viewport is the Content Browser window. The Content Browser contains the files that you drag into the game. Here you can have Materials, 3D models, textures, scripts, and audio, among other assets.

The top right window is the World Outliner. The World Outliner lists the items in the game. Select the floor of the game in the Viewport by clicking on it. World Outliner will highlight its “Floor” line.

In the Viewport, you can click and drag the arrows in the center of Floor to move the object.

The bottom right window is the Details window. This window contains details about the item currently selected. Details contains a list of components of the selected item. With these components, you can change the properties of objects.

For instance, in the Transform component, change Floor’s X Location value to 500. Floor will move in the Viewport to the position you set without your having to recompile the code. Unreal is useful in this sense because you can see changes automatically.

Now you know how to navigate the Unreal editor! To learn more, consider enrolling in Mammoth Interactive’s Unreal course.

Creating a Project in Unreal | Unreal Tutorial

Unreal is a free program  you can use to make powerful 2D and 3D games. To learn how to build 6 GAMES in Unreal, enroll in our Unreal course.

Unreal Engine is a complete product suite that does not require additional plugins. To download Unreal Engine, visit www.unrealengine.com/download. Download the Epic Games Launcher and then the Unreal Editor.

Creating a Project

When you open Unreal, the Unreal Project Browser window appears as in the following image.

Here you can create a new project. In Unreal, every game you make needs to be in a separate project. That way, each game has its own folder and code base.

Unity provides several templates in the New Project tab. For our example, create a Blank project. We will build our game from scratch. Below the New Project tab, you can choose some settings for the project. For instance, you can select the target hardware: “Desktop / Console” or “Mobile / Tablet”.

As well, you can select Quality settings. Unreal provides the option of using Scalable 3D or 2D. There is also the option to include Starter Content. When you create a project with starter content, the project will contain elements that you can drag into the game. Otherwise, your game will contain basic 3D primitives.

Below the settings options is a Folder option where you can set the location of your project. It is good practice to create a Projects folder to contain your projects.

Press “Create Project”, and wait for Unreal to create the project. Your screen will look like the following image.

You just created a project in Unreal! To learn how to navigate the Unreal editor and more, enroll in our Unreal course. (It’s only 9 dollars!)