Space background generator

Lately I have been spending time on my Meteor Loop concept game. A big part of what I have been doing is the procedurally generated backgrounds. I really like what I have come up with, and some of the screenshots look great.

The actual game is in no state to show at the moment, but I really wanted to show how the background is coming along. So I decided to split it out into a stand alone project, so you can see it. Take a look here:

Click the “Generate new” button in the upper left settings panel to generate a new background with a new random seed. Have a go at changing the colour to see what it looks like.

Meteor Loop procedurally generated backgrounds

Meteor Loop is an Asteroids style space game that I am working on in my spare time. I know, doesn’t sound very original. It seems like everyone has to make an Asteroids clone at some stage. Personally I have made at least 4 different versions now. I always use Asteroids as a project to really try out a new language or library.

But this post is not really about Meteor Loop. I will do that post later. This is just an update to specifically show the dynamically generated backgrounds that I will use in the game.

Every level will have a different randomly generated background. Here are just a few screenshots of my favorites:

The game is being built using Flash, with ActionScript 3. I am using Away3d for the planets, and perlin noise for the cloud background and star distribution.

To generate the background, I start with a random seed. I use the seed to grab a random colour from a selection of predefined colours. Then I randomly choose the size, number of subdivisions, position, and rotation speed of the planet. I create the sphere using Away3d 3.6, with just a colour material. I also duplicate the sphere, but with a wireframe material, and scale it up a little, so it creates sort of an atmosphere.

For the clouds and star I create some perlin noise data using the BitmapData’s perlinNoise function, and tint it with the same colour as before. I create a second perlinNoise bitmap with a smaller numOctaves and use it to calculate where the stars should be. I simply did “the higher red channel value a pixel has, the higher chance I draw a star there”.

To add a bit more variation and interest, I then created a gradient overlay with its blend mode set to OVERLAY. This gives the background clouds a nice range of punchy colour, and some nice empty black areas for the stars to shine through a bit more.

I spent quite some time tweaking numbers of the algorithms, and I think I could easy find some more numbers to play with. Let me know what you think of these screenshots so far.

UPDATE: Check out the live version of my Space background generator.

Obvious games I don’t want to see in Ludum Dare 24

The final theme for LD48 has not yet been decided, but I thought I would take some advice from a Ludum Dare winner:

“Throw out your first idea. Unless you’re a mad genius, your first idea for the theme is going to be the same damn idea everybody else thought up. Toss it, it sucks.” – Chevy Ray

So I went through a bunch of the top themes and pooped out the first thing that came into my head. I really don’t want to see any of these obvious ideas made into games, unless you put a insanely good twist on it.

  • Abandoned – Depressing game that is a metaphor for how alone we all are in the world.
  • Survive – Running away from zombies.
  • Curiosity – Some sort of “don’t press the button” situation.
  • Afterlife – You are a ghost who lives in a house, and you have to discover how you died.
  • Tunnels – Train simulator.
  • Creation and Destruction – Two player Angry Birds.
  • Castles – Two player Angry Birds.
  • Companion – 2d platformer where you have a little floating friend who gives you your power, and shows you what to do.
  • Don’t Go Outside – Because there is a flesh eating hoard of zombies.
  • Secret World – Crappy platformer that has a dark and scary theme.

Feel free to comment on any other “obvious” games from any of the themes above, or from any theme I missed.

LD 24 theme voting game ideas

As I anxiously await the start of Ludum Dare #24, I find my brain firing off in all directions with game ideas, art styles, programming techniques, and mechanics etc. So thought I would give my brain something to do, and jot down some game ideas based some of the interesting themes from each voting round.

Round 1:

All the themes I voted on this round seem related: Dim LightsGhostsNightSurvive, and Trapped in Another World.

Light the maze

Place a limited number of lights throughout a maze to light the way. You must light the entire path continuously from the start to the end. You could be a player running around the maze with a small lantern, placing torches on the walls. You can pick the torches up again if you like. Maybe you are lighting the maze for someone else to get through, who will start walking after a time limit. If they walk through the dark, they might get lost and attacked by ghosts.

Round 2:

