Thanks to still having videogame demos on PC, I could try a game called Replicube, and I enjoyed it so much that I bought the full version as soon as it was released. I'm still going through the main content presently, but I wanted to do a shout-out because of how ingenious and fun is programming inside it. Using a subset of Lua (apparently full libraries from v5.3, just not all of them), you need to code the logic to draw (or skip) coloured voxels in a small 3D space, while trying to replicate a reference image. You can use boolean and bitwise operators, math functions, up to even defining your own variables and helper functions, and you can debug via print()
. As you can see, a quite complete way to learn or refresh your knowledge of the language. To me, it feels addictive trying to keep the code size below the 80th percentile.
In this kind of programming videogames, you almost always have metrics to take care of. Some allow you to go your own way, and just compare your results with a baseline or online scoreboards, others directly impose limits, and part of the challenge becomes how to solve "the puzzle" within the restrictions. For example, in Replicube, as long as your generated figure fully matches, the reported lines of code and CPU cycles metrics are just for comparison; Instead, in Rabbids Coding there is a limit of execution steps, so you can't simply brute-force your way even if you ignore the recommended "complexity" counter. In most cases, just seeing the numbers will trigger the desire to go and optimize the solution in the code golf spirit (short and fast, even if often harder to read).
I'll mention a few other videogames that I've played or still play, with some kind of relation with programming.
The hardest of the bunch. You need to program a simulated 1984 computer, which really it is way more restricted artificially in order to make you suffer. You must code it in a mix of assembler and C, with an extremely limited instructions and register set. At first, it can look similar to programming an 8086 or Z80, but wait until you need to deal with challenges like sorting lists of strings having just five specialized registers (e.g., can only have a single int
, a single bool
, and such). And yet, I love it. I should go back to it and get past that devilish sorting "level".
A great implementation of the "programming blocks" concept that I first learnt about via LEGO Mindstorms. You move numbered boxes from one side of the screen to the other, having some space in the center (with changing characteristics/restrictions), adding logic to define how you deal with inputs, outputs, and the middle "storage". As a side-note, I didn't fully finish it, as it got a bit tedious for my liking after a while, but it is probably just me.
I found this free educational game accidentally. Similar to Human Resource Machine, it is block-based programming, but clearly aimed at younger audiences. For me, there was zero programming difficulty, being really more about learning the level layout (the real puzzle on each level), checking the available block/instructions, and preparing the automaton logic (either a rabbit, or a vacuum robot). I could even "cheat the system" a few times and complete them with less complexity than the suggested value. At least the last levels offer some complex puzzles, and I love the Rabbids' dumb but fun craziness. It's 40 levels in total and free, so why not give it a try?
A special mention must go to Factorio, which is not really about programming, but more about circuitry design/electronics (building "supply and production lines"). It is a very famous game that I picked-up recently, and I also restarted my progress in "peaceful mode" because I'm more interested in laying out optimal throughputs rather than fighting alien bugs. I am cheating by including it in this list, but the praise seems well deserved.
And lastly, a long-time pending project that I have, is to AI-mod DEFCON, to properly replicate the mythic WarGames movie. The game itself has no programming, but the authors released a DEFCON AI API and bot-enabled game executable to build bots. Official links are dead, but seems to still be alive via community efforts.