cover.eps

Title page image

Create Computer Games - Design and Build Your Own Game

Introduction

This book explains the basics of game design using the free game development tool Unity. This book was created to make Unity accessible for young adults who are interested in the process of game design but don’t know where to begin.

Game design is tough. It involves figuring out and understanding everything from design to coding. Knowing where to begin is daunting and can feel inaccessible. Just keep in mind that no one starts off great at game design. You don’t need to know everything to start, and thinking that you do is one of the hardest challenges to overcome.

This book was written to get people like me to start thinking about game design in a different way. This book isn’t about making a perfect game or about teaching you everything about game development or even Unity. This book is a starting line. It teaches the basics and encourages you to think about games differently.

ABOUT THIS BOOK

This book was written with the thought that games are tough to make and that coding is confusing. Think of this like a cookbook that explains why you use two eggs instead of three and what the pepper does to help bring out the flavor. The codes and game development that this book walks you through are approached from the bottom up. Things make sense when you understood why certain codes or components are needed. Just knowing the ingredients to a recipe doesn’t teach you how to cook.

FOOLISH ASSUMPTIONS

This book was written for teenagers who have an interest in developing games. People who have spent years working in game design will find this book repetitive and probably not useful at all. I don’t pretend that this teaches everything about game design — I know for a fact that it doesn’t. This book is an introduction to the field, so it was made for people who have little to no idea where to even begin when they design their games. Some rudimentary typing skills and access to a computer and the Internet are all you really need to read this book. You’ll also need a copy of Unity, which you can download for free (I’ll show you how).

ICONS USED IN THIS BOOK

Throughout this book, I use the following icons:

tip Tips give some clarifications or offer shortcuts. I use tips to help you understand the program better or do things in an easier way.

remember Anything marked by the Remember icon reminds you of principles or ideas that you should think about throughout your game development.

WHERE TO GO FROM HERE

This book takes you step by step through the process of designing a 3D platformer. If you have a clear idea of what game development is and know about Unity’s interface, you can skip the first two chapters and start with Chapter 3, where I dive into actually developing a game.

Chapters 8 through 10 use a separate program known as Blender and go into the basics of animation. If you aren’t interested in adding animation or you already have animations you want to include in your game, you can skip those chapters.

All the other chapters build off of each other and are designed to take you through the steps necessary for developing an example game that you’ll build with this book.

image

 

In this chapter, you’ll ask yourself questions about not just your games but all games. When you’re designing computer games, you need to think about the fundamental reasons people play games in the first place. The reasons people play strategy games aren’t the same reasons they play horror games. Both kinds of games are fun, but for very different reasons. The goal of this chapter is to help you understand what those reasons are so that the games you design deliver what your players are looking for.

Understanding how game mechanics and themes work together to create a gaming experience will help you better visualize and create your own game. If the mechanics aren’t fun or don’t fit, it doesn’t matter how cool the theme is — the game won’t be fun. If the theme doesn’t match the mechanics, the game might be fun but it won’t be memorable. If you aim to create great games, you need to understand both mechanics and themes before you even open the software you’ll use to build your games.

THINKING ABOUT WHAT MAKES FUN GAMES FUN

Have you ever played a game that you couldn’t put down? One that gave you the ability to shut off your mind without a care in the world because you were just hooked on it? A game that was just a lot of fun? I’m sure you have! Otherwise, you wouldn’t be reading this book.

But why were you sucked into the games you love? Why are they so addicting? What makes them fun?

Fun is where games live and die. If a game isn’t fun, nobody plays it. The first thing you have to understand, though, is that there are different types of fun, and different kinds of games:

image

FIGURE 1-1: XCOM 2.

image

FIGURE 1-2: Slender: The Arrival.

image

FIGURE 1-3: Super Meat Boy.

And these are just a fraction of the types of games that are available to play. Like films, there are many different genres, some broad (like action games) or specific (like puzzle-based fighting games — look up Super Puzzle Fighter).

Whether it’s to feel accomplished after beating a challenging level, or to feel powerless as you wander through the woods while an unknown monster hunts you, you want a game to provoke some sort of emotion in you. Fun comes from a game provoking the right emotion at the right time.

If you think about it, this is the same reason you watch a movie or read a book. When you want to laugh, you watch a comedy. When you want to cry, you read a tragedy. Understanding that fun comes in many different forms and goes beyond a single emotion can open up a variety of game design that you may not have thought about before.

image

FIGURE 1-4: To the Moon.

ASKING THE RIGHT QUESTIONS BEFORE YOU BEGIN

