Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Sunday, June 5, 2022

PyWeek33: Quantum Entanglement

"Quantum Entanglement" was a team entry by Team MYCTL (for which I was part of) for PyWeek 33, (March 2022), a twice yearly video game development competition that gets competitors to build a complete game from scratch in seven days using the python programming language. This competition's theme was "My Evil Twin", and we made a 2D puzzle game where you control two scientists (one good and one evil) walking around within their respective labs, but where the controls for each character are linked to the same keyboard presses. The aim of the game is to direct the "good" scientist to a goal "green crystal" while ensuring that the evil scientist does not touch any of the "evil" items he has lying around in his lab space.

This was my first go at trying to "coordinate" a team entry (bigger than two members) and it was super enjoyable and a great learning experience: we had a good mix of different skills in the team and experience levels ranging from early programming experience to professional software devs, and from no game jam experience to very experienced game jam competitors. I learnt a good amount about managing a git repo with slightly larger teams (something I can say I'm probably not very good at!) and had a lot of fun working with others in different creative capacities: we even managed to get a game story going with a script and voice acting which was super cool :).

There were a lot of really cool puzzle concepts amongst the other entries for this year's jam: I think it was something to do with the theme that made for a lot of cool ideas, and lots around trying to control two characters (twins) simultaneously. I liked our concept, and would have liked to be able to spend more time trying to think through all the emergent mechanics that come out of the rule sets we came up with (but 7 days goes so quickly!).

The general premise of the mechanics was that each character is controlled by the same common set of ASDW direction commands: each character's environment is different however, so depending on how their character interacts with their map (i.e. one character runs up against a wall while the other continues to travel in free space) the "state" of each player (i.e. position in world) can be different. The general aim of the game is to guide the "good" character to a goal location (green crystal) while making sure the "evil" character does not touch any of the "evil" objects/squares in their map:

Using this mechanic, we developed a few different types of levels:

  • Early levels just presented each world with enough clutter to make the player concentrate on both worlds at once, but you could win by just guiding each player along the same overall path
  • Later levels would start to require that the player changes the relative offset between characters by pushing one up against a wall that the other did not have in their map: this would often be required to traverse a path that was offset from one world to the next.
  • Final levels would start to build on this complexity by requiring some combination of these effects.
Overall the jam was a lot of fun, and we ended up coming second in the teams division with an overall score of 4.04/5.0 which I think we were all happy with.

Game Playthough:


Extensions on game puzzle mechanic: I think the general idea for the mechanic we had here was pretty solid and I've been wanting to explore this idea in a bit more detail: I generally don't think making puzzle games is my strength, so I'm keen to explore this a bit further, and I'll be looking into this in a future post.

Sunday, October 24, 2021

PyWeek32: Temporal Anomaly

"Temporal Anomaly" was my solo entry for PyWeek 32 (September 2021), a twice yearly video game development competition that gets competitors to build a complete game from scratch in seven days using the python programming language. This competition's theme was "Neverending", and I made a sci-fi story-driven 2D action game in which the main character is stuck in a never-ending time loop. The game requires you to guide your character around the inside of a derelict science vessel in deep space, using your laser gun recoil in the zero-G environment. As you experience and re-experience the same events through several iterations of the time loop, you pick-up clues that allow you to out-smart your arch-nemesis, the evil Dr. Ubel and save the day by avoiding a catastrophe that tears a hole in the fabric of space-time itself.

This was a really fun entry to make: I ended up using the python arcade library (instead of my usual pygame), which was quite nice and made a lot of things more convenient. I also made heavy use of PyMunk for 2D collision physics. Voice acting for the story was also a big feature for this one: I recruited me wife to play one of the roles and I did the other two: it was really fun, we had a full script and everything. 

  


I was super chuffed to win the solo division and overall winner with a score of 4.44/5.0, which makes it the highest overall rated game in PyWeek history! Super excited :) ... 

You can download the game in source version here (requires python, python arcade, pygame and pymunk).

Playthrough Video:

Saturday, November 28, 2020

LowRezJam 2020: "Blur"

