Bipedal Robot

A little while ago I saw a really cool project that got me really excited about microprocessors and tinkering with hardware. I've been aware of the Arduino project for a while but my limited grasp of resistors and capacitors was holding me back a little.

A couple of weeks ago I caved and bought myself a Genuino Uno and a basic starter kit from Amazon. Once I'd built a few of the tutorial circuits I started looking around for other projects to build; the Gamebuino project above is still a little beyond my skills but definitely something I want to work towards. Whilst looking around at the various things people do with their Arduinos I came across an awesome Quadruped robot and wondered how I might build one of my own. I kept browsing and found BoB the Biped. The cool thing about BoB is that he only needs 4 servos and I happened to already have 4 servos that I'd preserved from an RC plane I had as a really young kid! I (literally) dusted them off and hooked them up, one at a time, to my Uno with the Sweep tutorial loaded and was amazed when each of my 20-year-old servos worked flawlessly!

The instructables BoB is made from 3D printed parts, but I don't have easy access to one of those, plus I wanted the option of maybe using it as a project with my students in the future so I decided to try building him from cardboard.

I stole a few unused packing boxes from a recent office move at work and set to work cutting and gluing the parts - shape was taken from the pictures with rough measurements that felt right at the time.

I worked on the legs first - I was a bit foolish to start with, cutting long pieces of cardboard, gluing together and then bending them to try to make the 'L' piece. These didn't come close to bearing the weight of a single servo, let alone all the other stuff. I initially flirted with the idea of adding struts to add some extra support until I realised I was looking at it from the wrong angle. I cut 4 'L' shaped pieces of cardboard and glued them all together to create a pretty sturdy leg. I used PVA glue to stick the layers together, which seems to actually add a bit of strength.

Next I measured out my servos and cut a 'Pelvis' with holes to drop them into. In an effort to save some weight (and drawing time!) I only cut 3 layers. I was pretty proud when the 3 sections were glued together and the servo cutouts matched within less than a millimetre!

I used a hot glue gun to glue the servos into the holes and the legs onto the servos.

cardboard frame

Next I used the headers and some old protoboard I had laying around and soldered up a simple connector board that provided 6v of power using 4 NiMH AA cells. I used the same cells to power my Uno via the Vin connector and although 6v is a bit low for the voltage regulator according to the docs, it seems to work ok.

cardboard guts

I made a cool head to cover it all by cutting carboard panels and hot-gluing them together. It's a little rougher than I'd like but I'm going to add proximity sensors and other features later on, so I'll likely build a new one to mount those into. I think this one was a little too tall as well, which caused a few balance problems.

Coding was next. I've been using a mixture of the official Arduino IDE and a web-based editor called codebender. I do intend to put my project code into GitHub, and I think codebender can interface with that but I need to investigate.

In the meantime, codebender lets you share code with a simple link, which is a little bit neater than pasting it all up in here:

Cardboard BoB Walking Code

After much fiddling with the various values, I ended up with a pretty effective walking gait, as evidenced in this awesome video:

Work still to do:

  • Add sensors so it can avoid obstacles
  • Add code to turn right, walk backwards & dance
  • Add a 8x8 LED matrix to display a mouth
  • Add sounds so convey emotions

I'll probably write about some of those separately as I go.

Pixel Palette

So I had the idea that if I created a pixel art palette, any art that I make in the future will be inter-compatible - so when I make bunch of robots for a dystopian future thriller game, they'll fit right in lurking in a cave re-purposed by a bunch of orcs.

Or something like that anyway - it's a nice way to fill an afternoon and I think I have something I like.

Pixel Palette

16 is the traditional number of colours so I went with that. There are still a couple of colours I'm not completely sure about, but I'll only really know for sure once I start making things with it.

Working on my Pixelling. Had an idea for a sort of Urban Survival game. Making graphics is hard though!



I have been working on a site for my photos and other 'art' for ages now. I've finally added a link to the site in the sidebar.

