Jump to content

[1.12] Time Control [2.11]


westamastaflash

Recommended Posts

OZ6FZcj.png

Originally designed by @Xaiier as an advanced successor to the popular Dynamic Warp mod, this mod gives you complete control of time in KSP by allowing you to slow down time to get those cool explosions on video(or find out why your rocket is blowing up on the pad), boost the rate of time to ridiculous levels without loss of precision to ease those long burns, set custom warp rates and per-planet custom altitude limits, utilize automatic warping, and monitor the physics engine and game performance.

Now maintained and enhanced by @westamastaflash.

y4mQV23X_-QTx32tWEnLkD9w--7jh4WeESh7ZeJby4mbBDLHCISVbOWFQgCS7vscr5U_cilCd5alosJ6y4mjs8qvYwemEplterDR-m4_RDSq0czMEypnOzjX

Jun 25, 2021 - Version 2.11 (KSP 1.12).

KSP 1.12 Recompile

Note that in Low Kerbin Orbit, when using 'hyper-warp' you may sometimes find your Semi-Major axis changing without any force on your vessel. I think this has something to do with the interaction between the coordinate systems and floating point issues that I am not smart enough to figure out right now. It's small enough that usually it is not a problem when you are applying thrust to your vehicle.

Also, there seems to be a problem with some engine sounds after using hyper warp.

Download current release on GitHub. 
Curseforge Project Site
Please add issues or enhancement requests to the issue tracker on GitHub!

 

Full Changelong Available on Github

Usage:

The seven letters at the top of the window allow you to switch operation modes between details, quick warp, warp-to, rails editor, keybindings, slow-mo, and hyper warp. In the Space Center and Tracking Station, hyper warp and slow-mo are not available.

Pictures of the GUI are in each spoiler below.

QuickWarp:

Spoiler

Immediate rails warp for X number of seconds, minutes, hours, days, years, orbits, or specific vessel orbit locations or maneuver node locations.

y4min-GKrtnnjdAkj0JUm73WLou1tA72At402NU3

Warp-To UT:

Spoiler

Press "Current UT" to set the Target UT to the current game time.
Press Ap/Pe/AN/DN/SOI/Mnv to set the Target UT to the time at that point in the current vessel's orbit.

Left Click on a number to add that amount of time to the Target UT.
Right Click on a number to subtract that amount of time from the Target UT.
You can also specify an exact amount and use the +/- button on the bottom to add or subtract that amount from the Target UT.

y4mY42w5I5CpXwFEC6qMqLs7bBYBvBTF7Fjt8AaS

Slow-motion:

Spoiler

y4mjs8qvYwemEplterDR-m4_RDSq0czMEypnOzjX

The slow motion menu gives you the ability to slow down time, or completely pause time and step forward frame by frame. By default, the slider slows down both the game speed and the physics delta, resulting in a smooth slow motion. Note that this will change how the physics of your vessel behaves, joints will stiffen and become more rigid (the opposite of what happens in phys-warp). This can sometimes cause problems with launch clamps or clipped parts, so beware. If you flip on the "lock physics delta" option, time will slow down, but the physics calculations won't change, so parts will appear to stutter and motion will be choppy. This allows you to see how your ship behaves at a much slower pace, so you can determine what might be going wrong. It is also very useful because even with high part counts where your computer is struggling with physics calculations, your frame-rate will NOT be slowed, so you can maintain full control of your camera, parts on your ship, and anything else. The pause button freezes physics, and allows you to step forward one physics frame at a time, for even more precise control. Also provided in the slow-motion window is a throttle slider, so you can precisely control your throttle even when the standard throttle response is slowed.

The FPS Keeper has been removed from this release and will be added back in at a later date.

Hyper warp:

Spoiler

y4mbBDLHCISVbOWFQgCS7vscr5U_cilCd5alosJ6