Think of game design like making something good to eat. You wouldn’t just throw any ingredient into a pan and hope for the best. To make it taste great, you need to start by asking yourself what kind of food you want to make. Are you making a salad? An appetizer? A soup or dessert? Once you know what the purpose of the food is — to be a satisfying entrée or a sweet treat at the end of a meal, for example — you can choose a recipe that will get you to your goal. And after you take it out of the oven or finish combining the ingredients, you might decorate it or add a garnish to make it look good.

Similarly, before you design a game, you need to ask yourself what type of game you want to make and who will be playing the game. In this section, I’ve listed some of the questions you should ask yourself.

WHAT IS YOUR GAME ABOUT?

Do you want to make a war game that puts players in the middle of World War II or a game about a haunted children’s restaurant where animatronic machines are trying to kill you? What your game is about can help you think about the story and help contextualize some of the decisions you’ll make as you’re designing your game.

WHAT TYPE OF GAME ARE YOU MAKING?

Is your game a choice based role-playing game (RPG) or a more linear platformer? There are many different types of games that you can make. The type you choose can drastically change how people see your game.

Imagine if Skyrim were a 2D platformer, or if Five Nights at Freddy’s (shown in Figure 1-5) gave you the ability to move around. Imagine how different those games would be.

image

FIGURE 1-5: Five Nights at Freddy’s.

WHAT TYPE OF FEELING ARE YOU AIMING TO PROVOKE WITH YOUR GAME?

Do I want my player to feel powerful or powerless? A game that encourages exploration in a vast wasteland, like Fallout 4 (shown in Figure 1-6), provokes different feelings than a game that puts players in a cramped hallway. You want to go into your game knowing what type of feelings you want the player to feel. Knowing this can influence mechanic and story decisions.

image

FIGURE 1-6: Fallout 4.

WHO IS YOUR PLAYER PLAYING AS?

Is he a soldier in the war fighting for his country, or is he the civilian just trying to survive as the war happens around him? When you make your game, think of how you want to frame your story or your characters. The story of a brave knight trying to vanquish her nemesis, the evil warlock, is far different than a story of an evil knight bent on defeating the good wizard.

WHAT IS THE PLAYER’S OBJECTIVE?

Games have goals. Sometimes the goal is to defeat the villain. Other times, it’s to survive until morning. Think of your game as a story. Characters need a purpose. Mario isn’t just running around the mushroom kingdom for fun. He’s going to rescue the princess. Setting a clear objective for your player will give her direction in your game. Even games that focus on exploration set objectives that the player can strive for. Even if the objective isn’t the most important part of your game, it’s important to have one.

WHAT OBSTACLES WILL YOUR PLAYER FACE?

What is stopping your player from reaching his goal? Games aren’t fun without any challenge. You never want your player to be bored in your game. The easiest way to prevent boredom is to understand what types of obstacles the player needs to overcome. This can take the shape of enemy characters trying to kill your player or just puzzles that the player has to solve.

WHO IS YOUR PLAYER?

The most important question of all is who you’re designing your game for. The type of person who plays a peaceful game like Minecraft (shown in Figure 1-7) may not be the same type of person who plays a fast-paced fighting game like Street Fighter. Knowing the type of person you want to play your game can help determine the type of game you create.

image

FIGURE 1-7: Minecraft.

CREATING YOUR GAME ON PAPER

A good exercise is to create a game on paper before you go into designing a game on the computer. This will help you understand the importance of mechanics in your game without your getting caught up with all the bells and whistles that come with a theme. Try thinking of a simple objective-based game that a person can play with just a pen and paper.

image

 

Unity is a program that you can download online for free — just go to www.unity3d.com/get-unity/download. Developed by Unity Technologies, this open-source program has opened up game development for a whole new generation of game developers (like you!). You can use Unity to develop 2D and 3D games, but for the purposes of this book, I show you how to develop a 3D game.

In this chapter, you’ll learn some basic organization techniques that will help you manage your game creation. I show you how to create a new file in Unity, introduce you to the basic layouts and controls of Unity, and explain how to create an in-game object. This chapter may not be the most exciting, but you really need to understand these basics before beginning your game, so don’t skip ahead!

Similar to the games you play (and will create!), game making is modular. You have to take things one step at a time. In later chapters, you’ll dive into more difficult parts of game creation that have way more moving pieces and files to keep track of. Organizing your files and knowing the layout of Unity will save you the headache of trying to locate your files or tools, not to mention hours trying to retrace your steps.

GETTING ORGANIZED

Whether you’re baking cookies or changing the oil in your car or developing a computer game, you need to get organized first. Getting organized isn’t the fun part of any job, but it makes every job easier.

Unity does a lot of heavy lifting when it comes to organizing the files you need to create your computer game. But before you begin creating your game, you need to create a directory to store all your games in. This directory serves two purposes:

