Top 7 Programming Languages Used in Video Games

While people are likely to bunch video games together as a single industry, the video game industry is very diverse from a technological standpoint. Like athletic brands that separate their product lines to cater to different sports and activities, video game development is as varied as the number of platforms used to play them on. From consoles like Xbox and PlayStation, to PCs and mobile platforms, game developers have to consider their audience and what they use to play before writing the first lines of code.

Mobile platforms such as iOS and Android comprise the biggest market for video games. According to Statista, there were around 900+ million smartphones sold worldwide in 2014—a huge number that makes up a considerable chunk of the human population. The video game industry is aware of this, which is why everyone is making an effort to get a piece of the mobile gaming pie.

Are you thinking of developing your own games? Whether you want to write for consoles, PCs, or mobile platforms, you're going to have to learn about the programming languages you need to work with first. In this article, we will review the most common programming languages used for video game development. We will try to check each platform and collect the used technologies and most widely-used frameworks for video game development.

It is important to note that video game development isn’t just about coding. The preparation of used resources, like textures, sound, images, and game design often takes more time to get done than the actual programming phase.

Console Game Development

Microsoft's Xbox and Sony's PlayStation are the two big players of the console industry. For PlayStation, there's a mobile developer line called PlayStation Mobile, and this does have an SDK which is based on Mono, so the programming language used most of the time is C#. As for traditional PlayStation game development, C++ is one of the most widely used language. As you might already know, additional development tools are used for bigger games. There's a separate section at the end of the article for these. Go ahead and scroll down if you are interested in that part.

Desktop Game Development

There's a rich history of game development for desktop computers. I think many of us remember the good old Lotus car game:

 

The game was designed to run on x286 machines (image source vogons.org):

Back then, there were some games created using Pascal and Delphi. Delphi was the popular programming language at that time, but C was there too. Of course, most of these game development environments have since become obsolete, replaced by more modern dev languages.

Nowadays programming platforms like CUDA are getting more and more acceptance from game developers, mostly because of the demand for realistic graphics and textures, as well as high levels of animation and motion. To cope with these expectations, a lot of fast video calculation is needed. CUDA offers the possibility to parallelize execution of mathematical operations, and the programmer plays a big role in this.

Here is some CUDA code, just to illustrate what game developers have to deal with. The basic idea behind programming for the CUDA platform is that everything should be able to run in parallel and computations need to be optimized as much as possible. The code looks very much like C and C++ code, but it does have some specific elements.

#include <iostream>

__global__ void sum( int a, int b, long *c ) {
 *c = a + b;
}

int main( void ) {
 int c;
 long *sum_c;

 // allocate memory for sum_c
 HANDLE_ERROR( cudaMalloc( (void**)&sum_c, sizeof(long) ) );
 sum<<<1,1>>>( 134, 2237, dev_c );

 //copy result to the c variable
 HANDLE_ERROR( cudaMemcpy( &c,
   sum_c,
   sizeof(int),
   cudaMemcpyDeviceToHost ) );

 //display the sum
 printf( "2 + 7 = %d\n", c );

 // free the memory
 cudaFree( sum_c );
 return 0;
}

Although it's not as popular as C++ with DirectX and OpenGL, Python does support game development. For example, few people know that EVE Online and Disney’s Pirates of the Caribbean were developed using Python (there's more listed on this page). PyGame is a library that is developer-friendly and easy to use for building games. Python is an easy language to start with, so building games in Python is not a hard thing to do either.

If we take the Web as a platform, which is used mostly on desktop, then a couple years ago and even now, Flash was the leading platform for creating games. However, WebGL and JavaScript are getting used more and more, mostly because Flash was considered unsecure and slow. With the evolution of browsers, the JavaScript engines got fast enough to handle the amount of calculations needed for games. There is a webpage called html5gameengine.com which compares all the available JS-based game engines. This can be a good place to start when you want to hack something or build a cross-platform game for desktop and mobile devices. Engines like Phaser, EaselJS, CraftyJS, BabylonJS, PixiJS are all good alternatives to start Web game development with.

Here is a sample from CraftyJS (source GitHub), which implements a ping-pong game with some basic navigation.

var Crafty = require('craftyjs');

Crafty.init(600, 300);
Crafty.background('rgb(127,127,127)');

//Paddles
Crafty.e("Paddle, 2D, DOM, Color, Multiway")
    .color('rgb(255,0,0)')
    .attr({ x: 20, y: 100, w: 10, h: 100 })
    .multiway(4, { W: -90, S: 90 });

Crafty.e("Paddle, 2D, DOM, Color, Multiway")
    .color('rgb(0,255,0)')
    .attr({ x: 580, y: 100, w: 10, h: 100 })
    .multiway(4, { UP_ARROW: -90, DOWN_ARROW: 90 });