The hyper warp menu gives you the ability to speed up time without sacrificing physics accuracy like phys-warp does. This has a myriad of uses, like speeding up launches or burns (especially with lower TWR craft), flying planes around the world, running Kerbals long distances, etc. The first slider sets the maximum attempted speed - note that it is unlikely that you will be able to attain that speed unless you have a very powerful computer or a very small craft. The second slider sets the minimum accuracy. The higher the number, the less accurate physics calculations become. If you know your ship can hold together in phys-warp, you can reduce the accuracy to attain better speeds and FPS. You can either manually control when hyper warp is active, or you can set it to warp for a period of time, which is particularly useful for long burns with ION or Nuclear engines. If you like, have it pause when it finishes so you can AFK while it goes and not worry about missing anything. Also provided in the hyper warp window is a throttle slider, so you can precisely control your throttle even when the standard throttle response is sped up.

Rails editor:

Spoiler

The rails editor gives you complete control over every part of rails warping. You can fully customize the warp rates available, as well as add more if you like, as well as set the altitude limits for each warp level for each celestial body. There are a few new quick-access buttons here to set the rates and limits to commonly used values.

y4mvJCZzeJ-oDxcnJPrYV9hjEICYYeLKWfasuvyk

? Details:

Spoiler

The details screen provides some additional information and the ability to modify the Max Delta Time in-game.

y4mEV1Q9l_MA8NQ_tYHavGDmbDAPvuB66TSrujBq

Key Bindings Setup:

Spoiler

Key Bindings are set by left clicking on the button, and then pressing the key combination you want to map to the action. Clear them by right clicking. 

You can define your own key bindings through the "Add New User-Defined Action" button. Press "DONE" after adding the actions you want. You will see the actions appear on the main list at the bottom (it will scroll). You can then map keys to those actions.

In this manner, you could, say, map your numeric keypad #9 to "Activate Hyper-Warp" and "Hyper-Warp Set Rate To 9", and when you press the key, both actions will take place.

Note that some actions don't make sense together and if you try to activate hyper warp and slow motion together, only one of them will 'win' and get activated.

y4mfhvlf3Un0VUmOj0VD3xKpiRdBP2aHy5XFaMzpy4mF_jEUQFgP0jAxFKnc3dykCwMmSPI1m4IVHODEy4mgCZITBwZWit1eMsSN-2rGbUgyiPwJz5hPOD5l

 

 

Settings are now in the standard KSP settings window accessed in-flight or at the space center.

Spoiler

y4mKyRQkklEKErpL8LH2JSOejIoru23Y97GXthdlF04X9eSGLl4zH_9hHqKr0nhS38YBTHwRnSEok0xCsbFmWPdaGVSEq8StLVBNU19gCsJ5PI4YKowf3bREFkbQhYYmM52Mn68njhtrlM-ojicQOXKlOyfV_dtoINJuXyjfrbWPcxJj-t8D3ktYR8wg0LAh4EGY0BlmngaDzhjpvnAJzZpIg?width=615&height=420&cropmode=none


Recommended Mods that go well with Time Control:

Time Control will respect the years/days/hours/minutes that Kronometer sets up. Note that the quick-warp and warp-to quick +/- buttons won't make sense if your kerbal minute is 38 seconds long and kerbal hour is 17 kerbal-minutes. They will work correctly (+38 seconds / minute), but the multipliers wouldn't be that useful.

 

Time Control has an integrated "Warp to next KAC Alarm" feature. My recommendation is to turn off KAC's built in warp-stopping functionality, as Time Control's is more precise and will get you to the alarm point very fast.

 

 

Source Code also on Github. MIT License.

In the past, this mod included version checking using MiniAVC. If you opt-in, it will use the internet to check whether there is a new version available. Data is only read from the internet and no personal information is sent. For a more comprehensive version checking experience, please download the KSP-AVC Plugin. MiniAVC has been removed from the mod for some time, but a version file remains, if you choose to use KSP-AVC.

 

Time Modding Notes (by Xaiier)

Spoiler

http://answers.unity3d.com/questions/10993/whats-the-difference-between-update-and-fixedupdat.html

The only change from 0.23 to 0.23.5 is that a TimeWarp object now exists in the space center and tracking station, which means there's no reason to hack the warp in the tracking station now.