When you create games on your own, apart from this book, you can make these directories as specific or as broad as you want, to include things like music files, sound files, image files, and so on. For the purposes of the game you’re building in this book, the directory described here (shown in Figure 2-1) will serve you just fine.

image

FIGURE 2-1: The directory for your new game.

CREATING A NEW FILE

When you have your directory set up (see the preceding section), you’re ready to create a new file. Follow these steps:

  1. Open Unity.
  2. Click Create a New File.

    The new project screen appears (see Figure 2-2).

  3. In the Project Name field, enter Boxo_3D_Platformer.
  4. In the Location field, enter Unity_Files.

    That’s the folder you create in the preceding section.

  5. Select the 3D button.
  6. Click Create Project.

    A new folder is created within the Unity_Files folder that contains all your game information, as well as all your assets (components that are used within the game, game objects, characters, music, images, and other types of files used in our game are all examples of assets).

image

FIGURE 2-2: The New Project screen.

UNDERSTANDING HOW UNITY IS LAID OUT

When you open Unity, you’re greeted with a scary-looking screen (shown in Figure 2-3). Do not be scared of Unity. The best way to get over your natural fear is to understand what every part of the screen is and how it relates to the game you’re creating.

image

FIGURE 2-3: This is what you see when you open Unity.

Here’s what you’re looking at in Figure 2-3:

image

FIGURE 2-4: The Toolbar.

NAVIGATING THE SCENE

Being able to navigate around your scene is important when you’re creating your game. You need to be able to move and rotate the scene controls in order to control and create your game. There are three main ways to do that:

CREATING A GAME OBJECT

When you know how to navigate around the scene, you’re ready to create and manipulate game objects.

There are two ways to create an object in Unity. You can either select the GameObject menu (near the File and Edit menus) or, under the Hierarchy tab, select the Create drop-down menu. Whichever method you use, choose 3D Object ⇒ Cube. That’s it! You’ve created a 3D game object!

Before you start playing around with the cube, reset the origin of the cube to be sure it’s at the center of the screen. To reset the origin of an object, follow these steps:

  1. Select the object whose origin you want to reset.
  2. Go to the Inspector window for the object (see Figure 2-5).
  3. From the Transform menu of the Inspector window, select the gear icon at the upper right.
  4. Click Reset.

    The rotation and position are both reset to 0 and the scale is set to 1, centering and resetting the size of the object. This will help you better place and move around your objects in the scene. It also guarantees that all your objects remain at the same axis of rotation and exist in the same scale.

image

FIGURE 2-5: The Inspector window.

You know how the Toolbar can transform your objects, but there is another more precise way to do this in the Inspector window. The Transformation section of the Inspector window moves, scales, and rotates objects by specific numbers along the set axes:

  • Position indicates where the box is in relation to the center point of the scene’s grid.
  • Rotation indicates the angle that the box is in relation to each axis.
  • Scale indicates the scale of the box in relation to its original size.

Play around with these controls to get used them. Then set the Scale of the cube to 4 in the X, Y, and Z (the Position and Rotation should remain 0), as shown in Figure 2-6.

image

FIGURE 2-6: Object Reset at 0,0,4.

You’ve created a cube object, but there are other objects you can create in Unity. Here’s a brief overview:

  • 3D objects: These are the normal game objects within 3D games. The 3D objects include the following:
    • Cube
    • Sphere
    • Capsule
    • Cylinder
    • Plane (flat surface)
    • Quad (a single face with four sides)
    • Rag-doll (a character)
    • Terrain
    • Tree
    • Wind Zone
    • 3D Text
  • 2D objects: There is only one type of 2D object that you can create with this menu: sprites. Sprites are images that you can program to change to show different things for different actions — everything from a character running to a character shooting a gun or talking.
  • Empties: Empties are invisible objects that you place in the scene to control or mark something about the scene. They won’t show up when you export your game and act only as controls within your game.
  • Lights: Lights brighten the scene and can change how the game looks depending on the light setup. Lights are mainly used to brighten the characters and setting and help render a character in 3D.
  • Audio and video: The Audio and Video menus help render videos and sounds into your game. These can range from background noise/scenes to music and dialogue.
  • UI: UI stands for user interface. This alters what the player sees onscreen while playing the game. It can range from text informing the player of the controls to images and health bars.
  • Particle systems: Particle systems include a variety of different effects that can be seen onscreen, ranging from downpouring water to explosive fire blasts.
  • Cameras: Cameras act as the player’s eyes into the game. They can be stationary or follow the player around, but their primary purpose is to frame how a game is played. This may not seem important, but the angle at which a game is played can change a lot about the game itself. One example: A first-person shooter framed as a top-down shooter is a vastly different play experience even if the controls are exactly the same.