Categories
General

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!

https://vimeo.com/4319384

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.

55 replies on “Lunar Lander 3D in 5K”

Awesome work. I’m a big fan of the original, used to play it in arcades, the thrust controller was a big analog lever like the one you use in flight sims. Can’t believe your 3D version is just 5K!

Wow, really great work Seb. Took me a good while to get a perfect landing. Amazing that it’s under 5k too. I can’t wait to play around with the source, I’m thinking up some interesting ideas already…

Aww. This doesn’t seem to run under OSX. I just get the lander bobbing back and forth, no controls, no land, just the lander itself.

Bummer, too, as I do loves me some Lunar Lander.

Hey — never really got a chance to play the original Lunar Lander, so your 2D clone was great! I think I got 1880 my first try. My only complaint was that after the game ended, you have to know to look at your score real fast before it disappears; I’m lucky I had just glanced at it.

Anyway, thanks! Very pretty 3D version.

You’ll be amazed to know this, but flash actually compiles your variable names in full in to the swf (which can be easily verified with any decompiler). If you want to shave bytes, make all your variable names 1 char. I believe function names are automatically stripped though.

Works fine for me in OS X.

Excellent work, although the game is super difficult. 600 fuel?!

Wow, I’ve had a pretty amazing response to this so far with over 10,000 hits on this page just this morning!

@C4RL05 Thanks Carlos! I must admit I’ve never played the original, and didn’t know the thrust was analogue. Makes me wanna play it even more now!

@A Single Pixel I did REALLY love Thrust, that’s really what I remember playing on my Acorn Electron, way before I ever saw Lunar Lander. I was always really impressed with the physics on Thrust, particularly when you’re carrying the weight.

@spoons, that’s weird, it was built on an OSX machine! I did find sometimes in the standalone player it failed to pick up keyboard input, but I’d just click in and it seemed to work… let me know if you continue to have problems.

@Andy I did know that actually, although I found that shortening the names of constants didn’t seem to help much (which is logical). I prefer readable code though so you’ll see that most of the variable names are fairly decipherable!

@ everyone else, really glad you like it, thanks for the positive feedback!

SEB……

Dude, check it out!

Your game rocks! I was looking on the net to buy the old arcade version when I came across this website….wow…..I’m LOVING IT!!!!!

I used to play this game all the time as an early teen and was a natural….setting high scores was the norm. By the time I was 16 they were gone. I’m now 44 and just played my first game in nearly 30 years and enjoyed it immensely. I think my best score was 4800 after about 15 – 20 tries.

I was shocked to learn you had not played the original so let me tell you what I miss about it compared to your awesome remake.
1) The thruster was a great big flight-simulator sliding lever that gradually built up resistance and thrust the further you pushed it. You could hold it at half throttle and just hover perfectly still.
2) The original had different planets you could go to with varying difficulty and additional gravity. Many planets had landig pads that were upside down and upside down but diagonal. It was such a thrill to land on the upside down landing pads because the gravity is upside down too and it takes a strong mind to overcome that level of difficulty. Those high dollar landing pads were my bread and butter….elevating me to the tops of the leaderboards. A couple planets had a corkscrew type landscapes that were a blast to negotiate through.
3) I believe there was a separate button for a 3 sec throttle overboost that instantly engaged extra boost that is 2 or 3 times more powerful than normal and could keep you from coming down too fast and smashing into the rocks….it burnt fuel twice as fast but on planets with xtra strong gravity….the feature was a life saver.

Drop me a line if you ever try to make an even more ambitious re-creation….LOVE YOUR GAME!!!! THANKS!!!!
Robert

powerofsubpoena@hotmail.com

[…] it to run in your space-faring, jet-pack-toting browser-of-the-future. Current darling is the 5k Lunar Lander, where Seb Lee-Delisle shows off by doing first a straight remake and then a 3D version in under […]

This is absolutely brilliant. Thanks so much. You can an original being played very badly in this video: http://www.youtube.com/watch?v=uJLmXildv2E