I'll give an explanation of everything I've learned about the internal systems so that others can utilize them in their mods or understand how they interact.

There are three main things that control how time progresses in KSP:

 

  • The Built-in Unity Time
  • A TimeWarp object
  • The Planetarium object

 

The TimeWarp Object:

This object appears to be instantiated in the flight scene only, it handles all the physics and warping things for the currently active vessel. It can be accessed by grabbing a reference to it from the static definition. The only known documentation for accessing it is here. This is where warp-rates can be fussed with. I won't bother to repeat anything that is well documented on there already, so make sure to look at it. Note that the methods to get info are marked as extern, which probably means that they are just pointing to the standard unity time stuff. Controlling the physics simulation can be done by simply accessing the static variables as described and explained here.

What is important to know, and which very few understand, is how Unity handles time passage internally.

There are three important values:

 

  • timeScale - this is the rate of passage of time, typically 1x, changing this is how phys-warp works.
  • fixedDeltaTime - essentially the "accuracy" of physics, typically is a value of 0.02, though activating phys-warp multiplies it by the rate (to keep the same number of physics steps per second the same), which is why we see lower accuracy in phys-warp.
  • maxDeltaTime - this is largely tied into how unity does its automatic slow-down to account for intense physics calculation instead of lowering FPS, this is the same value as you can find in the settings menu.
    Something to note: this must be >= fixedDeltaTime, but KSP (or perhaps Unity) internally doesn't bother to put it back down if you exceed it. If you set your maxDeltaTime to say 0.03, and then use phys-warp, you will find it goes up to 0.08 and stays there, which is why phys warping before launching a vessel might cause a faster time rate, but worse FPS.

 

The Planetarium Object:

This object exists throughout the game, and is basically the entire universe, planets, ships on rails, etc, except for your active vessel (if you are in the flight scene). The only known documentation for accessing it is here. This is where altitude limits and the rate of time can be fussed with. Again, there is no need to explain what is already made obvious in the documentation.

There are two important variables in this object:

 

  • timeScale - this is the warp rate, accessing this is how I did tracking station warping, and likely how the ARM update does that as well as space center warping. It seems to be automatically kept up to date when warping in the flight scene, but take care if you are changing it yourself.
  • fixedDeltaTime - this is typically the same as the one in TimeWarp, though as I found out, you do need to make sure it matches the rate in TimeWarp if you do fiddle with that, otherwise the universe won't be moving at the same speed you are.

 

From some testing it doesn't appear to be necessary to modify timeScale as well when you do things like slow-mo, though I am not entirely sure. It's rather difficult to gauge a lot of this stuff. If I'm wrong, then the universe might still be getting screwed up by slow-mo

Edited by westamastaflash
New version
Link to comment
Share on other sites

awwwwwwwwwwwwwwwwwww yesh. nothing of value to add, just carrying over my enthusiasm from the previous thread.

*plop*

:cool:

edit:

I asked for a recompile and you gave me a resurrection and then some. Not going to complain.Not at all. :)

Edited by Deimos Rast
Link to comment
Share on other sites

WOOHOO!  New thread...

So an update after a solid evening of playing with the latest version.  I'm happy to report that with my 150+ mod load that I have seen no errors of any kind.  I've seen a couple of quirks but nothing that I can 100% attribute to Time Control.  The strangest one of all was a sudden, mid warp halt for no apparent reason but there were no messages nor anything in the log so I wrote it off as pure strangeness.  That's the closest thing to a ?bug?/?quirk? that I've seen.

Fantastic job and thanks again for the work!

Link to comment
Share on other sites

2 hours ago, rasta013 said:

WOOHOO!  New thread...

So an update after a solid evening of playing with the latest version.  I'm happy to report that with my 150+ mod load that I have seen no errors of any kind.  I've seen a couple of quirks but nothing that I can 100% attribute to Time Control.  The strangest one of all was a sudden, mid warp halt for no apparent reason but there were no messages nor anything in the log so I wrote it off as pure strangeness.  That's the closest thing to a ?bug?/?quirk? that I've seen.

