Strategic Game of Life: Mobile Edition

Play It

android-win

android-campaign

android-play

A Simple Port

Strategic Game of Life: Mobile is a port of Strategic Game of Life, a simple game I made two years ago. The original game had 20k players the first weekend it launched, which for being an entirely desktop web based game was rather impressive.

The premise of the game is rather simple; take Conway's Game of Life (a cellular automata simulation) and add gameplay elements. In the original simulation players are typically given an infinitely large playfield and can toggle any cell on and off, pausing and resuming gameplay as desired (depending on the implementation of course).

In my version there are only certain regions which can be altered, cells outside of the playfield will never live (which has interesting side effects; gliders collide and become 2×2 still lifes, spaceships collide and produce gliders!) There are also cells which need to become alive to win, and cells which lose the game if they become alive.

Challenges

Porting a game from desktop to mobile was more than just a technical challenge. It may not be immediately obvious but all the level designs needed to be changed. Originally all levels were 64×64, now they all needed to be smaller than 24x24. Even so, some levels will be difficult to play on smaller phones (such as the iPhone 5).

My biggest goal with this project was to figure out the pipeline for building web-based games which will run everywhere. I used Cordova to build the mobile binaries. Another goal is that the Web/FirefoxOS version doesn't include cordova.js (I wanted them to be pure), so I had to do a few of my own API abstractions.

I also didn't want the app to be too large, so I stripped out jQuery halfway through the development. Ultimately it didn't matter too much as the audio files are ~12MB. Re-learning DOM interaction and breaking a several-year crutch did feel pretty nice though ;)

Earlier versions used Hammer.js for zooming game fields and panning, but this ultimately was difficult to implement and inconsistent between browsers, so I stripped it out and reduced all level sizes.

To Do

This game isn't 100% complete yet. Today I fixed a bug where Analytics weren't being sent off from within Cordova (web versions worked fine).

The audio system needs an overhaul to work with Cordova on iOS. Currently it uses

Once that last bit of functionality has been added I'll clean up the gulp build tasks a bit, polish the application structure, strip out audio, flatten repo, change from the Module pattern to using Browserify, and then open source it! This won't be so much a “library” that you can hook into, but a skeleton you can copy and paste and use as a starting point.

Thomas Hunter II Avatar

Thomas is the author of Advanced Microservices and is a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.