The site is hosted as a GitHub Pages site, I wanted something really simple but there were some challenges to overcome, chief of which was being able to post a photo directly from my iPhone.

I plan to write a post about the python app I wrote in Pythonista that uses the GitHub API to post pictures.

Overall I'm happy with the simple design, although there are still some things I want to do:

  • Albums should display photos with their titles, rather than just the same as the stream
  • Load the stream as the page scrolls
  • Fill in the About page.

Adventures in WebGL

Back in October I mentioned that I was looking at learning WebGL. I finally managed to find some time to do it this month and have made some pleasing progress.

My plan was to start off creating a simple 2D framework to replace jaws.js. I've been using this framework since I started playing around making games and I really like its simplicity, but I was butting up against its performance. Since it had a load of stuff in it I'm probably never going to use, rolling my own seemed like a good idea.

My first attempt was very disappointing from the performance point of view.

I asked for help. I was doing so very little with my demo that I couldn't understand why the performance was so poor. I got some pointers and was able to make some changes. Basically, you can't do lots of buffer\push\draw operations very fast in WebGL. You have to break them down so that you're buffering a whole load of points into memory then drawing them all at once. I was able to get much better performance by creating a SpriteBucket. drawing ~500 sprites at a time appeared to give me the best balance, giving me >10,000 sprites @ 60fps.

On the whole, I was unprepared for how delicate the balance was between getting reasonable drawing rate and not. I naively thought that WebGL was a super powerhouse of graphics processing and I would only start to have problems when I started trying to do stupid things. I suppose you could argue that plastering 5000+ sprites on the screen at once and redrawing everything constantly is stupid, but my LD30 game had tilemaps and monsters that could have potentially approached this and it didn't run very well.

With a few obvious tweaks like not bothering to draw stuff off screen (duh!) and only updating vertices and texture coordinates if something has actually changed I saw immediate improvements. The less obvious (to me at the time) stuff, like buffering batches of sprites for a single draw call made the biggest difference.

Introducing Glixl

The end product from my dalliances this month was Glixl. Glixl can create sprite and tile maps from 2D sprite sheets. It goes pretty fast if you pay attention to what's being drawn, although there are still areas I can improve. My intention is to use this for my games from now on, so I'll be developing it as I go, adding features that I need. Some things that I still need to work on:

  • Mouse & Touch controls
  • Tilemap path finding
  • Animated tiles

and I need to improve the SpriteBucket object as it has a few things I feel are hacky. Overall though, it does exactly what I want it to do.

I've started making a simple game, Dojo Master. to test it too, which is working out quite nicely. So far I only had to add 1 feature to get it working.

Dojo Master.

Discovered in a text file titled: "Game Ideas":

Paramecium Chronicles- base building/survival horror. You choose an orifice to invade, set up shop and start replicating

Awesome idea I have absolutely no memory of coming up with.

Ludum Dare 31

Sadly I wasn't able to participate in Ludum Dare 31.

I thought the theme was interesting. I know there were some complaints that it was overly specific and made 3D games harder or impossible. It was actually one of the themes that I voted for though because I thought it would be fun.

When I woke up and found out that was the winner, I immediately had the idea of doing a classic platformer with multiple levels all visible on the screen at once. I notice today as people start submitting that there are a few other people who had the same idea and they do look awesome!

are two that I've seen so far. I love the idea!

I got as far on Saturday as making a little 8-pix character, Henry:


My plan was to set up as many 64x64 levels as I could all joined together, with puzzles or bosses to defeat to unlock the door to the next space.

Alas, I was unable to do it. I might play around with the idea, but with so little time to do much of anything these days, Henry's dreams of rescuing his dragon will likely remain forever unrealised. Poor Henry.


I spent last week in the New Forest with my family. Apparently this year is a very good year for mushrooms. As we were walking around the forest, I saw lots of different types and some of them made some nice photos. I did have a go at identifying them but it's quite tricky and the only one I am reasonably sure about is the second to last one which looks like a Vermillion Waxcap.

Click for full size.


