Lunar Lander 3D in 5K

Remember Lunar Lander? One of the very first arcade games ever? Well, actually, if I’m honest I don’t really remember it when it came out in 1979 (I was only 7 at the time), but I do think it’s a very, very cool game.

lunarlander original

For starters, the display didn’t use scan lines like a normal telly, instead, the cathode ray moves around to make shapes, the same way that laseriums used to make pictures with lasers. (If you don’t remember the 80s you’ll probably have no idea what I’m talking about).

Secondly, it’s actually very, very difficult. So you feel a real sense of achievement when you actually land the thing safely! I was actually lucky enough to see an original vector based arcade cabinet, and the thing that immediately strikes you is how bright the screen is, and how beautiful those glowing lines are.

Sadly, Lunar Lander had a fairly limited life when it came out. It was quickly superceded by perhaps the most famous vector game ever, Asteroids. In fact most of the early Lunar Landers had their insides unceremoniously ripped out and were converted to Asteroids cabinets, so they’re pretty rare now.

A few years ago, as a tribute to the early pioneers of arcade gaming, I decided to recreate Lunar Lander in Flash, with painstaking attention to detail and accuracy! And what did I do to celebrate this great achievement? Did I shout about it from the rooftops? Did I post it on the internet for everyone to share and enjoy? Did I write a blog post about it? Well actually no, I just sat on it and it’s been laying there burning a hole on my hard drive all this time.

My flash Lunar Lander
My flash Lunar Lander

But don’t worry, you can now play this online here to your heart’s content. Use left and right arrows, and up arrow to thrust. It’ll take a little effort to get used to, but that’s half the joy. 🙂

But that’s not what this post is about. A local Brighton geek group, £5App decided to run a 5KApp competition, where you could submit any program that was 5120 bytes or less. And you were allowed to use Flash, so I got going to see how if I could make a Lunar Lander clone within the file size limit.

I’d worked out how to use Perlin noise to create a 2D landscape and got pretty much all of the physics and collision detection working, but I’d only used about 3K.

So to make it a bit more interesting, I decided to add 3D! To create the landscape I used the same Perlin noise image to store all the data, and drew the landscape in strips from back to front, with a very basic 3D to 2D formula, and before I knew it I had 3D Lunar Lander!

Lunar Lander 3D in only 5K
Lunar Lander 3D in only 5K

My final submission was 5118 bytes, only 2 bytes under the limit! Interestingly, swfs seem to fluctuate by a few bytes every time you publish them. (My theory is that it embeds the time and date?). The one I’ve posted here on the site is exactly 5120 bytes!

Just like the original, it’s very, very difficult, use the arrow keys to move left, right, forward and back, and the space bar thrusts. Look out for flat landing pads of 4 lines, and head towards them. You need to go in really close, and you’ll know you’re over it as the land turns white when you’re directly over it. And you need to land right in the middle of the 4 lines, and very, very gently! See the playthrough video if you need more help.

Despite some stiff competition from the Brighton geek community, this was voted the winner! And the prize was exactly 5120 pence. So I went and bought everyone a drink with it.

It’s actually been really fun, and it’s given me a lot of ideas for future projects. I’ll post up the source with a bit of explanation soon, but for now you can play the game here.

[UPDATE] There’s now an even cooler version of MoonLander3D especially for the 40th anniversary of the Apollo 11 moon landing. Read all about it here.

Papervision3D session with Carlos in London

I’ve been back from honeymoon for a couple of weeks, and I’m finally getting back into the swing of work! There have been a few developments, more of that soon, but first of all I just wanted to let you all know that myself and Carlos will be presenting at London’s LFPUG on 29th April.

Believe it or not over 100 people have already signed up for it, but I’m sure Tink and his friends will be able to fit you in.

I’ll be showing you how to get started in Papervision, and I expect I’ll also be talking you through our latest project for the BBC, Big and Small, which is such a huge project I feel like I should devote an entire blog post to it soon!

Papervision3D founder Carlos Ulloa will be headlining with an hour full of the tricks and techniques behind his new business venture HelloEnjoy.

“The session will focus on the techniques, workflow and planning necessary to overcome the creative and technical challenges of real time 3D in Flash, giving an inside view of the entire creation process, from concept and planning, to development and art production.”

Get yourself over to LFPUG and sign up if you’re interested in coming!