I think one of the funnest games of all time must be Screeps. This is a game that puts programming at the center. The native language to play the game is JavaScript but you can use, as of now, any other language that is supported by Web Assembly (WASM) which includes Rust and C++.
The idea is you control these little guys. I’m not sure if they should be called creeps or screeps but in the code you refer to them as creeps. So, these guys have body parts that are a combination of move, work, carry, and different attacks. They do useful things.
For example, you have rooms which are squared tiles areas interconnected to other rooms. In most rooms there is a controller which is a structure that your creeps, as one of their useful things they do, must not only maintain for ownership of the room but upgrade to increase your capabilities within the room.
You have to also keep a constant supply of creeps going to do useful things and most everything runs on energy. There are other resource types in the game, but energy is the most abundant and core to the game.
So, your program you write has to control all these creeps and it has to have them doing these useful functions like upgrading the controller, feeding the spawn and extensions and towers for defense with energy, and working the various structures that go along with all of this.
It is quite the effort. You have to write a program that handles all kinds of conditions and situations. At times, your creeps can sort of get stuck or find themselves in loops or in situations where your code fails.
You also have to manage execution time. Your program can’t run forever. It has to do it’s useful work in a certain amount of time. A lot of the API calls such as the query things about the work and perform actions has a cost associated with it too. The cost is artificial, but it costs a certain amount of CPU each turn.
The whole time you’re trying to solve logical problems in a world full of possibilities you are also having to solve execution/run-time issues. There are issues with pathing, pathing computation time, and then if that isn’t enough to keep you challenged you have other players who can attack you and compete for resources.
I’ve found the game quite enjoyable over the years. If it sounds interesting you should check it out at Screeps – MMO strategy sandbox game for programmers.