//Ball
Crafty.e("2D, DOM, Color, Collision")
    .color('rgb(0,0,255)')
    .attr({ x: 300, y: 150, w: 10, h: 10,
            dX: Crafty.math.randomInt(2, 5),
            dY: Crafty.math.randomInt(2, 5) })
    .bind('EnterFrame', function () {
        //hit floor or roof
        if (this.y <= 0 || this.y >= 290)
            this.dY *= -1;

        if (this.x > 600) {
            this.x = 300;
            Crafty("LeftPoints").each(function () {
                this.text(++this.points + " Points") });
        }

        if (this.x < 10) {
            this.x = 300;
            Crafty("RightPoints").each(function () {
                this.text(++this.points + " Points") });
        }

        this.x += this.dX;
        this.y += this.dY;
    })
    .onHit('Paddle', function () {
    this.dX *= -1;
})

WebGL (Web Graphics Library) is a technology used by most of the mentioned JS frameworks. This is an API based on OpenGLES, which supports 3D rendering within the browser with the help of the HTML canvas element. You can read more details about WebGL Fundamentals in this article.

Mobile Game Development

The mobile market has three big players from a platform point of view: Android (Java), iOS (Objective-C), and Windows Phone (with C#). As Android is based on Java, there are game engines written for the Android Platform, like the multi-platform Cocos2d for Android, although Unity supports the Android platform as well. Note: there are some extra details about Unity available at the end of the article.

iOS offers more alternatives for developers, including Cocos2d, SpriteKit, Sparrow, and many others.

Additional Development Tools

Blender is one of the most widely-used tool for creating textures, sprites, animations and rendering. This is an open source project, but it does work very well and has a wide variety of functionalities.

The Unreal Engine really stunned the game development industry when it first appeared in 1998. The game engine has been developed using mostly C++, and the current major version is Unreal Engine 4. Epic Games has developed a new programming language that can be used with the engine, called UnrealScript or UScript. Below you can see a sample source code of UnrealScript:

state() UpdatePlayer
{
   function DrawFace( String playerName, float updateInterval )
   {
      if (plyerName != ‘’)
      {
         waitFor(updateInterval);
         InternalDraw(playerName, BODY.Face);
      }
   }

   function DrawHand( String playerName, float updateInterval )
   {
      if (plyerName != ‘’)
      {
         waitFor(updateInterval);
         InternalDraw(playerName, BODY.Hand);
      }
   }
}

Microsoft adopted Unity for Xbox development, but the game engine is available across different platforms. The engine was written in C++ and C#, and currently supports a wide range of platforms, from PS3 and PS4 to Xbox, PS Vita, AppleTV, Android, and even Windows Phone. It offers a full ecosystem for creating the games. Below you can see a source code taken from Unity tutorial:

using UnityEngine;
using System.Collections;

public class TransformFunctions : MonoBehaviour
{

    public float moveSpeed = 10f;
    public float turnSpeed = 50f;

    void Update ()
    {
        if(Input.GetKey(KeyCode.UpArrow))
            transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

        if(Input.GetKey(KeyCode.DownArrow))
            transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);

        if(Input.GetKey(KeyCode.LeftArrow))
            transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);

        if(Input.GetKey(KeyCode.RightArrow))
            transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);
    }
}

As you can see, the code is very easy to read. It's like reading traditional text. The Unity engine has wrappers and constants. For example, the Input.GetKey() method checks if the key pressed by the user matches the one given as a parameter. Also, please note that the KeyCode.UpArrow is a constant.

As you can see, developers have a wide range of tools and programming languages that they can use to start developing their games. But before choosing any engine or programming language, you must think about the target platforms and the target audience—could you imagine a teenager now sitting in front of a PC playing with mouse and keyboard? That may be the standard a decade ago, but it's not that popular anymore. Teenagers and gamers today are now more into “touch” interfaces—smartphones, tablets, and notebooks with touchscreens. They grew up with having touchscreen everywhere, so when you start to develop your game, please keep these details in mind before selecting any technology.

Hire A Freelancer In Seconds

Looking to get some work done? Hire the world's best Designers, Developers, and Copywriters in just a few clicks.

Greg Bogdan
Greg Bogdan Hire Me

Software Engineer, Blogger, Tech Enthusiast

I am a Software Engineer with over 7 years of experience in different domains(ERP, Financial Products and Alerting Systems). My main expertise is .NET, Java, Python and JavaScript. I like technical writing and have good experience in creating tutorials and how to technical articles. I am passionate about technology and I love what I do and I always intend to 100% fulfill the project which I am ...

Hire Me

Next Article

2015 Web Trends to Leave Behind in 2016