Fantastic job and thanks again for the work!

If you open up the settings file in the timecontrol / plugindata folder, you can change the log settings to Trace. This will log a lot more of what Time Control is doing - if you'd like to set it and see if you can reproduce the issue?

Link to comment
Share on other sites

7 hours ago, westamastaflash said:

If you open up the settings file in the timecontrol / plugindata folder, you can change the log settings to Trace. This will log a lot more of what Time Control is doing - if you'd like to set it and see if you can reproduce the issue?

Sure no problem.  I'll switch it on and see what turns up.  I'd really have my doubts that it was Time Control doing something though.  With a mod load the size of mine I run into so many little quirks that show up once and never return it's become fun to try and lay odds on when I'll see another mysterious gremlin come romping though my play land. :D

Link to comment
Share on other sites

This mod is especially helpful when using KSP Interstellar, as you can slow down to 1/8th time to get as close as possible to a planet with the alcubierre drive.  This can shave hours or days off of your trip since the circularization burn and establishing orbit takes far, far longer than the actual interplanetary transit does - the more precise your jump, the more efficient your trip is, and this mod is SUPER helpful for that.  Thanks for the update!

Link to comment
Share on other sites

On 21.7.2016 at 2:53 AM, westamastaflash said:

I have had similar issues. I am not sure what is causing this. I have an open issue for it. 

https://github.com/ntwest/TimeControl/issues/1

are you using kOS? possibly the new alpha version? they have had some problems with time.

 

EDIT: Removing Time Control solves the issue. Sudden stop seems to happen when the warp is suppoes to slow down.

Also: TC does not seem to accept change of settings. Tried to put warprate 2 back to 5x. Still went straight to 10x.

Edited by angrybold
Link to comment
Share on other sites

On 7/20/2016 at 8:55 PM, angrybold said:

TC does not seem to accept change of settings. Tried to put warprate 2 back to 5x. Still went straight to 10x.

It seems this error occurs only the first time you try to warp in flight mode without changing the warp rates. Seems like the game is resetting them internally on a scene change. I'll update this to manually correct warp rates on scene change.

Corrected in new release, 2.1.

Edited by westamastaflash
Link to comment
Share on other sites

This is so much better then the previous version. It even seems to warp much more efficiently. I love that the physics can go down to 13% now. I never find myself not physic warping fast enough

Would it be possible for one to hypothetically add a setting to this mod which warps to desired time instantly? I mean instead of how it is now with the automatic warp throttling as you get closer to your desired time.

Edited by Maltman
Link to comment
Share on other sites

4 minutes ago, Maltman said:

Would it be possible for one to hypothetically add a setting to this mod which warps to desired time instantly? I mean instead of how it is now with the automatic warp throttling as you get closer to your desired time

Maybe? But I'm not planning on it. In my 2.1 release, the auto warp is pretty goshdarned fast and time-accurate now. If you have a long time to go, add a few 'higher' warp rate settings using the + button and see how well it does. I just tested with 10000000x and a 3 year auto warp, took about 10 seconds and I don't think it was off by more than a second or two, if that. I cannot promise that your ships on rails will be OK at super high warps though.

9 minutes ago, Maltman said:

I love that the physics can go down to 13% now. I never find myself not physic warping fast enough

This was about the limit of my testing before even simple ships started to seem to have physics trouble on the pad. But in space, perhaps they'd be ok. Technically, what is really happening when we mess with the physics slider is that we are modifying how often Unity updates physics. When we change it to 1 / 6, we are setting the physics delta time to 0.12, so (especially in atmo), forces act much more weirdly on the crafts.

Link to comment
Share on other sites

Thanks for the update.

Anyway to drop physics below 1/6? I have a really good computer but KSP seems to hate it (not sure if normal behavior, but it always seems to run single core?). Basically anything over 10x Warp requires physics delta decreasing.

All the same, I managed do to a 5 hour atmospheric plane ride in a tiny prop plane at ~15x physics just fine (with a slight decrease in physics).

You've done great things with this mod. Keep it up!:)

