Giter Site home page Giter Site logo

Comments (10)

GraemeWilde avatar GraemeWilde commented on August 13, 2024

I think you are mistaken, you have never been able to set THROTTLE or STEERING since I have used KOS unless it was slipped in in some update and I never saw it (but I don't think so). And the reason that you can't has to do with how Kerbal Space Program is actually coded.

To be specific, the way that the steering and throttle get hooked into requires that they be told what they should be at everytime, and if you dont tell them, they go back to what they were set at by the manual controls.

from kos.

Dunbaratu avatar Dunbaratu commented on August 13, 2024

@GraemeWilde while it's true that "SET" controlling has never worked in the past, and it's true how you describe KSP steering working, it's not necessarily true that kOS can't implement it so that it would work. I think it could. Like this:

When a LOCK THROTTLE statement is run , it does this right now:

  1. Make a function tied to the identifier "THROTTLE". (throwing away the old one if any exists.)
  2. Fill the contents of that function with the opcode instructions generated from the expression.

When a SET THROTTLE statement is run , it could be implemented to do this:

  1. Make a function tied to the identifier "THROTTLE". (throwing away the old one if any exists.)
  2. Right NOW, run the opcode instructions generated from the expression, leaving the current result on top of the stack.
  3. Fill the contents of that function with the opcode for 'return foo' where foo is a hardcoded constant equal to the current value seen on top of the stack.

Thus it's still a function call like the rest of the fly by wire code is expecting, but the value it returns is an unchanging constant until the next time someone runs a SET THROTTLE command, so it would behave just like SET would be expected to behave.

And obviously I used THROTTLE as the example but the same would need to be done for the other fly by wire special identifiers.

I've looked at the code a bit and I think this could work, but I'm not confident enough yet to give implementing it a try myself. I leave it for other two who are more experienced with kOS to look at the idea and decide whether or not they think it's reasonable.

(Actually now that I think of it, technically the above change could be done universally for all SET's regardless of whether they're being used for fly by wire or not. I'm not saying that's a good idea but it would create logically identical results to how SET works now (although take slightly more time to execute so I'm not saying it's necessarily a good idea). )

from kos.

GraemeWilde avatar GraemeWilde commented on August 13, 2024

@Dunbaratu I'm not sure exactly what you mean, I'm reading this as
SET THROTTLE TO 0.5. and it would stay there until you change it? But LOCK THROTTLE can already do that?

What I would expect SET THROTTLE/STEERING to do would by to set the throttle at a certain place but then allow it to be changed manually by the user with ctrl/shift. However when I played around with FlyByWire it wouldn't allow this.

from kos.

Dunbaratu avatar Dunbaratu commented on August 13, 2024

I was suggesting a design change that might allow SET it to work for fly by wire. I wasn't claiming that it currently works.

What I was suggesting, to put it in terms like kosscript would be written, was something like this:

When kOS sees code like this:
SET THROTTLE TO some_math_expression.

That behind the scenes it could do something akin to this:
SET temp_internal_value TO some_math_expression.
LOCK THROTTLE TO temp_internal_value.

Where temp_internal_value is not even named in the identifier dictionary - it's just kept on top of the stack long enough to look at it and build a function that returns it as a constant value.

That way when the value of some_expression_here changes later, throttle doesn't change, as one would expect from a SET.

from kos.

GraemeWilde avatar GraemeWilde commented on August 13, 2024

Ah ok, I see what your saying. When I think SET THROTTLE I think set it as in you could then manually change it with ctrl/shift, like as in it wouldn't be stuck at what KOS sets it at, and could be changed by the user.

What your proposing is quite possible, and from the FlyByWire side (I don't know about the KOS side) wouldn't be that difficult. I don't really see that it would be that useful though as its not that big a deal having a kos variable floating around just to hold the throttle value.

from kos.

Dunbaratu avatar Dunbaratu commented on August 13, 2024

I didn't realize that's what you meant. Yes that would be a lot harder to implement - to set the controls once and then relinquish control back to the user. The reason that would be hard to implement is that the vessel doesn't instantaneously jump to the requested orientation and throttle. If you SET STEERING to a direction, many calls to Update and FlyByWire will have occurred in the time it took to get the vessel to rotate to the requested setting. So its a bit fuzzy about "how long" to take control before giving it back.

Perhaps instead of a "SET" the logic could be to notice the moment the player presses a ship control key and give control to the player as soon as they try (sort of how a lot of real world airplane autopilots work - they release control when the pilot movies the yoke.)

Well, I don't think this is that easy to deal with given that I now know what was intended.

from kos.

erendrake avatar erendrake commented on August 13, 2024

It sounds like we are talking about new features rather than a bug. Is this correct? if so ill move it out of the v0.12 milestone

from kos.

Dunbaratu avatar Dunbaratu commented on August 13, 2024

The thing @GraemeWilde mentioned in a comment would be a new feature. But I'm not sure about the original post of the thread, which was by @xyztdev and may have been talking about something different to what @GraemeWilde was talking about.

I don't know.

from kos.

GraemeWilde avatar GraemeWilde commented on August 13, 2024

Concerning the original post, as far as I know you were never able to SET the THROTTLE or STEERING, although I could be wrong. If so this wouldn't be a bug.

Concerning what I mentioned, I think it might be a decent feature to add for the THROTTLE, and actually I now realize its really simple to do with C# in ksp using FlightInputHandler.state.mainThrottle.

from kos.

erendrake avatar erendrake commented on August 13, 2024

I am going to close this because i dont see the need, please correct me if im wrong

from kos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.