Previous Blog Next Blog
Prev/Next Blog
by date

A game in 20 minutes

A game in 20 minutes
Name:Tom Bampton
Date Posted:Aug 17, 2006
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Tom Bampton

Blog post



So far, this week has been filled with debugging hell which culminated today in the discovery of a bug in BitStream::writeBits() - but that's a completely different story, and one that's being dealt with appropriately.

On Monday I was feeling the need to make something completely pointless, in around an hour. So I asked Paul if he had any ideas, and he suggested implementing Conway's Game of Life. After a bit of umming and ahhing, I figured it was a pretty good idea and set about implementing it in Ticked.

A time breakdown of the initial "GID" is as follows:

* Neighbour Counting Algorithm - 8 minutes
* Game of Life Algorithm - 8 minutes
* Adding the HighLife variation - 1 minute
* Haxing the level code - 2 minutes
* Talking to Paul and pressing F5 - 1 minute

Total time about 20 minutes. It even worked first time, so no debugging required.

Unfortunately, because Ticked is currently semi-secret, I couldn't post a blog about it. So, I spent a couple of hours spread over yesterday and today copy/paste/hacking the Game of Life into a standalone "game."

You can download the game here: Win32, Zip, 2.15MB

I couldn't be bothered to do a Mac build, sorry ;)

WASD and the Mouse Wheel control the camera. Use the left mouse button to paint living cells (blocks), and right mouse button to paste dead cells. Then you can either use the Step button to single step or Run to step automatically every 500ms. If you want to try out the HighLife mode, check that box.

You can modify the game state at any time (running or not) by painting with the mouse.

Recent Blog Posts
List:08/20/07 - GID23 and NPC Editor
07/25/07 - Fun with Lua
06/11/07 - How NOT to make a game
11/18/06 - Thinking Outside the Box
11/03/06 - Alive and Ticking: Now with exploding ants
10/28/06 - Fun with zips
10/02/06 - Alive and Ticking gets to Beta .... err, almost. (Warning: Screenshot Heavy)
09/08/06 - Internal Name Operator

Submit ResourceSubmit your own resources!

David Montgomery-Blake   (Aug 17, 2006 at 02:03 GMT)
You know, this is just too damn cool! 20 minutes! Whoo-hoo!

Tim Heldna   (Aug 17, 2006 at 04:27 GMT)
Hey Tom, do you mind sharing the secret tag formula for displaying images to the right?

Tom Bampton   (Aug 17, 2006 at 04:31 GMT)
@Tim,

It's [ image align=right]url[/image] ... there are a few other "undocumented" things too, Ben mentioned them in a .plan a while back ... don't remember the URL or anything beyond aligning images, but might be worth looking for.

T.

fireVein   (Aug 17, 2006 at 06:17 GMT)
Fascinating... infact, beyond fascinating... i think... my god, i think i am obsessed...

NewYork Virtual   (Aug 17, 2006 at 06:24 GMT)
"Game of Life Algorithm 8 Mins", amazing, sometime idea comes so quick, you
dont even realize it.

Raxx   (Aug 17, 2006 at 15:03 GMT)   Resource Rating: 5
Hey wow, I'm surprised I can actually relate to this one! (makes it all the more cooler). I had read a book a long time ago that had a game of life type of game that was the most popular game among men (on a planet where women dominated men and made them submissive...), I've always wanted to play around with the game.

The only thing I dislike is how each step also halts the mouse and movement controls, it'd be nice if it only applied to the blocks.

It's awesome trying it out though, live on little blocks!.

Tom Bampton   (Aug 17, 2006 at 15:49 GMT)
@Raxx,

The "lockup" is probably due to the schedule being too fast / world a little too big. The life algorithm is implemented entirely in script so it's not exactly speedy. It's just a side effect of it being 90% reused code that was barely changed ;)

If you wanted to play around with the Game of Life properly then there are some "real" game of life programs around on the net. The wikipedia article I linked should have some.

On the other hand, it's far more interesting to just implement it yourself. My code is very specific to the level code I wrote for Alive and Ticking, hence why I didn't release code, but you could do something similar with TGB tile maps almost as easily. For my version the world is a full .mis with a custom SceneObject in it to handle the actual rendering etc, but you could do it just as easily with (a) GUI control(s).

Oh, one thing I forgot to mention in the .plan is you can press Ctrl+L to step normal life and Ctrl+H to step high life... I added those before I added the little control panel in the top right so they don't use the checkbox.

Edit: If you have a look in the prefs.cs, you can change the size of the level (might help performance) by changing the $Pref::Ticked::DefaultNewHeight and $Pref::Ticked::DefaultNewWidth vars. There are a few other prefs you can play with, but most of them probably won't have any effect. All the interesting ones start with $Pref::Ticked, I think the rest are just stock TGE prefs.

T.
Edited on Aug 17, 2006 15:52 GMT

Bardur Mikladal   (Aug 17, 2006 at 17:15 GMT)
hi... this looks JUST like an very old game named "Get a life"... wich is very simple but cool..

EDIT: damn... i wrote a long reply but it got cut off....
Edited on Aug 17, 2006 17:16 GMT

Raxx   (Aug 18, 2006 at 00:37 GMT)   Resource Rating: 5
Thanks Tom, it would be pretty cool for an adventure or rpg game to have a little "Game of Life" board laying around, I think I'll keep it in mind for the next time I start developing a game.

Your resources are always nice to take a look at, I hope you feel like you need to make something pointless more often ;)

Edward F. Maurina III   (Aug 18, 2006 at 00:47 GMT)
@Tom - You're an animal. :) I love the fact that you're always trying this-and-that. A true experimenter at heart I think.

Hall Of Worlds - For Gamers
EdM|GPGT


Tom Bampton   (Aug 18, 2006 at 01:06 GMT)
@Raxx,

Hahah, yeh that's a good idea. I have been thinking along the lines of using it for some form of interesting level generation. Kind of like ... you'd set up an initial state, run the life algorithm for as many steps as you want, then save any interesting patterns you find and throw together a level with them.

Another thing I've been pondering using it for is within the game itself. You get some interesting patterns sometimes that could be used to create a more interesting pattern of death in sudden death mode. In fact, now that I am thinking about it, there are a lot of interesting uses for it ;)

@Ed,

Thanks ;-) The more insanely stupid and pointless an idea is, the more fun it is to code ;-) Unforunately, in recent years I've gotten really bad at picking things that are pointless. Everything I do seems to turn into something useful.

After thinking through Raxx's comments I have now thought of a use for the game of life code that is relevant to the game, which unfortunately means I have to strike this from the "pointless" list.

T.

Jesse (Midhir) Liles   (Aug 18, 2006 at 08:00 GMT)
You rock, I love that game! =)

WilbertGeorge   (Oct 13, 2006 at 14:01 GMT)
I saw

A time breakdown of the initial "GID" is as follows:

* Neighbour Counting Algorithm - 8 minutes
* Game of Life Algorithm - 8 minutes
* Adding the HighLife variation - 1 minute
* Haxing the level code - 2 minutes
* Talking to Paul and pressing F5 - 1 minute

Dang! It took me longer than that to read your POST!

Thanks for the Game Of Life with a new outlook!

You must be a member and be logged in to either append comments or rate this resource.