Link to comment
Share on other sites

4 hours ago, angrybold said:

Warpto is still going too short.

Can you give an example? Is this Rails or Hyper warp, and how short is it going? I have tested on a modless install and the newly coded rails auto-warp functions perfectly (for years of time), and hyper warp comes pretty close.

Keep in mind that some other mods will do things with warp and possibly interfere with Time Control's Auto-Warp functionality - Kerbal Alarm Clock and Kerbal Construction Time. I use them fine together so long as I don't have any alarms near the time I plan to warp to (or I turn off the slow down warp feature).

 

5 hours ago, Deimos Rast said:

Anyway to drop physics below 1/6? I have a really good computer but KSP seems to hate it (not sure if normal behavior, but it always seems to run single core?). Basically anything over 10x Warp requires physics delta decreasing.

It's possible... Unity runs the game loop in a single thread, with physics on a separate thread (sometimes). Not much i can do about that. A fixedDeltaTime of 0.12 (1/6x) is already really high, since now there are only ~8 physics updates per second, which, in a game like KSP, often leads to unplanned rapid disassembly in atmo for all but the most durable of ships. I tried 1/10x and I couldn't launch a simple rocket off the pad. Also, keep in mind the more add-ons you have installed (especially plug-ins, which run as part of the update() game loop), the more work KSP has to do each frame (often even when those mods aren't 'active'. Many mods could use a good dose of data caching in their loops. I tried to cache most of what TC does, but I can't control other plugins. I've got a stock Core i5 3570k with a GTX 760 driving 4 monitors, and I have had no trouble with high hyper warp rates on small ships. I might consider looking into adding something like what the Joint Reinforcement mod does, might help prevent ship breakups.

 

4 hours ago, angrybold said:

Cfg for logs reset itself on startup

I thought I had squashed this. I will look into it. The logging should start out with Info logging until the file is loaded. Then it ought to be set to whatever the config is set to.

Edited by westamastaflash
Link to comment
Share on other sites

1 hour ago, westamastaflash said:

It's possible... Unity runs the game loop in a single thread, with physics on a separate thread (sometimes). Not much i can do about that. A fixedDeltaTime of 0.12 (1/6x) is already really high, since now there are only ~8 physics updates per second, which, in a game like KSP, often leads to unplanned rapid disassembly in atmo for all but the most durable of ships. I tried 1/10x and I couldn't launch a simple rocket off the pad. Also, keep in mind the more add-ons you have installed (especially plug-ins, which run as part of the update() game loop), the more work KSP has to do each frame (often even when those mods aren't 'active'. Many mods could use a good dose of data caching in their loops. I tried to cache most of what TC does, but I can't control other plugins. I've got a stock Core i5 3570k with a GTX 760 driving 4 monitors, and I have had no trouble with high hyper warp rates on small ships. I might consider looking into adding something like what the Joint Reinforcement mod does, might help prevent ship breakups.

Yeah, I'm playing on a mildly overclocked i7-4790k; 16GB Ram, GTX 980, SSD's up the wazzoo, etc etc. Mods are bare bones, ~100 maybe less, mainly parts. Everything should be a golden gravy train, but eh, the struggle is real. KSP has run horribly since day one for me, but that's outside the purview of this mod. :rolleyes:

Also, I'm impressed that "Pause" works. When I tried Pausing with BetterTimeWarp, it majorly hosed my game, requiring a hard restart. Of course the problem is certain other mods don't like being paused (they have animations that run in realtime, like MechJeb's tray animation), or map mode, that hates being paused as well. Not much you can do about either.

Link to comment
Share on other sites

26 minutes ago, Deimos Rast said:

KSP has run horribly since day one for me, but that's outside the purview of this mod

Wish I could help. One thing that I found was that anti-virus software slows down the game, so when I excluded KSP_x64.exe in Windows Defender, things seemed to improve some. I'm like you - I like huge modded installs. I also found that using AutoPruner to physically rename parts I don't use (almost every single tank part since i use Procedurals, for example) helped too.

Edited by westamastaflash
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...