I dropped more quarters in that damned machine than this quad-core, 4GB, dual GeForce, 4TB RAID-5 machine cost me. The thrust was analog, the trick to it was to float far for a 5x landing spot, decelerate slowly, and if you scored well the first few times you could afford the fuel expenditure to find the best spots downfield, get over them and hit the Abort button to position yourself perfectly over them, only thrusting gently to land at under 15fps.

Great development! I played asteroids and also a Star Wars vector arcade in the 80s but found this one later. There is an old Java applet version here http://www.frontiernet.net/~imaging/lunar_lander_game.html

However, I think the physics law in your version is less realistic. In space, tilting a ship does not make it move in that direction like a plane. The Java version is more realistic (very simplified but tells the idea): rotation engines (controlled by arrow keys) just rotate the ship around its center of gravity (apply torque), and the main engine just applies a linear force. Also your version stabilizes to an upright orientation if you hit no keys, like some planes do. That doesn’t happen in space: ships remain upside down if you don’t apply rotation forces (actually remain rotating unless you counter-react).

Aargh, this is addictive!

I played the original when I was a boy and was obsessed with it- I still have notebooks from elementary school with my hand-drawn lunar lander doodles.

Thanks for reviving a neglected classic- it plays as well as I remember the original!

Original Lander game physics are something like:

Position=Position+Velocity;
Velocity=Velocity-Gravity;
Velocity=Velocity*DampingFactor; (DampingFactor 0.9 if u like damping )
when u press thrust Velocity=Velocity+(ThrusterDirection);

Great Job,

I think in the original game the vertical speed up and down was much faster. I remember that I would intentionally go as high as I could and then rocket down really fast for a crash landing…such fun

That was so sweet bro! I really appreciate your writing style and originality. Congrats on winning too!

I programming a full landscape 3D lunar lander on the ATARI ST, entirely in 68000 assembly. It even had a particle system for the thrust, and controlled by the mouse. I really need to digg this out! I love lunar lander. It’s hard to describe how playing orginal in the arcade was – truly amazing. It had a giant thruster handle, and booming thrust sound. The glowing vector graphics, well just took you there – very engrossing game.
Not many versions seems to have the playability factor thatn the original – the thrust on there seems spot on.

[…] come to the modern 3D recreation, The modern 3D version of Lunar Lander was created by dude named Seb Lee-Delisle who is a die hard fan of original game. He has created a excellent Flash recreation of the original […]

Very nice and well done to get it into the 5k. Very impressive. I’d better not talk much about the first lunar lander we used to play on the Teletypes. Text graphics only, but just as addictive!

I have to say I’m absolutely overwhelmed by the response to this post, I guess Lunar Lander has a massive underground following that I was simply not aware of!

But I find it heartening that I’m not the only one to love this game 🙂

@ReallyEvilCanine thank you so much for the link, believe it or not this is the first time I’ve properly looked at one of these. It’s really hard to recreate that analogue power drive with a computer huh?

@Shabtronic yep that’s what I implemented (from memory)

@Alvaro thanks for that. The Lunar Lander recreation is pretty much as the original, which does have linear dampening (which obviously wouldn’t happen in the vacuum of sapce!) but makes it a better game. I realise that the physics isn’t exactly realistic in the 3D version, but my aim was to make a more accessible version. I would like to make the animation a little more realistic, but hey I only had a few hours and 5k to make it 🙂

@Jakob Stoeck Still not seeing that. I’ll change the embed code to use swfobject and see if that helps.

