Atom Factory

9 minute read

Created for the Ludum Dare 48 Hour Game Making Contest #23 on 21st/22nd April 2012 for the theme “Tiny World”.

Atom Factory

<script src="http://www.adriandale.co.uk/wp-images/AtomFactory/swfobject.js"></script> <div id="altContent">

LD23

<a href=\"http://www.adobe.com/go/getflashplayer\">Get Adobe Flash player</a>

</div>

Help Adam the Atom Factory Robot to move the atoms to the delivery conveyor. Be sure not to drop any. Bonus points are awarded for delivering consecutive same coloured atoms.

Use Left, Right, Down and Up cursor keys to steer Adam. Press Up when under a conveyor belt to grab an atom. Press Right to push a held atom onto the delivery conveyor belt.

Tiny World? Can you think of anything smaller than an atom?

Credits

Coding, graphics and sound by Adrian Dale, as per competition guidelines.

Game Engine: FlashPunk by Chevy Ray

Sound Effects generated using sfxr by Dr Petter.

Audio Format Conversion done using Audacity

Graphic Editing: The GIMP

Developed in Action Script 3 using the FlashDevelop open source code editor.

Full Source Code: here

Development Notes

I had felt a little reluctant to publicly blog my progress on the official competition website, however I did take notes for my own personal benefit.

This was my first attempt at coding in Action Script, so I wasn’t sure how it was going to turn out. I’d read the official language description pdf file from Adobe and followed a couple of tutorials on game development libraries Flixel and Flashpunk, but that was pretty much it.

I had a quick warm-up last week with my first Game In A Day project, so I was feeling confident. I also found some time to write a couple of basic Flashpunk things to try it out on Friday.

I nearly got sidetracked into trying to rapidly learn about the Starling Framework after being wowed by the smoothness of the graphics on the Whack! demo example. However, I decided that it would be safer to go with Flashpunk as my game library as I was more familiar with it. To help decide I wrote a little app to reproduce the Starling benchmark app to see how much worse the performance would be in FP. It is worse, as you’d expect, but so long as you don’t try to rotate the graphics it is still more than enough to make a simple game run at sixty frames per second.

I got up bright and early on Saturday morning to get started on my competition entry. I’d decided to allow myself a couple of hours for the planning stage. I knew in advance that I had plans for Sunday afternoon, so I wouldn’t have a full 48 hours available for development. This fit quite nicely with my existing Game In A Day theme, and as it happens most of the work was pretty much done by Saturday night anyway.

The theme “Tiny World” suggested a few obvious ideas that I dismissed straight away. I suspected quite a few people would be tempted into writing games that involved exploring the world of ants, so I gave that plan a miss. I also suspected that my achilles heel would be producing decent graphics, so I leaned towards producing something more abstract. And then I hit on the idea that when it comes to tiny, atoms are pretty tough to beat. And they’re a nice easy shape to draw!

I had the idea that the player might have to pair up atoms to make molecules. I’m quite a fan of the game SpaceChem, even though I’m one of the players who make up the left hand end of the failure curve. I also like conveyor belts after playing Zach’s other game, Manufactoid and its copy, Tile Factory. Somehow these pieces seemed to meld into something with shades of 1983 classic arcade game Tapper, and I decided to get started on the coding.

Atom Factory Rough Plan

This is my initial rough sketch plan for the game. My Wacom tablet was playing up a bit as I hadn’t re-installed the drivers after recently re-installing Windows, so it’s a bit of a shaky diagram. Looking at it now I’m quite surprised how closely it resembles the finished product.

Along the way, various parts of the plan changed. Mostly bits I removed as they seemed a bit too ambitious. My priority was to deliver a competition entry on time, rather than risk failure by taking on something too complex. So, no forming complex molecules out of atoms using a clever spinning mechanism on the robot, for example.

I wondered if I should have spent more time in the planning stage but felt I needed to start coding something straight away so that I could get a feel for how things would be sized on screen. This is how the game looked with coloured rectancles to represent the player and the conveyor belts:

Atom Factory Initial Layout

It took me quite a while to work out the movement logic for the player. It depends on whether the robot is in the up/down position or is currently walking side to side. Up/down needs to move in steps so that the robot lines up with the belts when he stops. Left/Right needs to be analogue so he can pick which atoms he wants.

I was delighted with how easy I was finding it to get things working with Action Script. By 11:45am I had the player movement logic sorted, the atoms in and moving along the belts. I just wish I had a copy of the full commercial Flash Development Environment for producing animations, graphics, etc.

