Sponsored By

What is game programming and how do you become a game programmer?

Stepping into the world of game programming can be daunting. This article explains the basics of game programming, as well as what tools and resources you can use to get started.

Game Developer, Staff

May 2, 2024

9 Min Read
Two people coding on their laptops in a booth
via Pexels/Darlene Alderson

Game Programming 101

Stepping into the world of programming for game development can be daunting. There are many game development engines, programming languages, and other tools used by developers across the industry.

But things can often be much simpler than they first appear and, like with anything, the key to becoming a video game programmer and developer is to break things down and take them one step at a time.

Game Programming Defined

Game programming can be defined as the art and science of writing software code for video games. Game coding can be quite complex, and there are many aspects to consider when bringing a video game to life. Game programming marries the concepts of coding, art, sound, gameplay mechanics, and user interfaces, bringing them to one cohesive whole and presentation for the player. As a game developer, you would likely end up working closely with team members in these respective fields, artists, designers, and sound engineers, in developing a video game—or, if working solo on a project you might attempt to work on all these aspects yourself.

Essential Concepts for Programming Games

To get started in game development, you need to learn some essential concepts—some unique to game programming. For beginner programmers—these concepts are high level and explained here with a certain amount of abstraction. You will undoubtedly become more familiar with these terms and the fundamental theory behind them as you learn more about game development.

The Game Loop

The game loop sits at the heart of every game. It is a continuous cycle in which game logic is updated and drawn on screen, and designed to account for delta time—the duration of time between the current frame and previous game. This design is crucial in accounting for different hardware setups, ensuring that the game runs at the same speed regardless of frame rate.

What_Is_Game_Programming_Infographic_(2).png

Game States

Game states are one of the essential building blocks of a game. It allows the organization of different game phases (e.g., the main menu, gameplay, the pause screen, etc.). Game state management controls what should be happening in these different phases, including what visual elements should be on screen, and how the game should respond to player input.

Input Handling

Another crucial component of game development, input handling is how games become interactive. Input handling allows the game to recognize player input through keyboards, mice, controllers, touchscreens, and more. The input handler then translates those inputs into game actions, such as selecting an option in a menu or moving a character.

Collision Detection

In essence, collision detection is the process of detecting when game objects intersect or come into contact. Collision detection is used for essential gameplay, such as movement and interaction with the game environment. An example of collision detection would be when a player character or non-player character collides with a wall and their movement is stopped, or when two characters clash swords in a duel.

Vectors

Vectors are an incredibly important aspect of game design and programming. They are the fundamental building blocks of representing positions, directions, and velocities in a game world. This makes them vital for everything from basic movement to complex physics simulations.

Physics

Basic physics concepts—gravity, acceleration, friction, etc—make games more realistic, and are a common inclusion in many modern games. Many game engines come with physics libraries, allowing developers to simulate realistic movements and interactions.

AI

Video game artificial intelligence (AI) has been, and often still is, far less sophisticated than the Generative AIs that have more recently dominated the term “AI.” However, game AI is an integral component of interactivity and fun in game design. Even the simplest games (e.g., one of the first games ever created, Pong) use some form of basic AI. AI can make non-player characters behave in realistic or challenging manners, ranging from simple movements (e.g., the AI-controlled Player 2 paddle in Pong), to complex-decision making processes, such as those seen in a strategy game (e.g., Stellaris, Total War, Civilization, etc.).

Tools and Game Engines

Game engines are platforms or frameworks that simplify game development. They can offer tools and functionalities that allow developers to create more complex games with ease. There are many game engines out there, but here I’ll provide an overview of some of the more commonly used engines.

Unity

Unity is a cross-platform game engine, used by both indie developers and triple-A studios. It supports desktop, mobile, console, and virtual reality platforms. It is a mainstay of iOS and Android development and can be used to create both 2D and 3D games.

Unity primarily uses C# as it’s scripting language, but it also supports C/C++, Rust, IronPython, Lua, and Java.

Unity has over 750 hours of tutorials available for free on its website. On GameDeveloper.com you can find a full introduction to Unity, from installation to familiarizing yourself with the interface and options.

Unreal Engine

The Unreal Engine is a cross-platform game engine and is commonly used by developers at larger companies. Unreal supports desktop, mobile, console, and virtual reality platforms, and is source-available with a royalty model for commercial use. It is mostly used for 3D game development.

Unreal uses C++ for scripting. Its most recent iteration, Unreal Engine 5, supports "Blueprints," a visual scripting system that allows developers to create gameplay scripts without writing code.