@Joshua Nelson we made a very close copy of Space Invaders a few years back (see if you can find it on the lab page on http://pluginmedia.net), lots have people have made asteroids but none are especially authentic. Perhaps that’ll be my next project 🙂

@memo love those links, thank you! I should also credit Keith Peters (http://www.bit-101.com/blog/) for inspiration on the 3D landscape!

@Christian it’s Spacewalk by Lemon Jelly

@Hal good idea, although I’m sure Atari would have something to say about that 😉

@Haniff Din 3D on the Atari? That’s impressive!

@Jeffrey @steve @jamesthompson23 @Panta @John Davis @Ian morton Thank you I’m very pleased you’re enjoying it!

Your swf doesn’t play in a debug player:

VerifyError: Error #1033: Cpool entry 88 is wrong type.
ReferenceError: Error #1065: Variable MainTimeline is not defined.

From What I can tell, great work! …But super-sized bummer for me! LL3D won’t work on my Intel Mac: OS X 10.5.6, 4 GB RAM, 2.8GHz Intel Core 2 Duo. Safari Version 3.2.1 (5525.27.1), Flash 9.0 r151

For those having problems, I went to Adobe’s website and upgraded to the current Flash Player from 9.0.151.0 and now the game is working fine for me.

Thanks for a great game! My high score is 4600, which I believe is impossible to exceed.

Seb, I attended your session at LFPUG where you discussed how you created this. Great work and great presentation, look forward to seeing you down there again in the future.

That’s strange it seems ok to me… the site has been having outtages so that could have screwed things up… could you try again and if it still doesn’t work could you let me know your browser/OS etc?

thanks

Seb

Stumbled on this. Awesome little thing, super fun. I learned to land very well. I wish there was some way to just fly around there indefinitely without running out of fuel though.

(wish i could edit comments) sorry for the double post, but the 2d one is awesome as well. Just played it, landed first try 🙂 I have to play that one some more.

I’ll post up the source with a bit of explanation soon

Any chance we can get our hands on it?

Cheers

@SenatorPalpatine what would the fun be if you had unlimited fuel? 🙂 You’re right though, I should make it so that you get fuel for a successful landing.

@Neil good point! Maybe I’ll do it in time for the 40th anniversary of the Apollo moon landing 🙂

Nice work! Does it have a MacDonald’s stand buried in it somewhere (haven’t found it yet).

Still remember playing this on a PDP-11 back in the day. Managed to destroy a few MacDonald stands – never did land next to one.

Would love you to port the original game over to use on the new palm pre. Would be great to use the accelerometer
to control the left right and possibly the thrust as well!

If you don’t want to port it, would you be averse to releasing the source code?

The original came out way before 1979 – I was playing it in college in 1970-71. Maybe the original came out in 1969? Marvelous job of duplication, absolutely marvelous. In the original, you had some control over gravity levels and speed at time of opening, I forget details, tho.

Super, thx.

Hi Seb
I can see you are already getting a lot of praise for the programming
I would just like to add my own to the HEAP (if you will forgive the
pun) – it really is an excellent rendition of the original arcade game I
used to play back in the early 80s made by Atari.

I think that entertainment aside programming needs to be dual
purpose – it needs to be fun and it needs to have an educational
element as well.

The US has always been a world leader in software development and
has contributed greatly (in unexpected ways [Kernigam and Ritchie
at AT & T developed Unix out of a game called Space Travel] and the
ways can lead to and open up truly amazing landscapes for other
applications. So I think your creation or duplication – whatever you
want to take is as inspirational as it is elegant.

Bye

nice version. the original had an abort button that would upright the lander and engage a full burn for 10 seconds or so and put you far above the moon. you should consider adding it.

[…] Lander 3D. What it lacks in gameplay it makes up for in eye candy. You may want to go here for background and a video on how to play. Good stuff for under 5KB tho. This entry was posted in […]

Great job! I remember this game from American arcades in the 70s. Always sucked at it. Here’s my chance to improve my skills without blowing all my allowance. Thanks!

Hi Seb,

Just to add my congratulations for the construction of a great tribute to the Lunar Lander classic that was in the arcades when I was a kid.

As an added bonus for some reason my work’s firewalls don’t identify it as a game so I can play it with impunity on my breaks 🙂

The original game was hard, but the chunky throttle lever really set the game apart from its rivals. Next up see if you can recreate the Battlezone tank combat game…

Once again, thanks for a great trip down memory lane.

Your swf doesn’t play in a debug player:

VerifyError: Error #1033: Cpool entry 88 is wrong type.
ReferenceError: Error #1065: Variable MainTimeline is not defined.

I found the same problem

I played the game in an arcade. I might be wrong, but wasn’t there an ABORT that put you straight up at high rate of speed but burned a lot of fuel to save yourself from being a 2 mile crater

Comments are closed.