AbstractCompanionCreation and Destruction, Secret World, Self Destruction, and Symmetry.

Split identity

Start by controlling a character through a level, then when you get to a point, the screen splits into two. Now you control both characters, but with exactly the same controls, but each is in a different level. It could then split into four and maybe more. You would have to get all characters to the ends of there levels.

Round 3:

Antique, Colony, Confined, Explosion, and Parallel Worlds.


You pilot a steampunk helicopter that must use a dangling rope to hookup parts to assemble something. You can then equip the thing you just built, and use its ability.


You can phase between two different worlds that share similar structures of the level. Enemies can only exist in one of the worlds. Your gun teleports them into the other world. You must solve puzzles in both worlds, so make sure you don’t teleport too many enemies to either of the worlds. The gun could actually just stun the enemy, but also make a copy of it in the other world, so the more you use the gun, the more enemies that will be waiting for you in the other world.

Round 4

Break the Rules, HopelessInevitability, Plague, and Wilderness.

Possum control

There is a virus outbreak in the possum population, that can also spread to humans. Use any means necessary to wipe out all the possums. The most effective way is to dump 1080 poison in the bush, but after the backlash of using it in the wild, it is in short supply. You must also balance other methods, such as controlled bush fires, hunting squads, traps, and releasing predators. You goal is to destroy every last possum, without causing too much damage to the environment.

I will continue updating this post as more voting rounds happen.

Planning for Ludum Dare 24

Just decided today that I am having another go at this weekend’s Ludum Dare. I really need to redeem myself after my last miserable attempt. I am still not aiming for greatness, but will be happy if I just get something playable. If it is fun, then that would be an amazing bonus.

I think I had quite a good concept last time, but just didn’t plan my weekend. I had too many other things on, and did not get into any serious coding. I hope this time I can get inspired by the theme, as I want to spend a fair bit of time at the start just circling ideas around, and letting good ideas bubble to the top. I really have to keep it simple to have any chance of finishing, so I need to eliminate anything that might not add to the game. I am really going for “biggest bank for my buck”.

I am hoping to use this week to prepare, and do a bit of practice before the starting gun on Saturday 1pm (NZ time). I don’t think I will go as far as making a warm-up game, but I will definitely be getting my basics down, and might even have a go at some libraries that might help me out.

I am going to try and enter this from a fresh start, with no preconceived game ideas. I am gonna try and let the theme speak to me. Lets see how that works out :)

Thinking about moving my website away from Flash

I am still quite proud of my personal portfolio website, but for a while now I have had a niggling feeling that I should redo it with “standards” based tech. I think the website still works at what I built it for, as a showcase of my design and development work. When I built it, back in 2009, I was calling myself a Flash developer, so building my website in Flash was the perfect choice. But things have definitely changed even since then.

For the past few years I have been thinking more and more of myself and my skills as wider than just one platform. My best skills are not necessarily in Flash, but in the development of digital media. Whether that be websites, desktop software, mobile, or games. It doesn’t matter what tools I am using, it’s about creating cool or interesting stuff that works.

I say I want to “redo” my site, because I think the concept still works, it’s just the technology I am worried about. Also I want to push my HTML, CSS, and JavaScript skills to create something “flash-like”. Sure it would be a good opportunity to re-invent the site, but to be honest, it is working for me, so why fix what ain’t broke.

Flash is definitely like an old friend to me, so it is sad that I am thinking this way. It does make me wonder though, if I am thinking this way, and I am a fan of Flash, then what are others thinking. I strongly believe you should pick the right tools for the job, and now it seems the time of Flash being the right tool for my personal portfolio website has passed.

So expect to see updates on my progress as I learn a few things, and curse myself for ever attempting this.

Added TreeList to MinimalComps

I love the MinimalComps set of components, but always thought it was missing a folder type tree component. I finally needed one the other day, and found other tree components that where too bloated, and not “in the spirit” on MinimalComps, so decided to make one myself. +1 for opensource :)

It inherits from the standard MinimalComps List component, so has basically the same interface. It also uses it’s own custom ListItem called TreeListItem. The data object you pass in is almost the same as the List, except each item object can contain and array of its children items, using the key “items”, and you can optionally set an “expanded” flag on any item. Expanded is set to true for each item by default.

