I’ve got my two button game working now. It’s fun watching people play a game that you’ve made. They start doing things that you weren’t expecting. But sometimes you find out other things too.
The gameplay (press the red button if there are more red lights lit, blue if more blue) is simple, but I make the task more interesting by adding more colours and making the colours move around the lights. Then I thought I’d make the lights flash on for half a second and then off, so that the player has very little time to count them.
This actually makes the gameplay seem easier (at least for me). The brain seems to retain the information for a while so that you can work out the answer, even with a very brief look at them.
I think this is the basis of “flash cards” although I may be wrong. But it is a useful reminder of the way that you can start going down really interesting tracks when you start fiddling with games.
I got my little game working on the Raspberry Pi yesterday, and today I got to thinking how I could make it work on something a bit, er, cheaper. It’s not so much that I begrudge paying the price for the Pi, more that I can think of more demanding things to do with the Pi than just run the game. My thoughts turned to the ultra-cheap ESP32 devices that I’ve been playing with. The only snag is that I’ve written the entire game in Python for the Raspberry Pi, and I don’t fancy re-writing it in the C++ that these devices normally run.
So, why not run Pyhon on an ESP 32 device?
This turns out to be really easy. If you’ve installed ESP32 devices as part of your Arduino development environment you will have a useful little program called esptool.py on your machine. To convert a device to Micro Python you just have to plug in one of those ultra-cheap devices, find out what serial port it is connected to (in my case com4) and then use the command below to program the chip with Micro Python.
esptool.py --chip esp32 --port com4 --baud 460800 write_flash -z 0x1000 micropython.bin
This loads the image in the file micropython.bin into the device. To get a Python image, go to the download site and look for ESP32 devices. I used the one in the file esp32-20190714-v1.11-146-g154062d9c.bin
When you restart your ESP32 you will be able to talk Python to it via a command prompt. That’s fine, but what you really want is an IDE that lets you write and deploy Python programs.
The best one I’ve found is called Thonny. It’s works with “normal” Python nicely enough, but it also has an option you can use to point it at an embedded device:
In the options menu above I’ve told Thonny to search for a device running MicroPython and connect to that. Now, when I run a program it is deployed into the device and executes from there.
The MicroPython installation provides a tiny filesystem that can hold python programs. When you run a program it is transferred into that filesystem and runs from there. There are two special program files on the device, boot.py and main.py. The program in the boot.py file is executed when the device powers up, followed by the one in main.py The Thonny program has an option (in the Device menu) to save the program you are editing one of these files. This makes it really easy to make your Python program run when the device is powered up. I made my game program the main.py one and now I have my original Python program running inside a device that only cost around a fiver.
It wasn’t quite as simple as just copying the files over. The api (application programmer interface) to use GPIO ports and Neopixels are different in the two devices and I discovered that MicroPython does not provide a random.shuffle method. This meant that I had to create my own shuffling function, which wasn’t too hard.
Anyhoo, I now have my program running in Python on a tiny embedded device. Which is rather nice. I’ll put the code up on GitHub later this week.
Well, that was fun. I really should have taken some pictures of the jam, it was great fun. There were loads of machines set up and creativity going on all over the place. I took my “Two Button Box” along and developed the rest of the software. Thanks to Ben, Jon and Matt for advice and help on getting my Python program to run each time the box is powered on (this harks back to my Unix days of old - editing the rc.local file to run programs on boot up).
Players need to press the red button when there are more red lights lit, and the blue button when there are more blue lights lit. I’d taken a bit of care to make the gameplay progressive. The game starts simple, with just red and blue lights, but then other colours appear and then they all start to move around.
It’s always nice to see people playing a game that you made. I’m not sure it pushes back any frontiers or brings anything particularly new to gaming, but it is always nice to see someone enjoying playing with something you’ve made; particularly if you enjoyed making it.
You can see it in action here. Thanks to Jon for the video.
Forza Horizons is an awesome franchise. I have great memories of playing Forza Horizons 2 with the Storm Island add-on. Number one son has got Forza Horizons 3 and we were playing it this evening. The game has "Barn Finds", cars that you can unlock by, er,, finding them in barns dotted around the map.
We had a look for barn finds today and found a Reliant Regal three wheeler van in one barn. This was actually my very first car, although I don't remember it being painted in quite such a lush shade of green.
This is the vehicle made famous by the "Only Fools and Horses" sitcom, although people often refer to the one in that show as a "Reliant Robin", which it is not. The Regal is much less sophisticated than that. It has a fibreglass body over a steel chassis, with a 700cc engine sitting nearly in the passenger compartment. Nought to sixty in "You don't want to go there...".
Number one son had an experimental drive and noticed that it is surprisingly easy to tip it over. And slow. And noisy. But the exterior and the interior have both been lovingly recreated.I think this feature is probably worth the price of the game on it's own. If it had a Nissan Cube and a BMW i3 the game would be completely perfect.
Actually, the gameplay and the sheer depth of content make the game an absolutely fantastic buy anyway. I'm tempted to get it in the "dual" version so that I can play it on the PC and on the Xbox One.
So today I had a go at Euro Truck Simulator 2. To be honest, it could have gone better.
One of the fantastic things about this job is the capacity of students to surprise you with the things that they do. Yesterday, in the First Year Labs, Michael asked me if I wanted to have a look at the game he'd been working on for a little while.
It's really nice.
It's a Theme Park simulation written in Scratch. You can have a go here. Quite a few thousand people already have. I told Michael that he must promise to start writing a blog about the game and how he made it, and I really hope he does.
Adam is leaving us. End of the month. Heading to Canada. We wish him luck and thank him for all his efforts making the systems work and helping to organise lots of lovely student events. We are really going to miss him around the place.
The only good thing about him leaving is that in celebration (?) we had a games evening tonight. I was quite keen to have a go at Snake Oil, as I'd not played it before, and other folks had brought along games that they thought would be fun too.
Snake Oil is an OK game. Pitch ideas for dodgy products, and take it in turns to be the discerning (or not) customer. Not bad as a party ice breaker but limited, as observed by David, in that there is restricted potential for deceiving the other players.
Mascarade is an awesome game, especially if you can get 13 players playing at the same time, which we did.
Lots of bluff, counter bluff, and bluffing when you don't even know who you actually are. Strongly recommended if you are expecting a large number, but I'm not sure how it would go with four.
I'm going to have a go though.
We've played Coup before. Always fun, always infuriating. Especially when you are playing it with this bunch of reprobates.
Bluffing is not encouraged, it is pretty much mandatory.
The final game of the evening was Skull. Which pretty much did me in for the night.
Rather like poker, but distilled down into the bluffing and deception bit.
A really, really good game with the right people. And these were definitely the right people. I didn't win, but by golly I was very close.
For quite a while I've been looking at the game Monument Valley on iPhone and Android and wanting to have a go on my Lovely Lumia phone.
Meatlyjam is a game jam that was running over weekend. I've been asked to help with the judging of the entries. Apparently there have been 62 games submitted, which is just amazing. Kudos to the organisers and those who took part.
You might think that going through 62 different games and scoring them is a bit of a pain, but actually I'm really enjoying clicking on each entry and finding out what it does.
If you fancy having a look at the entries you can find them all here. I've only had a look at the first few so far, but there are some really nice ones in there.
Grand Theft Auto 5 is a game about mostly horrible people doing horrible things. With guns, cars, planes and large ugly dogs. But I reckon it is a towering work of art too. And on the next-gen consoles it is even better.
I spent a happy afternoon watching number one son run through a few missions in the new First Person View and it really is disgustingly great. Even if you have played the previous versions on your PS3 or XBOX 360 I reckon you should get a copy for your next gen console too.
Robs Red Nose Game, long available for Windows Phone, has now made it into the Windows Store. As you can see above, it is massively popular. Or something.
It's a free download, and mostly harmless. It only works on tablets and it seems stupidly easy right up to the point where it becomes impossible. For some reason I'm embarrassed to relate it has 001 in front of the name. This is not a clever marketing wheeze to put it at the top of the Windows Store listings, but something silly I must have done a while back. I might keep doing it though, which means that the seventh game will probably involve secret agents.
And get me sued.
Anyhoo, feel free to have a go, and let me know what you think.