Skip to content

Time-warp is disabled when vessel is throttled, but not accelerating #792

@bismurphy

Description

@bismurphy

Edit: Please view my comment below! Most of the info in this initial post is incorrect and not useful.

What happened?

I am new to KRPC and am still learning the integrations. I have been going through Career Mode using KRPC for all my flights. I have successfully managed staging, parachutes, fuel monitoring, etc, and now that I'm doing longer flights, I'd like to use the Time Warp feature. However, with my Python integration, this fails. Setting conn.space_center.rails_warp_factor to any chosen factor has no effect (and after doing so, reading that value stays on zero), and conn.space_center.maximum_rails_warp_factor seems stuck at 0.

How can someone else reproduce it?

  1. Create a new CKAN instance, where KRPC is the only installed mod.
  2. Launch the game. Go into the VAB. Build a rocket which consists simply of two parts: A Mk 1 Command Pod, mounted on top of a BACC "Thumper" Solid Fuel Booster. The default delta-v readout should show 2212 m/s.
  3. Go to the launch pad. Ensure the KRPC server is running. Do not touch any controls to pilot the vessel.
  4. Run the Python flight code below. It should give a launch countdown, followed by a launch. It will print out the vessel's altitude every second, helping to confirm that the Python/KRPC connection is solid.
  5. Your booster should burn out around T+00:42, at 31km altitude and 2050 m/s. From there, the script will wait until you coast above 100 km.
  6. At 100 km, you should see the Python printout change from printing altitude to printing the warp state. You'll also see it attempt to warp to a factor of 3.
  7. It will continously print that the current warp is 0, and the maximum warp is 0.
  8. In-game, press the . key to step time-warp forward. You will now see "Current warp: 1; Maximum warp: 0". This should be impossible. You can freely increase and decrease the time warp factor; KRPC will correctly print the current warp no matter what it is, but will always say maximum warp is 0.
import time
import krpc

conn = krpc.connect(name='Flight Python')
vessel = conn.space_center.active_vessel
print(vessel.name)
vessel.auto_pilot.target_pitch_and_heading(90, 90)
vessel.auto_pilot.engage()
vessel.control.throttle = 1
for i in range(3,0,-1):
    print(f"{i}...")
    time.sleep(1)
print("Launch!")
vessel.control.activate_next_stage()

state = "flight"
while(True):
    time.sleep(1)
    if state == "flight":
        print(f"Altitude: {vessel.flight().mean_altitude}")
        if vessel.flight().mean_altitude > 100000:
            print("Attempting to enter timewarp")
            conn.space_center.rails_warp_factor = 3
            print("Commanded warp 3")
            print(f"Actual warp {conn.space_center.rails_warp_factor}")
            state = "timewarp"
    if state == "timewarp":
        print("Timewarp mode")
        print(f"Current warp: {conn.space_center.rails_warp_factor}")
        print(f"Maximum warp: {conn.space_center.maximum_rails_warp_factor}")

What is your environment?

Mod version (according to the in-game server window) is 0.5.2. Game version (according to main menu) is 1.12.5.3190. My computer is on Linux Mint 21, and my Python version is 3.10.12.

Anything else we need to know?

I'm more than happy to iterate on this in order to isolate the issue. I suspect the problem is something I'm doing rather than in KRPC itself, but would love to determine what might be causing this. If nothing else, maybe I'm making a dumb mistake that could have a warning in the documentation somewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions