Sometimes the best way to get into game design is to jump right in. Getting to see the results of your own work moving on the screen is exciting, and that creative excitement is the best fuel to get into game design.
On that note, this tutorial will show you how to make a game with Unity–or at least the beginning of one–starting with an idea. You will learn a little bit about how to use Unity for 2D projects and you will also learn a good startup method for making games by yourself.
This tutorial will not make you a full fledged Unity developer or teach you how to code, we’d need a lot more time than we have. This will only get you into making something work on screen quickly.
I selected Unity because it is one of the most popular free game engines available, and they have an excellent 2D engine, no 3D models needed. We also don’t need too much programming. Game development with Unity is good for putting together things that have already been built. Hollow Knight, a fantastic metroidvania platformer, and Ori and the Blind Forest were created on it. It’s perfect for our little indie game.
Step 1: Idea
I know I said the best first step is to jump right into building the game, but we do need to do some idea work before. For example, before we get started we need to know what kind of game we’re making, to figure that out, here are a couple game design questions we need to ask ourselves:
- Is it a platformer, a top down game, or maybe isometric?
- What will the theme be, the basic story?
- What will it look like?
- What engine will you use?
- Most importantly, How will your game stand out? What new mechanic or idea does it introduce, or what will it do well?
The good news is that you don’t need solid or specific answers to most of these questions, not yet anyways. But you do need a general idea of what you’re going to make before you start, something that you can expand on later, and can create a basic prototype for. Some people like to do this on paper, but it’s totally acceptable just to think about it for a bit.
For this example we’ve already decided to use Unity, so we will stick with that. I’m in the mood to make a platformer, so let’s do it. Maybe the platformer’s special rule that makes it stand out is that you have to control two characters at once to solve puzzles, and they have to meet to complete the level.
That’s it–just a few ideas for what you’ll be making, so we have a guide to get us started. Now we can move on to the prototyping.
Step 1.5: Get your tools
To make a game in Unity, you’ll need Unity. You can download the personal version here. Keep in mind that the personal version is only if you haven’t gained more than $100k in funding or revenue for your game. If you’ve done that, you hopefully don’t need this tutorial.
Start by downloading the ‘Unity Hub,’ then open the hub, go to ‘Install,’ and click add. We’ll be working with Unity version 2019.2.14f1. You can install any packages you’d like or have space for, it depends on what targets you want your game to run on. I think we will stick to making a game run on windows, so make sure the ‘Windows build support’ box is checked.
We also plan on making some graphics for our game. Since we’re doing pixel art, I highly recommend using GraphicsGale. It’s free, easy to use, and it has a ton of features. However, feel free to use whatever editor you’re comfortable in, from Photoshop to Blender to Windows Paint. As long as you can make images with transparent backgrounds, you should be fine.
Step 2: Setup our project
While Unity is installing, we can take a bit of time to prepare some of the resources we will need. We will need some stand-in graphics, called placeholders, so that we can see what we’re making. It’ll take a while to actually draw all of our character animations, enemies, and the environment, so we’ll start with some simple graphics to get started.
I’m still using GraphicsGale for this project, but you can use any editor. Let’s make just one thing for now: a stand in for our walls in the game. We can make more later. The only rule for these right now is to make them 100 pixels by 100 pixels in size
I made one really quickly, you can get it here:
Once Unity has finished downloading, we can open up the Unity Hub and start a new project. Name the project whatever you’d like, but make sure you select 2D for the project setup.
Welcome to Unity! You should now be looking at the Unity Editor. To navigate the 2D space in the editor window, use the middle mouse button to pan, and the scroll wheel to zoom. You can see there is a camera in the middle of the space. This is what the player will see.
Unity has an incredible feature called the Unity Asset Store. The Asset Store is full of prebuilt chunks of game like models, textures, utilities, or AI programs. Some are for sale, and some are free. Because of this, it’s easy in Unity to build a game without really making too many assets yourself. You can simply take pre-coded game mechanics and attach them to your own art. We are going to get some basic programming assets for our game that Unity provides for free.
Go to the ‘Asset Store’ tab near the top of the view window. From here go to top free assets, and download the ‘Standard Assets (for Unity 2017.3)’ package. You may have to sign in or make an account.
Once the package has downloaded, press ‘Import’ (it replaces the download button after the assets have downloaded) to import the package into your current Unity project. You’ll be presented with a long list of checkboxes. What you add from the package is up to you, but for this tutorial we only need the ‘2D’ folder and ‘CrossPlatformInput’ folder under ‘standard assets.’
We will also need some tools just for making 2D games in Unity that will help us out quite a bit. Go to this link, and download the Git as a zip. Then unzip, and drag and drop the folder inside into your asset browser. You may have to restart Unity after to make it work properly.
All right, now we should have everything we need to get started. Let’s dig in and start making it work.
Step 3: Make the map
We will start right in. Return to the Scene tab. In the asset browser, at the bottom of your screen, right click and click create>folder. Name the new asset folder “Tiles.”
You’ll also want to add your placeholder art to the asset browser, just drag and drop the whole folder from windows to the asset browser.
Now, we are going to make a palette. This will serve as the blocks that your character can run into. Go to Window>2D>Tile Palette to open the Tile Palette window. Click ‘create a new palette’ to make a new tile palette. Name it “solid”, but keep all of the defaults, and save it to the folder called Tiles.
|A note on organization|
|It’s very easy to make folders at the moment we need a folder or file, and then leave it wherever we created it. While this is totally fine if we plan on making a tiny game with three sprites, it isn’t a good idea if we plan to expand our game into something bigger. As our project grows, a lack of organization will come back to bite us.|
Simply drag and drop your placeholder art for level blocks into the above window. That will add it to the palette.
Our next step is to create something to paint on with our palette. In the Hierarchy window right click and go to 2D Object>Tilemap.
Now you should be able to paint in your level! Try to keep it inside the camera bounds for now, and add a few platforms for us to jump on.
We have one last step to take care of. Right now our map is only visuals, our character won’t run into the walls we’ve made, in fact they will fall right through the floor. We have to add a physics property to let the game know that these squares actually matter, and they aren’t just there to look pretty.
Click on the tilemap in the editor, and then scroll down in the Inspector window (on the other side) and click the ‘Add Component’ button.
The component you need to add is called ‘Tilemap Collider 2D.’ Just use the search box to find it and add it to our tilemap.
Step 4: Make the player
Now that we have a map, we need someone to move around on that map. We’re going to make this part really easy. Unity has done most of the hard work for us; if you go to the standard assets folder>2D>Prefabs in the Assets Browser, you’ll see they have a little robot there called ‘CharacterRobotBoy.prefab.’
This is a prefab. Remember how our tilemap has a collision component attached to it? Well our character needs many components attached to it to function. So we don’t have to rebuild all of those components every time, we make prefabs to serve as game objects which we can use over and over.
Drag the robot boy into your scene, and then click on him in the hierarchy. Look at all the components attached to him in the Inspector. He has an animation system, a sprite renderer, and several different collision and control functions.
We’re going to use him for now, even though we might (we probably should) make our own character to replace him. His sprite and animation will serve as stand ins for us as we continue to develop around him.
Now that the robot boy is in your scene, you can play as him. Press the play button at the top of your screen and try it out.
Since our idea for a game mechanic is to have two characters meet, we should drag and drop a second robot boy into the scene, maybe on the other side. This way, every time you play the game, you’ll have to coordinate to make the two characters meet.
Step 5: Roadmap and build from here
There are a lot of steps we could take from here, but I personally prefer to roadmap. We have a prototype, all of the time-consuming setup work is done, and now we should have the time and energy to start planning.
One good way to plan an indie game is to make a roadmap. Think of all the features you want in the game, and then lay them out on a timeline, interspersed with time to make improvements and fix bugs. It could look something like this:
- Add coin system
- Add player health and damage
- Basic enemies
- Bug check
- Refine base art
- Create game over and win scenarios
- Add UI elements
- Add Menu system
This starts putting the game’s scope into perspective, and it helps us see how much work is left between this prototype and a finished game. Knowing this distance is important. We don’t always have unlimited time and attention to pour into a game, we might have a deadline perhaps for a game jam. Roadmapping also helps keep our expectations in check, and it gives us something to follow.
After making a roadmap, the next step is to follow it. Keep making improvements to your game. This tutorial has only taken you through the start of a game, the rest is up to you. Unity has an active community, and there are many teaching resources that go far beyond the scope of this simple game tutorial. Some of the best among them being coding or game design bootcamps. The road to becoming a game developer starts with your first game, no matter how simple, and it only grows from here.