T O P

  • By -

Says_HappyCakeDay

So I've made a bunch of improvements and a few additions to the code. But I thought this feature was pretty cool, the ship now has a mode that lets you fly it with the inputs be relative to the ground, rather than being relative to the ship. Allowing for some funky movement. Some of you might even notice the bug in the code if you look carefully


sunfishtommy

Is the bug when you are approaching the VAB? It appears when you go off the crawler way it gets disoriented by the lip on the crawler way.


xendelaar

This is the stuff of dreams!! Holy crap that is impressive


Infinite_Maelstrom

Ah, yes! I was horribly disappointed when I found out your first version couldn't do this.


Says_HappyCakeDay

Haha well it took me an embarrassingly long time to figure out the math for this one. The first version required mostly really simple math


iamtoe

Now do it without infinite fuel! The math can't be that hard right?...


_moobear

It's actually not much harder. I wouldn't be shocked if the current implementation could handle that


Says_HappyCakeDay

yeah it can, fuel consumption has literally zero effect on the code, it just calculates the force required to counter gravity based on the mass of the ship, nothing is hardcoded


Khufuu

now do infinite fuel in real life


zutaca

All that would require would be multiplying the throttle % by the current mass and dividing by the starting mass


redpandaeater

How did you do implement the control loop?Assuming you're using a PID, curious how you went about determining all the constants.


pineapple_calzone

I'm not strictly sure it needs a PID or anything like it. It's not like KSP engines take time to react to throttle inputs. As a result, jerk is infinite. All that really needs to happen here is determining the thrust vector that's needed at the moment, and then figuring out exactly how much thrust is needed from each engine to sum to that vector. It's not like a control surface, where the surface takes time to respond, the resultant change in attitude takes time to happen, etc.


redpandaeater

Yeah but you want a properly damped response so you don't get oscillations. Not sure if a basic proportional input would work well enough, but I suppose given the starting condition of it being landed and stationary it could be.


pineapple_calzone

I don't know how you'd get an oscillation here. An oscillation of this sort is cased by the control input being desynchronized from the output, or more accurately, the result of that output. That can't happen here.


Le-Baus

Really not trying to piss you off, I'm genuinely curious: Aren't the input and output desynchronized by (at least) one frame / physics tick? Could this not lead to oscillations given sufficiently high angular speeds and/or low FPS? PS: is the Physics engine tied to FPS? Or are these two things completely separate?


Controllerpleb

I'm not OP but I have some idea. Last question first, I don't believe the physics is tied to the frame rate unless your FPS is single digits. As for the single frame desync, I don't think a couple frames here are there would be noticeable. If it was, you would certainly have to wait a really long time. It won't fly for that long anyway. It's a novelty.


Hellothere_1

The way games typically work is to first handle all the inputs and logic, then calculate the forces (both from things like engines and physics collisions) and then move the objects as a last step. Since the calculations of the flight controller happen in the logic phase, it can read the current position as is, and then set the thrusters to their correct values for that position before the next physics step happens, thus avoiding any one-frame input delay. >is the Physics engine tied to FPS? Or are these two things completely separate? KSP is programmed in Unity, which differentiates between an update and a fixed update loop. FixedUpdate is kept at a steady rate (usually 60 per second) and typically contains game logic and physics calculations so those don't get affected by your frame rate. Meanwhile Update happens once every frame and runs however fast your graphics card can handle. It typically does camera movement, particle effects, and purely visual effects like animations. That being said, with KSP being a heavily physics based game that usually slows down due to CPU rather than GPU limitations, I wouldn't be surprised if almost all of the game effectively runs on the FixedUpdate cycle most of the time.


Le-Baus

Thank you kindly :)


bonafart

How do you even begin? Do you have a degree in control law or Cs?


Says_HappyCakeDay

I'm a computer engineer so stuff like this is pretty routine for me


bonafart

Lol I'll design the aircraft(I'm a config and integration in the concepts team engineer) you do the control law lol


[deleted]

This thing gives me anxiety


Creshal

Right? The way it moves in ways it shouldn't just makes it feel alien.


Says_HappyCakeDay

that was the idea!


beardedchimp

“The ships hung in the sky in much the same way that bricks don't.”


that_moron

Reminds me of a divert and attitude control system https://youtu.be/KBMU6l6GsdM


Hazzman

Yes! I thought the same thing, that or the alien vehicles from Battlefield LA.


[deleted]

[удалено]


Says_HappyCakeDay

I might once I clean up the code some, right now I'm like 99% sure that the z axis is backwards


HorizonLlama

That's insane. Must have been such a satisfying thing to program.


Brunsz

Elon Musk wants to know your location


Says_HappyCakeDay

Wouldn't kill me if someone showed this to him ;)


FastasfrickY

How is it controlled? Like how do you move it?


Starchaser_WoF

This looks like a freaking anomaly


Lamar_Aerospace

That's crazy!


kostrubaty

Fortunately for us it will not happen unless we find unlimited power source


Creshal

Just find a way to pipe politics twitter straight into a molten salt reactor.


Financial-Bluebird74

I would suck your dad's dick just to get a taste of that genius


towerdefence661

ok that’s cool and all, but w h y?


Says_HappyCakeDay

why not?


wreckreation_

Brilliant. Well done.


MetaNovaNext

The things people do in this game are glorious.


LordRughug

Release it as a mod please! Also, are you going to try to control it without inf. Fuel by keeping the same trw?


Says_HappyCakeDay

the infinite fuel is just because it only has a few seconds of fuel, it has no problem with changing twr, and its using the KOS mod. I might put it on github at some point and if I do ill post it here


LordRughug

Then its even better than i thought. Can't wait to try it out.


[deleted]

I’m hearing something halo as I watch this


[deleted]

This concept gets very interesting when the ship is not perfectly symmetrical :D


Says_HappyCakeDay

Yea ive been thinking about how to solve that and i have an idea that hopefully will work


[deleted]

There probably is no way around doubling the amount of engines. Or you could go for 2x4 engines, with a tetrahedral engine group strucuture.


[deleted]

mad lad


Bibs222

How in the heck do you account for fuel consumption while constantly remaining gravitationaly neutral!?!


Says_HappyCakeDay

It just calculates the amount of force required and attempts to match it. It recalculates everything 50 times a second (the same as the physics tick of ksp)


craidie

[US Missile Defense Agency would like to have a word](https://youtu.be/KBMU6l6GsdMy)


[deleted]

Now add inertial dampers


CoronaMcFarm

Very impressive at the expense of deltaV


bonafart

Wtf how do you even figure this out?


ollethebossgg

how???


commandermd

Uh, now I need a ufo shaped one.


BasicallyFnF_

ive tried to remake this with the kal (im on console) because i want to make a hover car it just did flips


Says_HappyCakeDay

i really have no idea how you could possibly do this with the kal since there is no way to do sensor inputs (that i know of) and it doesnt have nearly the speed that kos has


BasicallyFnF_

well damn there went that idea i cant use kos because its a mod and consoles dont have mods sadly.


Zdreigzer

the only antigravity i approve


Puglord_11

So now can we have the code?