6 ms·
Show HN: Voxel Lunar Lander in the Browser
- schoen 5y agoCool! Note that (on the map) it should be Mare Serenitatis, not Mare Serenitatus. Even though we have a stereotype of Latin words ending in -us, they can also end in -as, -es, -is, or -us, depending on the grammatical context. :-)
- NKosmatos 5y agoLooks nice! I’ll give it a try on my desktop, since it’s not iPad ready.
- JKCalhoun 5y agoBummer, I should have tried it on an iPad. I one packed away somewhere. If someone doesn't beat me to it, I'll get a fix in for that.
- snide 5y ago"I'm also learning Javascript" "There is nothing terribly complex about this algorithm — an understanding of basic trig is all that is required." "After a 30-year hiatus, back to writing shareware, ha ha." I LOVE seeing stuff like this. Keep hacking till the lights go out.
- deleted 5y ago[deleted]
- ArtWomb 5y ago1985 video games: defend earth from space invaders 2025 video games: deliver pizzas to the far side of the moon Space Truckin' by Deep Purple https://www.youtube.com/watch?v=hHOrpFeXUao https://www.youtube.com/watch?v=hHOrpFeXUao
- d--b 5y agohttps://en.wikipedia.org/wiki/Paperboy_(video_game) https://en.wikipedia.org/wiki/Paperboy_(video_game) :-)
- matheusmoreira 5y agohttps://youtu.be/_w1kG8z7bo8 https://youtu.be/_w1kG8z7bo8
- jeroenhd 5y agoThe touch screen controls worked better than I expected from a browser game, very nice! Too bad I'm no good at the game.
- peterpost2 5y agoDidn't work well at all for me in Firefox, worked a lot faster in chrome. Wonderful game in Chrome though!
- dotancohen 5y agoSame experience with the most recent versions of both on Kubuntu.
- yetihehe 5y agoSame, but was fast at first and slowed to 1fps before reaching nearest base. Both in firefox and chrome.
- JKCalhoun 5y agoI have no idea why. I have seen that on Chrome (not as bad as 1 FPS though). If I refresh upon landing, it's back to 60 FPS. I don't see this on Safari.
- yetihehe 5y agoWhen I tried to profile it, everything went too fast. Previously, going from PRB to PTO was several minutes, after I enabled profiling in firefox, it took several seconds (first 2 times I've crashed, because it was too fast for me). It was fast up to end, but when I was near PTO and about to land, everything slowed down and I had consistent 830ms per frame. I'll try to check later when I'm back from work.
- yetihehe 5y agoMeh, now it works too fast, almost unplayable, I can't even steer properly, one keypress and speed is already +4. I believe it's after some change in code.
- redeyedtreefrog 5y agoI like the style, design and sound effects, but as someone who is not especially great at computer games, and trying this out as a coffee break game, I found it pretty unforgiving: - it initially took me maybe a minute just to work out that the things on the display were craters, not bases - having worked out how to find a base, I made several journeys (each a couple of minutes) to get to one, but each time either crashed or landed short. When I landed short I then always crashed in my attempt to shuffle along a bit further. - I'm not sure exactly which bit counts as the landing zone? initially I was hampered by not realising you have a separate display of the area directly beneath your craft, maybe it's more obvious if you use that. - I then practiced landing on the starting base for a bit to try to work out the max allowed vertical + horizontal speed. I think maybe the vertical speed is approx max -8 or something, or at least seems pretty forgiving. Meanwhile I think possibly the horizontal speed maybe needs to be exactly 000, and that arrow next to 00 isn't allowed? Ran out of time for further experimentation. - If you land on the starting pad you get a message congratulating you on landing but I can't work out how to close the message (other than refreshing) - I then had several more attempts at flying to another base, and crashed several more times, as well as landing short several more times. - when I eventually landed on another base, nothing happened and I wasn't quite sure what to do next. Did that count as delivery? Do I just keep flying between bases?
- JKCalhoun 5y agoI had worried this would be a difficult game. I had a few people try it and they were happy to land at all! But to your point, yes, you cannot really be sliding sideways and land successfully. The controls will stop thrusting when you reach a horizontal velocity of zero though, so it is easy to "stop". When you land right in the middle of the landing pad (cross, square, whatever shape) you'll be lowered down to the base. My best guess is you're not within the landing zone. (Or there's a bug I have not seen.) There should always be a closing box for the alerts though. If you can take a screen grab and open an "issue" I'll see what I can do. EDIT: Seeing a bug show up in my code on Firefox. I'll see if I can quickly patch. Looked like I was assuming I would get a value from LOCAL STORAGE. I should have tested by blowing away my storage. See if it works for you now.
- moffkalast 5y agoVery KSP-esque, except there you usually have only one engine to work with har har. Is the vertical velocity in the same units as altitude? Seems like I can get like 5 m/s downward speed and altitude barely changes. Or is it set up as one or two decimals less?
- JKCalhoun 5y agoI used made-up units (and they are not even internally consistent). I was more concerned about providing enough resolution to help the player but limited by 2 or 3 digits (Nixie tubes) — I was less worried about being consistent. You caught me, though.
- jstanley 5y agoI was confused by the units too. I like to mentally estimate how long it's going to take me to reach a certain altitude, for example, and the units displayed on the console didn't make sense to me. :)
- JKCalhoun 5y agoI'll fix it, find a consistent scalar. I really didn't expect people to be "doing math" playing the game, ha ha.
- jstanley 5y agoI think your problem is that some people want to view it as a casual fun video game, and some people want to view it as a LEM simulator. The first group find it too hard and the second group find it too easy. In case it helps: I would expect the rate display to be in units/second or units/minute, in order to estimate an amount of time in a useful way.
- deleted 5y ago[deleted]
- freediver 5y agoVery very nice vibe! Kind of Elite-esque. I carried the first cargo to PTO and landed there but nothing happened. Was there I was supposed to do?
- JKCalhoun 5y agoMy guess is you didn't touch down in the base center. Care to make a screen shot and open an issue? At the very least I should let the player know they are off by a hair on the landing (if that turns out to the the case and not just a bug).
- FabHK 5y agoSame here. In MoonDebriefState.js, the marked line errored out, because departedLocation was null. var departedLocation = LunarFeatures.locationForBase (baseDeparted); > var deltaX = departedLocation[0] - _base.loc_x; < var deltaY = departedLocation[1] - _base.loc_y; _distanceTraveled = Math.floor (Math.sqrt ((deltaX * deltaX) + (deltaY * deltaY))); (Safari 15.4 on macOS 12.3.1)
- JKCalhoun 5y agoI should have just fixed this if you refresh. There is a value I expect to find in LOCAL STORAGE that is null when you first try play the game — I was not allowing for that. I should have know to blow away local storage when testing. Since I have been developing it, of course, at some point that value was added to my local storage and I was free to write all manner of bugs that assume it is there.
- FabHK 5y agoWorks!
- freediver 5y agoAnother way to handle this is to count every landing outside a pad a crash landing.
- marcuskaz 5y agoThis one is fun, the original Atari Lunar Lander in browser http://moonlander.seb.ly/ http://moonlander.seb.ly/
- JKCalhoun 5y agoThank you. Very badass. Probably the "simulator" that got lured me into writing computer games. I remember playing this in an arcade with the big throttle lever and rumble of the engines.
- JKCalhoun 5y agoIf anyone is actually able to land at a base (and is lowered down to be refueled etc.) let me know. The game is looking to be either too hard or has a serious bug. (And I'm not sure which is preferable.) EDIT: looks like it was a bug (fixed now?). Of course, it occurs to me that it might also be too hard of a game — that both the above could be true.
- cloin 5y agoI just get a welcome message about a smooth landing and nothing further.
- JKCalhoun 5y agoHopefully I just fixed this. Maybe try to refresh.
- jstanley 5y agoIt worked fine for me.
- peterpost2 5y agoOn GitHub they mention that this issue has been fixed just now.
- anotheryou 5y agoWhere shall I go though?
- JKCalhoun 5y agoHidden feature — scroll down, there is a map and brief directions below the game.
- jstanley 5y agoCool game, but it has a pretty egregious physics error. It seems like the velocity vector of the craft always points in the direction you're facing. If you rotate the craft, then the velocity vector also rotates. It's like it's cornering on rails. This makes the game much easier than it should be. In reality, if you are travelling forwards at some speed and then rotate the craft to one side, you'll still be travelling in the same direction as before. The world you see out the window will appear to be flying past sideways, because you still need to cancel out your previous forwards velocity.
- JKCalhoun 5y agoYou're kind of right. I didn't want to make the game even harder than it already is but there is a fuel penalty involved for moving forward and turning. The moon craft is applying the correct horizontal thrust to allow you to "corner on rails" but subtracting that thrust from your fuel. You notice if you have no horizontal movement, yaw takes negligible fuel: a short burst rotates you and you can indefinitely rotate without additional fuel. The instant you have a horizontal component, there is a continuous fuel penalty as you rotate — because, as you point out, an additional velocity vector is required to keep you both moving forward and turning. It's much more fuel efficient to establish the direction you want to fly the craft before applying forward thrust.
- jstanley 5y agoAh, good to know it is correct internally!
- matheusmoreira 5y agoWould be amazing if you could turn this maneuvering assistance off! On kerbal space program, I can lower my periapsis until my orbital trajectory intercepts my target and then allow gravity to take me there. I always keep the ship pointed retrograde in order to control its speed.
- burlesona 5y agoThis is very cool. I was able to take off and get to another base... but it doesn't seem to be the right one. How do you see what your destination is supposed to be?
- JKCalhoun 5y agoWhen debriefed, you are given a rough heading for the near bases. You can decide on which base you want to head to, remember the heading. But you can cheat too: scroll the document window to reveal a handy map of the bases. I can hold my finger out to approximate the angle to where I want to go — scroll back to the main screen to set my heading to be at the same angle. (In fact though, it doesn't matter which base you go to. I guess everyone is happy with whatever you happen to land with.)
- ALittleLight 5y ago~~I landed at a different base but all that happened was I got a welcome message.~~ I guess I just wasn't landing precisely enough on the target. I set down on the glowing lights and got the welcome message, so I assumed I had done it correctly, but if I land very exactly on the shape in the center of the lights then I get taken in for refueling.
- FabHK 5y agoFun! Made it from CRI to CAP with 2% fuel remaining :-) I fly like this, any suggestions? - decide which base you want to fly to and rotate your craft in that direction. - blast off until V-speed of +40ish, while simultaneously going full forward (unless you have a mountain just in front, obviously, as for example when you fly from PTO to PAR, or MAG to PRB). H-speed cuts of at 30 automatically. - that should take you up to around 70 [units], cruising full forward. That seems to be high enough to avoid obstacles. - when V-speed drops to -5, take it back up to +5, in other words, 0 +/- 5. - observe the map, and when the base approaches, correct the heading. - at some point now, you should see the base lights in the window. Aim there. - don't decrease horizontal speed prematurely, it'll cost you fuel to stay up. And don't decrease altitude prematurely, it'll make it harder to see the base in the scope. - consider the cross on the map as a distance measure. When you are two crosses away, start taking H-speed down slowly. When you're one cross away, H-speed 10 works. - once you see the base in the scope, you can do fine-tuning, arrest H-speed, and descend. As JKC mentioned, avoid any horizontal speed when touching down. Try to keep V-speed > -5, at the latest when the ALT light turns on. (Touch down V-speed > -3 is very smooth, > -6 is ok, < -9 is a crash.) - rule of thumb: keep V-speed > -altitude.
- JKCalhoun 5y agoMy thoughts are, going too high is a waste of fuel (in addition to getting up there, you have to brake coming down). Full forward velocity as soon as you can — slow only when closing on the base. (Faster you can get to your destination, again, less fuel needed to stay aloft.) It is not unusual for me to land with empty tanks. As long as you have stopped horizontal velocity, it is somewhat forgiving vertically (I suppose the landing shocks are well engineered). BTW, the landing gear on the Apollo LM employed a collapsible honeycomb that absorbed energy by being crushed. Of course, works only once. The X-20 Dynasoar was to have a similar shock absorber for landing — some sort of metal tensioning wires that took up energy by being stretched. I was trying to straighten copper wire (the kind you run in your home) by holding one end very firmly in a vise and then putting my strength into pulling on several feet of the wire with a pair of vise grips. It was hard to pull, but there was a fascinating moment when the wire "gave" and I was able to stretch it an inch or so at which point I was unable to stretch it any further. Straightened the wire for sure. But what an odd molecular dance there must have been going on within that copper.
- imglorp 5y agoMinor UX bug: I did not realize holding the spacebar was how to thrust. I tapped it once to launch, it lifted and sat back down, and sent me to the "Welcome back!" screen!
- bambax 5y agoMinor nitpick: when asked to press Enter, only the main enter key is accepted ("Enter"), not the enter key from the numeric pad ("NumpadEnter"). Both keys share the same key code 13.
- JKCalhoun 5y agoI'll fix that. I am using some sort Javascript key bindings that are using key codes rather than ASCII (so NumpadEnter is of course something else).
- Nihilartikel 5y agoWow! I was very pleasantly transported back to the voxels of 1992 playing Comanche 3D.
- emj 5y agoI get better framerate by zooming in and out with ctrl-/+ Looks nice very cool flying over that terrain. I wonder if it would be better with higher resolution I'm guessing if the graphics is better you get the uncanny valley problem.
- goodpoint 5y ago2022 and a game with a handful of polygons makes my new laptop spin its fans at full speed.
- yetihehe 5y agoYeah, compare that to optimised version for Amiga 1200, what could be done with 14MHz processor, 2MB of ram, watch first minute: https://www.youtube.com/watch?v=q0QonT359uI https://www.youtube.com/watch?v=q0QonT359uI This version could of course also be optimised, but don't expect top-notch optimisation from a learning project. It's still pretty nice and it works!
- goodpoint 5y agoIn fairness, demos are exceptionally optimized so I would not use them as a comparison. Yet, we are talking of 30 years of hardware evolution here (The Amiga was from 1992) to get the same performance. This is comically bad. (I'm not blaming the game itself, but the software stack)
- yetihehe 5y agoSoftware stack is not that bad, you can write naive algorithms in all languages. Typically just eliminating some inner loop calculations (like VoxelCanvas.js line 189 should just be a single addition) can give you double digit percent speed boost. I believe there are many more optimisations just waiting to be employed, but like I said, this is a toy project in a "hey look, it works" stage, it's very nice already.
- User23 5y agoYou wouldn't happen to be the John Calhoun who created the absolutely charming classic Mac game Glider[1]? I got many hours of enjoyment from that game. [1] https://en.wikipedia.org/wiki/Glider_(video_game) https://en.wikipedia.org/wiki/Glider_(video_game)
- freediver 5y agoOk a fun challenge: make the first jump to PTO and land with as much fuel left over. 222 record so far.