5 Best Games For Coders Or Learning Code

Educational games have been a thing for about as long as games have existed. However, games have evolved recently so that rather than an interactive textbook or quiz, entire games have been built around the concept, which makes the learning experience much more fun and seamless, sometimes making you want to come back and learn in a way that learning directly might not. Games for coders or games designed around learning code have become popular recently and there are many great ones out there.

Coding and gaming are intrinsically linked. Obviously, games are made from code, and many games developers decide on that career because of their love for games. That means there’s a really useful overlap where games can be made to help those who most love games to learn coding principles and perhaps start their own journey to creating games. So let’s take a look at some games for coders that do just that.

while True: learn()

while True: learn() is perhaps the first game that comes to mind when you think of games for coders. Even the title is a nod to common coding syntax. It’s a fully fleshed-out game with a story and progression system, as you would come to expect from a game, but the main gameplay loop works in the same way as some visual coding systems that you find in-game development and beyond.

A visual coding game

Visual scripting is a system where you link a series of ‘nodes’, each other which contain their own code, into a graph in order to write your script. While no actual programmer uses this primarily instead of writing the code themselves, it is incredibly useful for learning the principles of how coding works in an intuitive way, without the need to remember syntax, function names, or structure. It’s not entirely irrelevant though, as it works in a similar way to Unreal Engine’s blueprints system, as well as other programs like Substance Designer.

Human Resource Machine and 7 Billion Humans

Human Resource Machine, and its sequel 7 Billion Humans, are games about organizing a workforce to complete simple tasks. To do this you need to give them exact instructions in a perfect order which starts out simple at first but soon comes complicated as it introduces goals that require looping instructions and has you jumping back and forth through different chunks of instructions, much like actual code works. As with real code, it’s less about giving direct instructions and more about writing code that can work in a number of situations as some aspects are randomized, this way that game code might need to account for all sorts of eventualities.

A game for learning coding principles

Whilst a simplified version of code, one of the important things that these games teach is efficiency in code. You will have a limit on how many lines of code you can write, with higher scores requiring more optimized code. In real code, this makes the code run efficiently and without issue and is a very important part of programming games. It even allows you to annotate your code with notes to help you remember and understand it, a good practice for coders to do in case they ever have to review old code or pass the code to someone else to work on.

Code Combat

Code Combat is a fantasy RPG-style game where you give a set of instructions to your hero to tell them how to navigate dungeons and fight monsters. Code Combat is aimed towards children and young adults as a way to get them into coding from a young age and show them the power of programming and the fact that it is something anybody can do. That being said, it’s not just a kids game, anyone who’s starting out with coding can find this game useful.

A game where you learn to write basic code.

The code that players use is very similar to many programming languages, using conventions such as ‘loops’ and ‘if statements’ that are present in practically every programming language without being specific to one language or getting too bogged down in syntax.


Robocode is a bit different than the games for coders listed previously for a few reasons. Although you control the game using coding principles like the others listed here, you write in an actual coding language, one of a number you can choose from, meaning the work you put into this game can be directly put to use in other projects. This makes it more difficult to pick up, but more useful in the end.

A game for coders where you compete in robot battles

The 2nd thing that sets this game apart is that it’s a multiplayer game. Players pre-program a robot before a battle with the best code they can and then all the robots are released into an arena to battle using the instructions you gave them, similar to BattleBots or Robot Wars except if they were controlled by AI rather than people.


Screeps is a very unique game, being a code-based MMO RTS. You build a colony with all of the usual aspects, resource gathering, building, crafting, trading, and the like. You also send out units, or ‘creeps’, to attack other people on the server and have to defend your land from the same. All of this continues even while you are not logged on, which is usually a bad thing in MMOs if you can’t spend much time on it, but here it incentivizes you to work hard on your code optimization. All of this is done directly through the use of JavaScript.

A game for coders where you build a colony and invade others.

This is very much a game for coders rather than a beginners game as it doesn’t really hold your hand as you are expected to understand the basics. That being said it can be a great way to level up your existing coding knowledge in an entertaining way. The downside to Screeps is that you only get access to the main server for 30 days before access is limited without paying a monthly subscription.