The ESP8266 is probably best known for its WiFi capabilities, but even for projects that don’t need this, it’s still cheap, and packs a bit of processing punch. Enough for some basic gaming, for example. GitHub user corax89 has catered exactly to that use with the ESP little game engine. It’s a web-based C++ IDE for building simple games to run on ESP8266 boards with SPI TFT screens.
Perhaps the most impressive part of this project is that it includes an emulator, so you can see how your code will run, and even play your games, without uploading onto the hardware. Once your game is complete, you can download a BIN file, and upload it to your ESP8266 for playing on the go.
There isn’t a lot of documentation to help you get started, but there are nine examples, which range from a basic ‘Hello World’, to a version of Flappy Bird, which should take you through most of what you need to know about developing games using this engine.
The IDE itself is quite stripped down. There’s a box for entering the code, and once you’ve made any changes you need, hit Compile. This populates the ‘memory’ area of the screen with the HEX values of the memory. Hit Run, and your game will start playing, and you can use the keyboard to interact with it. The most useful part – from a programmer’s perspective – of this virtual machine is that it’s far easier to see what’s going on than when running on real hardware. You’ll see that the ‘currently executing’ line is highlighted in the source box, and if you open the debug window, you can see the global variables change in real time. You can also see the bounding boxes of any collisions when they take place. Both are features that will make it much easier to get your code to behave properly.
The Sprite editor makes it easy to draw your own game graphics. The ESP8266 isn’t powerful enough for anything too fancy, but as any child of the 1980s knows, you don’t need good graphics to have a good game.
Perhaps the most obvious missing feature is the ability to save code – the Save button downloads the compiled object code. This isn’t as big a problem as it sounds, as the games are usually short (Flappy Bird, for example, fits into just 85 lines), and can be copied and pasted into another text editor for saving.
A few graphical niceties, such as syntax highlighting, would be a nice edition, but even without these, it’s a fantastic microcontroller games development environment. What’s more, you don’t even have to wait for the hardware to arrive before you start tinkering.
Corax89 Free hsmag.cc/cRGmjj
A great games engine to build software to run on cheap, homemade games consoles