Programming a video game: 10 steps (with pictures)

Table of contents:

Programming a video game: 10 steps (with pictures)
Programming a video game: 10 steps (with pictures)

Phones, browsers, computers, consoles: video games are more popular and more widespread than ever before. You can find more tutorials, asset collections, game-making software tools and expert advice than ever before. Programming your own game still requires skill and patience, but there are plenty of resources for a programmer of any level.


Part 1 of 2: Getting started

Program a Video Game Step 1

Step 1. Consider using a game engine

Few game developers reinvent the wheel and write their own game engine from scratch, especially not when it comes to a first game. If you want to dive right in and still have plenty of programming capability, it's a good idea to use a game engine. A typical engine includes advanced tools for modifying 3D models, scripting events, and other common game applications, but will still provide plenty of programming capabilities.

  • Popular examples where you can program a lot are Unity, UDK, Unreal Engine 4 and CryENGINE.
  • If you have little programming experience, you can think of GameMaker from YoYo Games. This software offers drag-and-drop, code-free game development, but gives you access to a powerful programming language if you need it.
Program a Video Game Step 2

Step 2. Make use of frameworks and other tools

A framework is one step lower than a game engine, but still provides a set of tools and APIs (application program interfaces) to save you time and streamline your projects. Consider the minimum amount of software you'll need for your first game project, and even then you'll need to present yourself as a programmer without hesitation or have a deep interest in the underlying workings of game engines. Depending on the exact framework and/or game engine you are using, it may be wise to work with additional, specialized APIs, such as the popular OpenGL for creating 3D graphics.

Polycode, Turbulenz and MonoGame are examples of frameworks designed for both 2D and 3D games

Program a Video Game Step 3

Step 3. Try an IDE

An Integrated Development Environment is a general purpose compiler and collection of resource files that make it easier to build complex programming projects. An IDE will make programming a lot more convenient, especially if it includes tools for handling graphics and audio systems.

Visual Studio and Eclipse are two examples, but there are many other possibilities. Look for an IDE based on a language you are familiar with

Program a Video Game Step 4

Step 4. Learn a programming language

Most of the tools above are based on a popular programming language, so following the included tutorials will get you started. While you can create a game in almost any powerful programming language, the most common languages ​​are C++ or C# for all devices, Flash ActionScript or HTML5 for browsers, and Java or Objective C for mobile devices. These are good options if you eventually want to qualify for a position at an existing game studio, but there are plenty of independent games made in Python, Ruby, or JavaScript.

Part 2 of 2: Making the game

Program a Video Game Step 5

Step 1. Make a plan for the game

Try to work out the concept of the game as best you can before you start, including the genre, atmosphere and type of gameplay. If you start programming before the concept is clear, you will probably eventually be able to tear up a lot of your work and throw it away, and start over again. This will always happen, but a solid plan can keep it to a minimum.

All but the most experimental games have a certain progression, so now is a good time to start planning. Game progression is usually determined by one or more of the following events: discovering more about the plot and characters, making decisions that affect the course of the story, gaining new skills or higher scores, exploring new areas or solving increasingly difficult puzzles

Program a Video Game Step 6

Step 2. Collect the art assets

Collect or create the textures, sprites, sounds and models you need for the game. There are quite a few collections of free game assets, so do some research. If you're making a 2D game and don't have an artist to help you, you can also do the pixel art yourself.

Program a Video Game Step 7

Step 3. Script your game

The script tells the engine what to do and when. If you're using an open source engine, chances are it already has a scripting language built in, along with tutorials that teach you how to use it. If you have built your own engine, you will also have to program a scripting language yourself. Either way, you'll need to use at least the following key components:

  • A game loop that constantly checks for input from users, processes the result, processes other events, calculates what to display and then sends it to the graphics card. All this at least 30 times per second.
  • "Active listener" scripts that check for events/events and respond when they occur. For example, a script might wait for a player to click on a door, then run the "open" animation and make the doorway non-collidable (a passageway). Another script can watch for a hitbox from a weapon (eg a bullet) to make contact with the door and then show the "explode" animation.
Program a Video Game Step 8

Step 4. Create individual levels

Level design - which can literally mean a "level", an area the player can explore, or the next round of a fighting game - will test a number of skills that have nothing to do with programming. Start with a simple level that showcases typical gameplay, using the following simple guidelines for genres that require you to travel through an environment:

  • Set up the area.
  • Decide which route the player will generally take through the area. Add challenges and rewards (items) along the path. Place them close together for more adrenaline and excitement or further away for a more relaxed atmosphere.
  • Start adding graphic elements. Place light sources along the main path to encourage the player to follow it and make the side paths or less important areas more dim.
  • Match the gameplay, style and setting. A thrilling horror game revolves around long stretches of desolate exploration followed by surprise attacks. A never-ending stream of enemies overwhelms the player, while combat situations where tightly planned tactics are required can distract the player from the atmosphere.
Program a Video Game Step 9

Step 5. Test your game

Now you get to see what all the hard work has been for. Test each level as you polish it further and many times after it's "finished". Make a conscious effort to play the game in ways you have planned, such as playing the difficult areas first. Even better, let other people test the game and ask them to provide as much feedback as possible.

  • Observe someone playing your game with no advice, other than some information to get you started if it isn't already in the game. Frustrating mistakes and points where the player "hangs" are signs that you need to give more clues.
  • When the game (or at least 1 level) is reasonably complete, try to find friends and strangers to help with the testing. Friends tend to be more optimistic, which is great for encouragement but not so useful for predicting how players will react.
Program a Video Game Step 10

Step 6. Take the next step

Once the project is complete, it may be helpful to offer it for free or for sale, but be sure to read the terms and conditions of the game engines or software you've been using. Whether or not you finish a game as you envisioned, you may want to "re-use" certain assets and ideas for other or more ambitious projects, or start all over again with the lessons learned!


  • Always write down what you need "now" rather than what you need "maybe later" or "later".
  • Don't reinvent the wheel. If there isn't a library suitable for what you want to achieve, go for it or have a very good reason to build one yourself.

Popular by topic