I'm at the very early stages of learning and working with web-gl. Now that Apple has added support for it in Mobile Safari it's something that I can get excited about.

I've made it much easier for myself to post and edit blog stuff. This can be a kind of living blog post where I can collect links to the stuff I find.

Ultimately, I'd like to produce a simple javascript library that's as easy to use as Jaws.js, starting with 2d as it's the performance increase that I'm interested in.

Update 2015-01-27: I made one! glixl is a 2D tile/sprite library for WebGL.

Full blog post

Although very short, this is a blog post by virtue of the fact that it has a title!

Posted using my new burble based editor.


I made a discovery this weekend. It has taken me almost a year to make the realisation but it was striking when I noticed:

Archive Screenshot

I've never been a particularly prolific blogger, but 2014 is easily one of my worst years yet.

It's no co-incidence either that the last post of 2013 was about me moving my blog to GitHub. In moving it to GitHub I created a barrier to making posts.

Previously, I've always built my own blogging engines and they have always come with web-based front-ends for managing and posting articles. I could quickly navigate to my blog, log into the control panel and post an article.

The workflow for posting an article from GitHub is really not that difficult but it adds a few small extra steps that act as barriers to me actually bothering to do it and it's a real shame.

I have a solution. It's still in progress but the primary functionality is already in place - Burble is a microblog hosted on GitHub as a GitHub Pages site that includes a basic Javascript based editor. The editor uses the GitHub API to make posts directly into the repository, completely bypassing the need to fire up an editor, sync or clone the repository, generating the file with the right name, writing it, committing it back etc etc.

I have some bigger plans for Burble itself, but once I have got the editor working fully (currently it only allows the posting of new 'blurbs', no editing or deleting), I will be able to use it to manage my main gh-pages hosted site (this one!). I'm quite excited about both projects, which will hopefully inspire me to write about them a little more.

Ludum Dare 30

This weekend I took part in Ludum Dare, the build-a-game-in-48-hours competition.

The theme this time was Connected Worlds. I had an idea fairly early on - Scientist (Rodney) accidently opens a portal to another world, gets stuck and has to try to find his way home. Definitely not original, but it was a start.

My Entry was built using HTML5 Canvas & Javascript, using a few simple frameworks:

  • JawsJS - Really nice, simple 2D game framework
  • Howler.js - Clever HTML5 audio library

I was particularly pleased to be able to use some of the pathfinding features in Jaws that I contributed a while back too!

Overall I was pleased with my finished product. It wasn't quite as ambitious as I had planned for but I finished it and it makes some kind of sense.

Things I was pleased with

Random world generation - I used a Cellular Automaton algorithm that I'd been exploring earlier in the year with one of my A-level classes. It took quite a bit of tuning to get it to generate useful worlds, namely due to the Javascript random number generator, it seems to cluster > 0.5. I might do a little more research into that later.

Enemy AI - It's laughable to call it AI really, the Bat Fiends look around, if they see Rodney they move to intercept. But it really worked. It looks really cool when you walk into a new void area and a whole flock of Bat Fiends come chasing out of some side corridor after you. It's the little things.

Art - I am no artist, but I've been developing my pixel art skills over the last year or so and I was actually pretty pleased with the result:

Rodney the Scientist

The bat fiends were pretty simple, but cool looking:

Bat Fiend

Things not so pleased with

Sound - Howler turned out to be brilliant, really easy to use and just worked. My ability to create sound effects however needs much development. Music I completely failed with, no idea where to start. Definitely an area to work on for next time.

Animation - I definitely need to work on my walk cycles!

Fun - I'm not completely convinced that the game is actually much fun. It was quite cool when 3 or 4 portals in, I found myself tunneling through the walls to get around instead of walking through open areas because there were so many bat fiends, but I'm not sure it had much lasting appeal.

Bottom line

I had a lot of fun working on this. Technically, I'm quite pleased with it, but conceptually, it could be better - I think I need to spend the next few months playing as many computer games as possible to get a better idea of what makes them fun.

Things to work on:

  • Musical composition skills