pew pew pew pew pew

PewPew

It's time for some MicroPython games. For most of the last year I have been working on a simple python-based game console (https://hackaday.io/project/21578-pewpew-featherwing) and I decided to make a new game for it as a part of this pyweek. Don't worry, you don't need to build your own, I will also write an emulator, so you can play the game on your computer too. I will be using CircuitPython, a flavor of MicroPython developed by Adafruit, and by necessity the game will need to be quite minimal.

Awards

Give this entry an award

Scores

Ratings (show detail)

Overall: 2
Fun: 1.4
Production: 2.1
Innovation: 2.5

8% respondents marked the game as not working.
Respondents: 11

Files

File Uploader Date
shoot.zipfinal
What I have so far.
sheep 2017/10/22 10:30
IMG_20171019_130708.jpg
Running on the real hardware
sheep 2017/10/19 11:10
FL1fVc.gif
pew pew pew pew pew
sheep 2017/10/17 15:47
ff.png
Pewmulator
sheep 2017/10/15 17:18

Diary Entries

Pewmulator

Since CircuitPython is mostly compatible with Python 3, the only thing I really need to run PewPew games on a desktop computer is the pew.py library for handling the display and key presses. Turns out that PyGame is pretty much perfect for this — the code is even shorter than for original PewPew.

I have the emulator working now, available at https://github.com/pewpew-game/pewmulator and I have tested it with the two demo games for PewPew: tetris and snake: https://github.com/deshipu/pewpew/tree/master/games.

Now I can start thinking about the game itself.

Add a comment

A shooter!

It took me two days, but I finally figured out what kind of game I want to make. Remember "Into the Eagle's Nest"? Or maybe the more recent "Alien Breed" series? So yes, something like that, only with dots.


Of course the display will need to scroll, and to double (or even triple) the number of colors, I will have some of the dots blink. That should give me enough colors for the monsters, the walls, the doors and the items. Arrows for movement (first press turns, subsequent presses move in that direction), fire for shooting, and second fire for the inventory. Seems doable.

The monsters will be re-spawning (they are behind everything), but the items like ammunition and health packs will not — so you need to find the exit as fast as possible.

Add a comment

Forgot about the Memory

The game was progressing nicely, I got a scrolled map loaded from file, a pixel that can walk around it and shoot other pixels, etc. — but then I decided to try and see if I can run it on the actual hardware. Guess what. Out of memory error.


Don't worry, though, because I can put a lot of stuff on the flash. It's not like the disk on the PC — it's almost as fast to access as the RAM. I think I will start with the level map, as that's the biggest thing.

I might also revise my approach to programming this. I somehow naturally levitated towards using objects and classes, because that gives you nice organisation, but on such a limited platform that is really wasteful. For a start I will use slots on the classes, and if that doesn't help, I will rewrite the whole thing into more a procedural way.

Add a comment

Slots to the rescue!

I didn't really have much time to work on this, but I did a bit of refactoring: removed all inheritance, and added __slots__ to all the classes. The result? It now runs on the hardware without memory errors!


Running on real hardware.


I still want to do level loading directly from the file, because then I can have large levels not limited by memory, but I'm already happy with this outcome.


Slowly thinking about the AI for the monsters, I think I will have a couple of different behaviors, randomly assigned to them, so that they don't just lump into one group in a corner somewhere.

Add a comment

Another failed PyWeek

Somehow I can't get this done, even with the simplest of games. I have no problem making a game in 48 hours, but a week is simply not enough time.

Anyways, I have walking around a scrolled level and shooting, and I have monsters that simply walk towards you. I didn't implement health or ammo, and you can't get to the next level — which would be the minimal features to make this a game.

I still uploaded what I have, and I think I will be finishing this slowly at my own pace.

Add a comment