[actionscript3]var treeItems:Array = [
{ label:’treelist_test_app’, items:[
{ label:’bin’, expanded:false, items:[
{ label:’js’, items:[
{ label:’swfobject.js’ }
] },
{ label:’expressInstall.swf’ },
{ label:’index.html’ },
{ label:’TreeListTestApp.swf’ }
] },
{ label:’lib’, items:[] },
{ label:’obj’ , items:[
{ label:’TreeListTestAppConfig.old’ },
{ label:’TreeListTestAppConfig.xml’ }
] },
{ label:’src’, items:[] },
{ label:’’ },
{ label:’TreeList Test App.as3proj’ },
] }

Then just create the TreeList like any other component.

[actionscript3]testTree = new TreeList(mainContainer , 0, 0, treeItems);
testTree.setSize(200, 200);
testTree.addEventListener(Event.SELECT, handleTestTreeSelect);[/actionscript3]

Once the component is setup, just handle the SELECT event just like you would with the List

[actionscript3]private function handleTestTreeSelect(e:Event):void
trace(‘TreeList select:’, TreeList(;

There are a few new methods to the TreeList, such as collapseAll(), expandAll(), collapseItem(item:Object), expandItem(item:Object), and toggleExpandItem(item:Object). They should all be pretty straight forward. To have a play and see what the TreeList is about, take a look at the quick example I made here : Adam Harte – MinimalComps TreeList test.

You can grab the TreeList and TreeListItem from my fork on GitHub for now (AdamHarte / minimalcomps – GitHub), but I am hoping it will be merged into the main repo soon. I think the TreeList will need a bit of real-world testing, but most of the functionality comes from the List anyway. Feel free to have a play and let me know if there are any bugs.


On-screen joystick with Gamepad-haxe

Only a few days after I tweeted about porting Gamepad over to haXe, I see a tweet from Philippe Elsass saying he has added an on-screen joystick to the library. This is great, because it was the next thing on my list after sorting out some issues with getting accelerometer data from my Android device with NME. Open-source is fantastic btw!

I just merged this update with my main branch on GitHub and had a good play, so thought I would give a quick run down on how to use it. Philippe has done a great job, so it’s pretty simple, but even looking at his code has taught me quite a bit about haxe.

First thing you need a Gamepad instance

[actionscript3]var gamePad:Gamepad = new Gamepad(stage, false, 0.4);[/actionscript3]

Then you need something to control with the joystick, a Car possibly:

[actionscript3]var car:Sprite = new Sprite();, 1);, -50, 50, 100);;
car.x = 300;
car.y = 200;

Before we can create the on-screen joypad, we need to get some graphics ready to use for the controls. We need a background and a thumb to touch or click on and drag around.

[actionscript3]var thumb:Sprite = new Sprite();;,25,25);
var bg:Sprite = new Shape();, 0.3);, 50, 50);[/actionscript3]

Now we can add the on-screen joypad and pass the gamepad, and the two graphic assets to it.

[actionscript3]var gamePadView:OnScreenJoystick = new OnScreenJoystick();
gamePadView.init(gamePad, 50, thumb, bg);
gamePadView.x = 440;
gamePadView.y = 330;

So now we have everything set up that we need. All we need to do is handle the update tick. The OnScreenJoystick needs its update method called to keep it in sync with the Gamepad. The OnScreenJoystick will automatically update the Gamepads properties, so we can use the Gamepad the same way we always do from this point.

[actionscript3]private function onTick():Void

car.rotation += gamePad.x * -gamePad.y * 2;

var carAngle:Float = -car.rotation * (Math.PI / 180);
car.x += Math.sin(carAngle) * gamePad.y * 5;
car.y += Math.cos(carAngle) * gamePad.y * 5;

Now when you run the app you should have a car that you can drive around with your on-screen joystick. Easy!

All this example code is either from Iain Lobb’s original Gamepad testers or from Philippe Elsass’ modifications for the on-screen joystick. You can have a play for yourself with the Gamepad example tests, or get the source, which comes with the tests.

Random things about stuff