I put together a Sketch in Processing this evening. It generates a canvas at whatever size you want, adds a black hole and a couple of thousand pixels that get sucked into the black hole with some simulated gravity. The final result is a bit like the image I had in my head when I started, so I’m happy with that. I would like it to be more awesome, but this will do for the time I have to play with right now.
I quite like the scratchy ‘pixely’ quality at ‘actual’ size, but that might be my nostalgia for older games and my taste in scrappy painting.
The code’s available over at http://www.openprocessing.org/sketch/119499 where you can hit the page a few times and generate variations of the image.
Anyway, enough with this post as I should be doing some real studying now (which involves reading a play).
I’ve spent enough time on this now to submit it, even if it’s still a bit rough around the edges. I’ve included a bit of a write up below. This demo will run best in Chrome or Opera. Click to play.
I’ve built a simple ‘game’ called Digital Husbandry. It’s more of a time killer as it doesn’t have any serious game mechanics, but there is a visual reward to keep the user engaged.
It’s based on the idea of simulating progressive evolution through selective breeding. Much as generations of farmers have done with livestock. The player brings together critters on the screen based on visual qualities that appeal to them, and produces offspring that drive the overall appearance of the group closer to those qualities selected by the player. The ‘critters’ die when they reach the ‘deadzone’ at the bottom of the screen, freeing up space for new critters in the population. So choosing which critters to sacrifice is as important as choosing which ones to breed.
The critters are recursively drawn from a simplified ‘genetic’ code. This allows the game to have millions of possible variations of critters, and the longer you play, the more varied the critters will appear.
I ‘composed’ some music in http://www.beepbox.co (which is a hugely fun distraction from fixing bugs in code). The music gets more layered and complex in line with the number of critters in the population. The audio tracks aren’t perfectly synced, but I’m happy enough with the effect for now.
NOTE: I ran into problems publishing the sketch with audio and I’ve run out of time to do any more work on this, so I’ve had to submit this version without sound.
A quick review of the Coursera Creative Programming Course, and using Processing for this kind work:
- It was nice to write some code that isn’t about capturing web form data or sanitizing user input!
- The format of the course, and the challenge I set myself were a good way to revise some of the classic programming concepts I don’t actually have to use much these days
- Processing isn’t quite right (yet) to take a project like this and polish it into a publishable product (which is partly why I haven’t worried too much about the finer details of this ‘game’)
- Processing is excellent for teaching creative programming
- It was a shame to loose the sound, I had a slightly mental retro game tune going by the end. This was the base tune, which built in complexity with each additional critter.
- I wouldn’t want to put this project through a code review! But it does the job for this assignment.
This is taking a little bit more shape now…
Coming up next is user interaction.
I’m just posting some progress as this concept develops.
Code etc is hosted on Open Processing if you want to have a look.
I’m really enjoying Processing as a sketchbook for code. It’s definitely a good tool for teaching programming.
This is some early code for a simple game I’m working on for the Coursera Creative Programming course (it’s my first time building a game rather than regular software).
These shapes are generated from a limited range of numbers, which can later be turned into a simple genetic code to define these critters.
I’ve hosted this on OpenProcessing.org, so you can get to the source-code etc.