Video games are uniquely positioned to teach you the fundamentals of programming. Sometimes, this is explicit, as in the case of the Zachtronics series of puzzle games that focus on invented coding structures. But in other cases, games implicitly teach you the basic logic of programming through other systems — like in Final Fantasy XII’s unique Gambit system. That’s because the basics of programming aren’t about learning terms and jargon, but understanding logic and code structure. And strange as it is to think about, Final Fantasy XII’s battle system incorporates a lot of the same logic you see in programming.
In Final Fantasy XII, your party members are indirectly controlled through simple if/then statements, an important fundamental concept in programming. Put simply, if/then statements are strings of code that instruct the computer to do certain things under certain conditions — if something is true, then do this thing. The Gambit system which enables this customization consists of three different parts: the target of a given action, the action itself, and the order of precedence of each action. The target aspect also wraps within itself the conditions under which the action will take place. You might have a target that activates when an ally is at less than 30% of their hit points, at which point the character uses a Potion on them.
Each of these behaviors is represented by a bar on the Gambit screen which you can move up or down on the stack. In battle, the AI run through these behaviors from top to bottom, acting on lower-priority behaviors only if the conditions for more important ones aren’t met. It’s in this way that Final Fantasy XII reveals the nature of nested conditional statements in an easy-to-understand, intuitive way thanks to the clean visual that the Gambit screen provides, providing the blueprint upon which you can understand the flow of programming languages, especially beginner ones like C++ and Visual Basic.
Final Fantasy XII isn’t specifically about programming, but it demonstrates the power of applying the fundamentals of programming to what you do in the game. When players are in the thick of a game, they’re subconsciously making the same kinds of decision stacks that the Gambit system makes tangible, prioritizing specific situations while almost automating certain rote actions. And whether or not the player is going to become a programmer in the near future, these systems still teach a basic logic of programming flow.
When it comes to actually putting code to screen, though, Zachtronics games are the absolute gold standard in simulating computer programming. You’re given a thin premise, a virtual computer, and set off into programming using a fake language. It might seem counterproductive to learn a game-exclusive fake language rather than an existing one, but the principle behind the code in a Zachtronics game and real life code is the same. You learn about variables, functions, and loops, the basic building blocks of computer programs. The jargon may be different, and indeed varies based on the game, but the fundamentals at play are consistent with the basics of programming.
Where Zachtronics games truly shine, though, are in their visualizations of how the programming executes. Usually when you’re learning a programming language, you’re plugging text in to get text back. In Zachtronics games, though, you receive visual feedback of what’s happening.
For instance, in last year’s EXAPUNKS, you’re still moving around data and values, but the result is represented by robots moving from server to server. The idea is that you’re hacking different computer systems, and the robots are manipulating things in the servers to achieve some specific goal that the game gives you. It’s not that different from how real programming languages work, but by adding the robots to the mix, you get a tangible visualization of the flow of what happens as the program you just wrote does its thing.
More Like This:
- Meet the Players Who Render Games Unplayable
- Why Some People Only Play Non-Violent Games
- The Ultimate Fantasy of DOOM is Telling Your Boss to Fuck Off
The game also uses this conceit as an excuse to provide a very clean graphical representation of the robots executing their programming so you can see the results of your labors immediately and understandably. And like most Zachtronics games, you can execute the code one step at a time to see where you might have gone wrong, which isn’t immediately apparent in real coding. Here you can see exactly what your code is doing at any given step thanks to the visuals, a real boon for learning about how to debug code.
TIS-100 takes an even simpler approach: you’ve found an old microcomputer with a DOS-like interface and must repair different modules by filling in the gaps of code. Most everything is text here, with only the interface as your visual. But TIS-100 does a lot with a little, turning your actual writing prompts into nodes that data travels through within a four-by-three grid. The data you’re processing appears between these nodes, allowing you to see them travel through, transform, and flow towards the output zones, which is the data’s ultimate destination. Not only does this teach you about the flow of information and input/output theory, but the disconnected nature of the text prompts allows you to more fully isolate problems and bugs in your code. When a value travels the wrong way or turns into something unexpected see where it went wrong and fix it.
Knowledge is Power
Applying graphics to program execution is key because it demystifies the process of programming. You can see everything that your program is doing rather than just watching a program spit out a result. That’s what makes the concept of games about programming work. Graphics breathe life into so many fantastical worlds and make real our imaginations, so naturally a game about programming should give you a visual representation of your work.
Games are built on programming, so it only makes sense that programming can make for an engaging theme within a game given the right treatment. By embracing the visual aspect of games as a medium, games can leverage the spirit of programming into a set of deep, intuitive game mechanics. In turn, these mechanics can help players learn how to code, And even for those who aren’t interested in that, games that incorporate basic programming can deepen our understanding of game structure and provide us with a valuable high-level literacy of the computer systems we interact with everyday.