I also liked the way that I got other game ideas while I was on this one. Much better to actually start coding something, rather than sitting waiting for inspiration.

This is how the player and atom graphics looked in my editor while I was working out how big I’d need to make the grabber to fit the atoms:

Player Graphic Editing

By three o’clock in the afternoon most of the final game elements were in place. Atoms were spawning on the conveyor belts and the robot could collect them with his grabber and drop them on the vertical belt at the side. As you can see from this screenshot, however, I’d been putting off the moment when I’d have to pick up my tablet (or mouse, in the end) and confront my graphic art production nemesis:

3pm Progress

I had new ideas coming thick and fast - power-ups between the conveyor belts that would let them rewind, slow down, increase score, etc. However, I put them to one side while I got the fundamentals out of the way.

By four o’clock I had produced animated conveyor belt graphics and just needed to work out how to synchronise the animation with the atom movement. I didn’t ever really fully solve that issue but didn’t want to spend too much time getting sucked into minor cosmetic issues, so I left it as-is.

At this point I noted the “horrible” robot graphics in my journal. Sadly I don’t think I really improved them a great deal when I eventually found the time to put some love into them. The yellow and black hazard stripe was a last minute addition.

4:30pm Progress

Messing with The Gimp to produce graphics was a little frustrating, so I left off to get dinner. Coming back to it refreshed I was gratified to find that with relatively small graphic tweaks (like the drop shadows under the conveyor belts) my game seemed to suddenly hit a point where it actually began to look like a real-life computer game, rather than some sort of junior computer school experiment. I learned in my Super Soko project that having decent graphics makes a game feel a lot different. This picture inspired me to keep on going:

Graphic Progress

This was the moment when I got the idea for having to match up the coloured atoms to score bonus points. I still had plans for the round blob that appears to the left of the top of the vertical conveyor in my original plan, too. There was going to be a button there that the player would run over to start the conveyor belt when he had placed the atoms on it in the right order. I also contemplated using it as a fast forward button so the robot could clear the belt, allowing longer runs of matching colours to be strung together. Eventually this feature was dropped completely to keep the game simple. The “stopping point” at the top of the screen still remains, though. I thought it was neat for sneaking in last minute atoms to continue a streak, even though it doesn’t really need to be there.

By ten pm there wasn’t much left to add. Well, I had tons of things I could have added, but I wanted to finish creating all the bare minimum components to feel like I had a proper game before adding extras. The game had no sound, no game over or title screens and didn’t make any effort to make things harder for the player as time went by. This is what it looked like - not bad for a day’s work:

Day One Progress

I had the bright idea of using iPhone App Thumb Jam to come up with some music for the game, but gave up on that for the same reason I stopped playing with Thumb Jam - it lags so badly (on my iPhone 3GS) that it’s just too awkward to record anything in time.

I knew I didn’t have much spare time available on Sunday and made a bad start by accidentally sleeping in a little late.

Adding in the title page felt unnecessarily painful getting to grips with FlashPunk’s Tweens. I spent way longer on that than I would have liked.

In contrast adding sound effects was relatively quick, although you’ll probably note that I didn’t really put much effort into generating any of them. I mostly used the “Random” button on sfxr until I found ones that seemed passable. Really I just wanted to check the “Has Sound” box on my game.

I had the game mostly complete by the time I had to leave the house. I didn’t have the difficulty level the way I wanted (too easy!) and didn’t get round to fixing that later on. The game does get harder by adding atoms more quickly as time goes by but it doesn’t ever speed up the conveyor belts, which I would have liked to have done.

After spending the afternoon out I didn’t have much time left to work on the game when I got in. I also felt like I’d had about enough of it. It felt too easy to play and got boring very quickly. I didn’t think the effort of speeding the belts up would do anything to sort that out and more than that I was worried I could have last minute hitches getting the game up on my site or on the competition site, so I didn’t want to risk breaking anything.

As it happens, I did have difficulties getting the game to appear on my website, but that’s fixed (and hopefully still fixed!) now and I was also able to submit my entry to the competition website here

Gameplay issues aside, I’m delighted with how Atom Factory turned out, particularly for a project in a programming language that I’ve never used before. I’m not expecting any prizes in the competition (there aren’t any!) but it’ll be interesting to see how the other entrants view my game. No matter what, though, I had a lot of fun writing it and definitely learned a lot.

Categories:

Updated: