Go to Mars already!
-
It's a sort of semi-realistic rocket game.
Share Code: CCZ63MND51
Right, I wanted to make a good and expansive version of basically this game for a while. However, recent events now compelled me to do a "that'll do" version with what I can cobble together in Fuze in about a week :) Some background: I'm a bit of a Space Nerd and fascinated by massive progress private companies are currently making, not limited to SpaceX, but certainly they are the most visible one. That image of the two boosters landing side by side in the Falcon Heavy test is forever etched in my mind as the first true glimpse of the glorious rocket future the 60s promised. And just now Orion started to orbit the Moon. It's back to the Moon, then beyond!
I'm not so thrilled about the Starlink and other superconstellation sattelites polluting the night sky, but I guess that was always going to be the price to be paid.
I'm even less enthusiastic about Elon Musk himself... the plan for this game formed pretty much as you see it now on Friday the 11th on a bike ride. That was after he fired half of Twitter's employees, after he ordered everyone else back into the office, saying he would not demand crazy hours, but before the ultimatum where he demanded they would need to be "hardcore" from now on or leave. Just for temporal context.
Anyway, to the game: You play as Elon Musk, flying one of his Starship rockets to Mars. A thousand different deaths await on the way. Ok, just three, really: Crash, burn or suffocate. But that should be enough. It is a cartoon-realistic version of what a real journey would look like. Things are definitely not to scale and accelerated heavily, orbits take just a few seconds.
(Tips and spoilers follow, you may want to stop reading here for now)
First, you need to get to earth orbit. Fuel is very tightly limited here, it's just about enough to make it. There are three main ways to waste fuel, two unavoidabe. The real goal of going to orbit is to go sideways fast. But there is too much air in the way. You'd just pump it all away, but that plan was rejected for some reason. So one way to waste fuel is to fly too low, fighting the air. The other way is to go straight up; then you are just fighting gravity and not making enough sideways progress. These two are the unavoidable ways, you need to balance them out and go just a bit sideways when low, and then more sideways higher up. The thrid way is to not fly your rocket straight. While in the atmosphere, always point the rocket mostly in the direction you are flying. Letting go of the control stick will do that automatically, but of course, you still should give it nudges to keep the rocket on course.
O yeah, a forth way to waste fuel is to ram your rocket face first into the ground before you used it all up. Avoid that.The next stages have you dealing with the oddities of orbital mechanics. As a help, your future course is plotted with dots, so you get some sense of what consequences your actions have. The weirdest part is the docking. Going to orbit has left you with almost no fuel, so you need to refuel at the depot. You start in a sligtly lower orbit than the depot, chasing it. You need to raise your orbit and meet the station, and not arrive with too much relative speed. Yes, the behavior of the ship is completely unintuitive, but that really is (qualitatively) what happens in low orbits. The rule really is: To go slower, accelerate.
Then, once fueled, it's time to leave Earth orbit and head off to Mars. Just follow the sign. Try which maneuver gets you out of orbit. Then try again, this time doing it at the right time so you leave in the right direction :)
Arriving at Mars, you find yourself on a collsion course. Avert that and enter a low orbit so you can pick a landing site. Getting into orbit is just the reverse of getting out of orbit. You'll need to let go of the controls for a few seconds for successful orbit to register.
Then it is time to land. Don't just point your engines towards the ground and try to break with your boost alone, you do not have enough fuel for that. Instead, use aerodynamics to slow you down first. The most basic method would be to just do a belly flop and put your bluntest side into the wind. It is smarter, however, to fly the rocket a bit like a Space Shuttle, nose raised about 30 degrees so you get some lift and don't drop so fast. Daredevils can try to first dive downwards, nose forward, into thicker atmosphere before pulling up and gliding for a bit (that bit would not work in reality, not with those tiny wings).
And then, well:
If you fail a level, the next attempts get slighly easier. Mostly, you get more fuel, but precision demands on landing and rotation speed when docking also decrease. Most difficulty variables are right at the top, feel free to give yourself infinite fuel or stop the mad spin. There also is a level select menu.
The code is completely horrible, nobody should learn from it. Again :) There are common reused bits, the rocket controls for starters, but given the vast differences between levels, almost each of them is a separate function. And because I'm currently transitioning over to Godot for hobby projects, which prefers snake_case for variable and function names, while everything I used before prefered CamelCase or didn't care, you'll find both. And there are global variables, for example the rocket sprite.
-
Ohhh this sounds awesome! I'm a huge huge space nut myself, growing up in the age of the space race and Mercury/Gemini/Apollo era really
sparked my imagination and love of space exploration. of course 12 guys walking on the Moon made me love it even more.I will try this as soon as I can but I have no Switch right now (some clumsy oaf dropped it down the stairs ..me)
-
Wow, I love this! Loads of fun and had me chuckling! I'm grateful for the level select because I got really stuck trying to get into Mars' orbit but was hoping to try out the inverse kinematics stuff at the end. Very cool
-
@SteveZX81 If you have a PC or Mac, you absolutely must give Kerbal Space Program a try then if you haven't already.
@kat Thanks. Ah, the inverse kinematics stuff is super fake and only sort of works by iterating over it multiple times. It is based on the function
function ik1(sprite, local_point, global_point_target, lambda) var a = getSpriteRotation(sprite) var s = getSpriteScale(sprite) var p = getSpriteLocation(sprite) var down = sincos(-a) var right = {down.y, -down.x} down *= s.y right *= s.x // p, down and right now give the sprite's coordinate system // transform local point into global point var global_delta = right * local_point.x + down * local_point.y var global_point = p + global_delta var other_global_point = p - global_delta // this point on the sprite, opposite to local_point, is supposed to move the least if lambda > 0 then var towards_target = global_point_target - other_global_point // new sprite rotation to bring local_point close to global_point_target without moving other_global_point var new_a = atan2(-towards_target.x, towards_target.y) - atan2(-local_point.x*s.x, local_point.y*s.y) // because angles wrap and we are going to blend them, bring a as close to new_a as possible by going // in steps of 360 degrees. This avoids sudden jumps. while a > 180 + new_a loop a -= 360 repeat while a < -180 + new_a loop a += 360 repeat // blend rotation setSpriteRotation(sprite, (1-lambda) * a + lambda * new_a) // I just realize this is wrong and would have bad effects for lambda close to 1. // what one actually would need to to is to recalculate global_point based on the new rotation before doing this. Oh well. var move = global_point_target - global_point // blend location setSpriteLocation(sprite, p + lambda * move) return global_point // also, returning where the dragged point ended up would be the more useful return value.
which grabs the given sprite by local point (in local sprite coordinates; {0,0} would be the sprite center, {-width/2, -height/2} the upper left corner, assuming you did not change the sprite origin) and drags it towards global_point_target. lambda says how much it is dragged, with 0 it is not dragged at all, with 1, it should be dragged all of the way. The function then returns where the dragged point started. I hope I got all of the signs right.
From there, ik2 is built, which drags two sprites together to fake a joint.
Also, an approximate ik1_dir exists, which drags a sprite in a given direction. That is used to pull the knees and elbows into shape and keep the head up.
One can make the joints behave less rubbery and stretchy by handling the user input (dragging the hands towards their desired positions) outside of the iterative application of the constraints, that gives the other constraints priority. But it's also much less fun.Key to the Mars approach stage is that only very little thrust is needed to avoid the collision if it is done early and into the right direction. Use the R/L 1/3 thrust buttons or a gentle touch on the analog stick.
For those who can't or or don't want to play or need some help, I uploaded another video with the rest of the game. I won't link it here because too easy access may spoil the fun for some, you'll find it.
-
I love it! What an amazing and unique game. And also very funny!
(I had the most trouble with the first level and must have tried that like 30 times or so before succeeding. )
-
@Z-Mann Awesome, thank you for the in-depth explanation! And for the Mars approach tip :D
-
@Z-Mann I have KSP on Steam, bought it years ago, sadly I'm too thick to play it, it's too complex for my feeble brain. :D
-
@vinicity Thanks! I'll take that as feedback to increase the fuel a lot more after failures. It should be tough and close, but not that frustrating :)
@SteveZX81 You should give it another got sometime. Depending on when you tried it last, a lot has improved even after 1.0. They have tutorials, explanations and practice scenarios now. Was there anything specific you bounced off of? What frustrates me most is the incredibly fiddly navigation node management, interplanetary transfers are just a massive chore. And the waiting even at maximum time acceleration. I also steer clear of the carreer mode where money matters; it puts too much pressure into the otherwise carefree game, and while there are always missions available that make easy money, it's just not worth the time. Science Mode is where it's at. That only slowly gives you new parts so you are not overwhelmed; at the start, you have just three parts that can build two possible rockets and basically just one mistake you can make. Of course, both numbers then increase exponentially with time :)
-
@z-mann I love this game! Huge fan of ksp, i have 500 hours in it but i still haven't made it to mars. The ui is top notch. Easier than learning ksp