Unreal offers various learning resources and tutorials, which can be found here.

Godot

Godot is a free, open-source game engine that has been around since 2014 and recently gained popularity amongst indie and beginner developers. Godot targets PC, mobile, and web applications, and can be used to create both 2D and 3D games.

Scripting in Godot can be done with C# and C++, but it is recommended that you use Godot’s own language, GDScript, which is an object-oriented, imperative, and gradually typed language with similar syntax to Python.

Godot has resources and tutorials available here, and as an open-source engine, there is a wealth of knowledge available online from community creators.

Game Programming Languages

As already mentioned, there are several programming languages that are commonly used for developing games, and, with enough expertise, pretty much any programming language can be used to create games. However, most game development is done in engines that favor specific languages, and for that reason if you’re looking to get into video game programming, you should probably start with C# and/or C++. Both languages are based on C, which is a general purpose, low-level programming language, first appearing in 1972. C# and C++ are expansions of C and differ in that they are higher-level languages with capacity for object-oriented programming. Object-oriented programming is a common thread in game development and is a concept that is worth learning if you are looking to expand your knowledge in this area.

C++

C++ is a high-level, general-purpose programming language. It was designed with systems programming in mind, with performance, efficiency, and flexibility as some of its highlights. C++ allows control over hardware and graphic processes and is ideal for games that rely on high-performance and detailed graphics.

C#

C# is also a high-level, general-purpose programming language. It was developed by Microsoft and released alongside the .NET framework and Visual Studio. C# is generally considered easier to learn and use than C++ and is widely used with Unity for game development. Alongside Microsoft’s own C# tutorials, there is a plethora of resources available for learning C# in game development.

Learning Resources and Communities

If you’re interested in game development, and looking to get into game programming, there are plenty of resources available online to aid in your quest. If you are new to programming entirely, it is likely you will want to start with the absolute fundamentals of modern programming—basic syntax, variables and data types, functions, error handling, memory management, data structures and algorithms, and object-oriented programming.

Resources For Beginner Programmers

Harvard’s CS50 Courses

Harvard university offers a range of courses aimed at beginner and intermediate level programmers.

CS50x is a full introduction to computer science and programming. It is free and can be useful to those with or without prior experience. CS50x teaches how to solve problems, with an emphasis on good design and style. CS50x covers topics such as computational thinking, abstraction, algorithms, data structures, and computer science more generally.

CS50G, which is also free, picks up where CS50x leaves off and focuses on how to develop 2D and 3D games. This course teaches languages such as Lua and C# and is a good starting point for understanding the concepts of game development.

OSSU

The Open-Source Society University (OSSU) offers a path to free, self-taught education in Computer Science. OSSU is a complete curriculum of education in computer science using various online materials. It starts from a complete novice level, though offers many opportunities to jump in at a higher level, and aims to provide students with a "well-rounded grounding in concepts fundamental to all computing disciplines."

Roadmap.sh

Roadmap.sh is a community collection of roadmaps to help developers achieve their goals in programming. In the Game Developer track, you can find a clear idea of all the concepts, tools, and languages that are relevant to game programming, as well as further information and resources to continue your journey.

Resources For More Experienced Programmers

If you already have a grounding in programming or computer science, there are plenty of resources to help you translate this knowledge into game programming. Keeping in mind the tutorials and resources that the aforementioned game engines offer, there are various platforms, courses, and tutorials that expand on this knowledge further.

Udemy

Udemy is an online teaching platform with hundreds of thousands of courses. In its game design section, it offers several courses that cover all aspects of game design, including programming and game development fundamentals.

Coursera

Coursera is similar to Udemy and offers many courses on game design, programming, and game engines.

Other resources

Alongside formal courses, there are plenty of other resources. Websites such as Stack Overflow exist to offer programmers a space in which they can query aspects of their code, ask questions about concepts, and more. The Unity and Unreal Engine forums are great places to ask questions about those engines, as well as the programming languages that they use. As with all programming, game development is inherently collaborative, and you will find people more than willing to help you online if you look for them!

Conclusion

Game development can be challenging, but it is also rewarding. Game programming is unique in that you are combining creativity with technical skills and knowledge. This guide offers a taste of the types of things you will need to learn to code video games. Understanding the basics in this guide, using the resources on offer, practicing regularly, and engaging with the game development community are all key aspects on the path to creating games.

Read more about:

Programmer
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like