Stage — a tile and sprite engine for making games

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
User avatar
Posts: 1353
Joined: Thu May 28, 2015 5:54 pm

Stage — a tile and sprite engine for making games

Post by deshipu » Sun Aug 04, 2019 10:21 am

Hello everyone, it's me again.

It's been a while since I last posted here, but I came back just for a moment to tell you about my library. Ever since I started my work on the µGame console, I had my game library working both in MicroPython and CircuitPython, but since CircuitPython was better for beginners, I went with that — the library is merged in the CircuitPython repository and ships by default on Adafruit's PyGamer and PyBadge boards (there is a learn guide, if you are interested, at ... cing-balls). But if you wanted to use it with MicroPython, you would have to go to my fork of it, find the right branch, rebase it against master and compile by yourself. That is a lot of work, and no wonder that only a few people have ever attempted it, and even fewer succeeded.

However, recently MicroPython has introduced a crude way of "packaging" third party extensions ( ... dules.html), so I took some time to change my library and make it compatible with that. You can find it at together with the support files for an ESP8266 board with a buttons shield and ST7735 display, and an M5Stack board with a game "face" add-on. Those files can be used as a starting point for adding support for your own boards.

A few words about what the library does. It's split in three parts: a small module called "_stage" written C that does the time-sensitive task of rendering and sending the pixels to the screen, a "stage" python module that has all the classes and functions for creating and controlling sprites and tile maps, and a "ugame" python module that handles initialization of the display, buttons, sound etc. Normally, the "ugame" module is specific to the board you are using (it's called "ugame", because it was originally written for my home-brew game console µGame), and the other two parts stay the same. The library itself provides you with "banks", which are sets of 16 images 16x16 each, with a 16-color palette and 1-bit transparency, which you can then use on "grids" of tiles or as free-moving "sprites". In typical use, you would have one or more layers of grids representing the world of your game, and several sprites representing the player character, enemies, NPCs, missiles, explosions, etc. The grids can also represent elements of the user interface, and there is a special kind of grid that displays text. It's designed that way so that all the pixels can be computed on the fly while rendering, without having to keep them all in memory (which is very limited on microcontrollers), and to be able to only update the parts of the screen that actually changed.

Below you can see one of my games, Vacuum Invaders, played on an M5Stack:

More information about the library: ... ite-engine

User avatar
Posts: 266
Joined: Mon Jan 23, 2017 6:39 am

Re: Stage — a tile and sprite engine for making games

Post by mattyt » Tue Aug 06, 2019 1:30 am

I'll have more to say about this later - when I'm not at my 'day job' ;) - but I just saw this and had to say that this is awesome!! Nice work @deshipu!

I can't wait to get this running on one of my M5Stacks...

Posts: 701
Joined: Mon Nov 20, 2017 10:18 am

Re: Stage — a tile and sprite engine for making games

Post by OutoftheBOTS_ » Tue Aug 06, 2019 3:49 am

Very cool project :)

I would love to sit down and design my own little PCB and solder it up then load MP and this library and make some cool little games, it would be an awesome project to do with my kids.

Unfortunately I can never find the time to play with these projects and I can only add it to the many dream projects that I hope to do some day :(

User avatar
Posts: 3868
Joined: Fri Jul 18, 2014 8:01 am
Location: UK

Re: Stage — a tile and sprite engine for making games

Post by pythoncoder » Tue Aug 06, 2019 7:13 am

@deshipu That is seriously impressive!
Peter Hinch

Post Reply