"Blur" was my solo entry to the LowRezJam 2020, a game jam where you have to make a game with a maximum resolution of 64x64 pixels. I decided to make a sound-driven story game where you play an astronaut trying to safety navigate their spacecraft back to Earth after an explosion on the spacecraft. The general idea of the game is that you regain consciousness after the accident and are experiencing temporary loss of vision: the game begins with a resolution of 1x1 pixel. As you start to regain your sense and get you spacecraft back in order, your vision slowly starts to return as the game progresses from 2x2 pixels to 4x4 pixels to 8x8 pixels and eventually 64x64 pixels by the end of the game. With the help of ground control over the radio you need to problem solve your way through malfunctioning subsystems, power restarts, communication failures, fire in the cabin and eventually safely re-enter your spacecraft back down to the ground.



I had a lot of fun making this game: because it was so dependant on sound, it relied pretty heavily on some voice acting, a script and various sound effects, so it was a good learning experience trying to do a lot of this stuff for the first time in a game. It made me realise too that making sound-driven games is really hard to get right and find good puzzles and mechanics.




The game was programmed in Python/Pygame and there are both Windows and Mac OSX builds of the game (made via PyInstaller) that are available, as well as the game source code, here:

"Blur" by mit-mit on itch.io (https://mit-mit-mit-mit.itch.io/blur)


Friday, April 26, 2019

PyWeek 27: Breakout Blue


"Breakout Blue" was our (Team Chimera) team entry for PyWeek 27 (April 2019), a twice yearly video game development competition that gets competitors to build a complete game from scratch in seven days using the python programming language. This competition's theme was "six", and we made a game in which you control six inmates trying to work together to perform a prison escape.


I teamed up with Lucid Design Art, the other half of Team Chimera: it was our first collaboration in about two years, and it went well. I worked on game programming, music and sound, and Lucid worked on game design and artwork. The game involved a combination of puzzle elements and a little bit of stealth, and turned out well. We placed second in the team entries and tied for second overall with a score of 4.13/5.0 so we were pretty pleased with the result.


Playthrough Video:


You can download and play the game from source (requires python (2 or 3) and pygame installed).

Saturday, March 16, 2019

3D Cube Rolling Ball Maze on Carvey

A while ago I made a rolling ball maze on Carvey, a soft-CNC machine at my local maker space. For a bit of extra fun, I've extended this now into the third dimension and created a cube-based rolling ball maze. The maze has six sides that are all inter-connected and makes for a bit more of a challenging experience. The cube maze is pretty much the same concept as a bunch of cheap plastic cube mazes you can but on Amazon etc. but a little bit bigger. To generate the actual maze itself, I developed a random maze generator in python using a recursive backtracking algorithm. I extended the approach to build the maze across the surface of a cube by placing maze nodes in a regular grid across each of the six faces of a cube and placing a number of random edges between adjacent face nodes to create paths that traverse the whole grid surface. The scripts I made output the generated maze as an image showing an "unfolded" view of the cube, and also spit out SVG files for carving.


The maze is carved as six separate sections from 9mm MDF and six 2mm thick clear acrylic panels (to stop the ball falling out). The panels are then glued and screwed together by hand. I had a look into a couple of different options for the track size of the maze. I have a few 2mm steel ball-bearing balls, but found that these don't actually work well: they are so small that roll too quickly in the maze and it becomes very frustrating to move them around by tilting the maze. I ended up using a silver coloured decorative ball for cake decorating: turned out to have the right size (approx. 4mm diameter) and rolls quite nicely.


Putting it all together was a little bit finicky: seeing as Carvey can only cut in 2.5 dimensions (three axis carving) I had to design the pieces to be of varying sizes such that they all interlock together and allow for the tracks to join up. The little bits of wood at the bottom were glued in as a way to chock the two smallest panels up against the clear panelling so the whole thing stays together.


Design files for the maze I ended up using (as SVG files that can be used for Carvey/Easel) can be downloaded here:


Python scripts for generating new random mazes and associated design files available via Github:


Friday, August 31, 2018

"Ret-Row": a 5th Kajam entry


"Ret-row" is my entry for the 5th Kajam, a month-long event in which people make a video game from scratch, focusing each time on a specific aspect of game making, as chosen by its host. This Kajam's theme was "Retro", so a made a little retro style shoot-em-up where you control a row-boat. I started off pottering with some pixel art and music, not thinking I would actually submit anything, but found that the game started to take shape after a week or two, so decided to see it through to completion.

 

I did all of the game's pixel art on my phone in spare pockets of time using the app "8bit Painter". The music was done in Musescore using a set of NES instruments, to give a bit of an old-school flavour. The game is programmed in Python and uses Pygame.

 

Playthrough:



Downloads:

Mac OSX 10.7+: 
ret-row_osx.zip

Windows:
Ret-Row_win32.zip

Source code distribution (compatible with Windows/Mac OSX/Linux, requires python and pygame):
Ret-Row_source.zip


Wednesday, May 23, 2018

Ships and Dynamites: A father and son made video game

My son is five years old now, and as he has got older I have begun to share my love of video games with him. He has taken a keen interest in my last two or three PyWeek entries, as so after the last comp he asked if he could help me make a video game. I told him "sure! why don't you design the game and make the graphics and sound, and I can do the programming". I asked him what the game should be about, what does the player do? He told me "You jump out of a big spaceship and jump over lots of dynamite and then get in another spaceship and shoot all the dynamite with your lasers". Sounded good so far. I asked him to draw me a picture of what the game looked like. He drew this:

I then got him to draw a few additional assets on paper: a dynamite box exploding, the word "level", the numbers 0-9 and a titlescreen for the game. I asked him "what about the player's character before they get into the ship? what do they look like?" He drew me this:

I took all of the pictures he drew, scanned them and then chopped them all up in Gimp. I wrote a quick bit of prototype code in python and pygame with the player running around in the game world, with the big ship in the background, little ships that you can jump in and shoot with, and dynamite blocks. My son gave some feedback on how the levels should be structured and gave the nod of approval.

Next I told him "we are going to need some sound effects ... what sort of sounds do you want in the game?". He made the sounds for the lasers, dynamite explosions and a little jingle for when the player dies. We recorded him making the sounds on my laptop's built-in microphone, and I used Audacity to crop the sounds and perform a bit of basic normalisation and noise filtering, before loading them into the game. "What about music?" I asked. He told me "the music has to go like this: da da da daaa da, da da da daaaa da! ...", so I recorded a snippet and set about making a quick orchestral arrangement around the tune he had hummed in Musescore.

Finally I asked him "So, what are you going to call our game?". He told me "It's called 'Ships and Dynamites' ...". "Shouldn't that be 'Ships and Dynamite'?" I asked. "No, dad ... it's Dynamites" he insisted. "OK fair enough ... Dynamites it is".

This is a brief playthrough of our final game:


It was really fun to do this together, we both had a great time. He has had fun showing his game to friends and cousins, and everyone we have shown so far seems to like the game, and I think he's learnt a bit about logically what has to go into a game, how to get something like this to work etc. If interested, you can download the game here:

ships_and_dynamites.zip (1.2Mb)
Source distribution: requires python and pygame


Monday, May 7, 2018

PyWeek 25: The Desert and the Sea


"The Desert and the Sea" was my solo entry for PyWeek 25 (April 2018), a twice yearly video game development competition that gets competitors to build a complete game from scratch in seven days using the python programming language. This competition's theme was "Two Worlds" and I made a 3D exploration and adventure game set across two parallel worlds connected via a series of portals.

 

The game was inspired (sort of) by early 90s adventure games like Myst; there's a bit of exploration to do and some spatial puzzles built around teleportation and having to move between parallel worlds to by-pass obstacles that exist only in one world or the other. The game uses Pygame and PyOpenGL to produce it's first-person perspective graphics, and I was pretty happy with the final visuals and feel of the game. I spent a lot of time "world building" in this one, trying to use the visuals along with audio and music to create a nice atmosphere.

 

Although it wasn't my best entry in recent times, it still managed to narrowly win both the individual and overall winner for the comp with an overall score of 3.95/5.0, so I was pretty pleased :).

Playthrough Video:


You can currently download the game as either a source release (works with Windows/OSX/Linux, but requires additional installations) or as a standalone Windows application (I'm still in the process of getting the standalone OSX version working):

 

Windows (tested on Windows 7/10):
the_desert_and_the_sea_pyweek25_windows.zip (76.4Mb)

Mac OSX: stay tuned!

Source Distribution (compatible with Windows/Mac OSX/Linux, requires python 2.7, pygame, numpy and PyOpenGL, see installation notes in README):
the_desert_and_the_sea_pyweek25_source.zip (11.9Mb)

If you are having trouble getting the game to run, or have a bug/crash to report, please email: randomprojectlab@gmail.com

Sunday, April 29, 2018

Python-based MIDI Keyboard Visualisation

On my walk home from work the other day, I came upon a discarded electric piano keyboard on the side of the road. It looked to be in fairly decent condition except for a layer of dust that had built up on the top of the case; it had probably been sitting inside unused for quite a while. I brought it home, thinking that it was probably broken, but that I would salvage the main keyboard and any other nice working bits inside (including a pitch bend wheel). When I got home, I chucked a couple of AA batteries in a switched it on and voila, working perfectly; all keys in working order, and the USB MIDI interface too.

It seemed like a bit of a waste to rip it all apart, so I got thinking about interfacing something interesting to the MIDI interface. I did a bit of research looking for video games that had been designed with a piano keyboard as an input device: I found a reasonable number of projects involving adapting existing games to use a piano input as a bit of a novelty (i.e. this and this), but I couldn't find much in terms of games that explicitly designed with piano input from the start.

I started off by coding up a relatively simple rainbow fireworks display linked into key presses using pygame running through a laptop connected to the midi keyboard and into a TV via HDMI. I coded little fireworks to go off at horizontal positions corresponding to pitch of the pressed key, cycling through colours in the rainbow and handed it to my five year old son to let him have a bit of fun. He seemed to like it; it was a bit like an experiment for him to see how it worked.


I might end up expanding on this idea: I've found products like this that create a whole game out of playing the piano.

Code available at:
https://github.com/mit-mit-randomprojectlab/midi_piano_visual


Monday, November 6, 2017

PyWeek 24: HackerBot


"HackerBot" was my solo entry for PyWeek 24 (October 2017), a twice yearly video game development competition that gets competitors to build a complete game from scratch in seven days using the python programming language. This competition's theme was "They're Behind Everything" and I made a 3D stealth game in which you control a little hacking robot trying to break into a space-based installation and steal data. You can "hack" into (and take control of) more powerful NPCs in order to help complete objectives (hence you're behind everything).

 


The game character is a little bot that can crawl around and jump from asteroid to asteroid. You need to avoid being detected by much more powerful "SentryBots" and turrets that essentially one-shot you. Your only "weapon" is your ability to "hack" into things when they get close enough: you can hack into shield generators to shut them down and access new areas, you can sneak behind guarding turrets and put them out of operation and you can even hack into passing SentryBots, take control, and wreak some havoc with their on-board weapons. The game features six levels and a giant boss battle to boot!

 


I was super excited to win both the individual entry and overall competition winner with a score of 4.29 out of 5.0. This score puts the game into the top ten PyWeek entries of all time (tied in at number 7, out of more than 1000 games over more than 10 years!) so I was pretty pleased with the result :).


Playthroughs:
Here you can find a full playthrough of the game, broken up into two parts:


You can currently download the game as either a source release (works with Windows/OSX/Linux, but requires additional installations) or as a standalone Windows application (I'm still in the process of getting the standalone OSX version working):

Windows (tested on Windows 7/10):
hackerbot_pyweek24_windows.zip (41Mb)

Mac OSX: stay tuned!

Source Distribution (compatible with Windows/Mac OSX/Linux, requires python 2.7, pygame, numpy and PyOpenGL, see installation notes in README):
hackerbot_pyweek24_source_v11.zip (8.3Mb)

If you are having trouble getting the game to run, or have a bug/crash to report, please email: randomprojectlab@gmail.com