Jump to content

[0.25] Time Control - 9/23/14 v13.2


Xaiier

Recommended Posts

1/17/2015: Work started on a re-write to fix all the issues, finally! Check out my progress on github!

Current Status:After I fix some final bugs, I will consider Time Control to be "feature-complete-enough" for now, and will direct my efforts toward other things for a while.


cGDEtiD.png


Description:

Designed 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.


This image sucks and will be replaced soon.

IissqrPl.png

Feel free to submit things to this!

0qvxKMy.png

2PNNe9C.png

9VvxcHr.png

Gozzdp7.png

A nice mod spotlight from Kottabos Games :) (very outdated but shows slow-mo functionality)

Number 8, a quick example of some of the potential

Don't let this be you:


Usage:

From the flight scene:

The three letters at the top allow you to switch operation modes between slow-mo, hyper warp, and the rails warp editor.

S
low-motion:

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.

Hyper warp:

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, from 1 to 1/4. 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 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:

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. Also provided is an automatic warp function, which takes into account your preferred time format and warp rate settings and will automatically warp you to when you want. It's pretty straightforward and easy to understand, so I won't further explain it unnecessarily.
:)

Note: warp rates are capped at 1,000,000,000x by KSP.
:(

Settings & Info: (accessible via the "?" button in the top-left corner of windows in the flight scene)

Physics Time Ratio - the ratio of real time to game time (1 means KSP can handle the physics, less than 1 means time is being slowed by KSP because it can't process all the physics)

Time Scale - rate of time passage

Physics delta - physics step size

Max delta - maximum time a physics step can take (this is the same slider as in the settings menu, except it goes to 0.02 instead of just 0.03)

FPS, which can be shown on the screen where you like, even if the windows are hidden

Camera Zoom Fix - removes the smoothing zoom feature allowing you to zoom normally at slow or stopped time rates

Suppress Results Dialog - gets rid of the menu that pops up on flight end, so it doesn't get in the way of your epic slow-motion crash

FPS Keeper - see below

Keybinding - click to set custom keybinds for actions (supports joystick buttons!)

Update Indicator - if an update is available, links to download locations will show up (HTTP request only, no data sent or saved)

The FPS Keeper is a handy little tool that can automatically manage your settings based on your computer's performance and edit the maxDeltaTime and slow your time rate to keep your FPS above a limit while maximizing the time rate of your game. Note that is is still very beta technology, it isn't perfect and it won't work for every situation.

Usage is fairly straight forward, but performance is highly dependent on your computer. First off, determine what kind of FPS your computer gets with a very small craft. You shouldn't set it above that because it will just slam you down to 1/64x trying to boost your FPS hopelessly. Also, note that you should give a margin for error, if you run at 60 fps, set it to 50-55, as 60 will just confuse it. Second, play around with what kind of minimum FPS you can stand, trying to set it too high will just end up making everything take ages. The main idea of it is that it can adjust on the fly to changing conditions without the typical FPS spikes and drops, so you can for example fly around in orbit at good FPS, and then when you approach your station, it will automatically account for the higher load and slow down time a bit while you dock, or have it automatically adjust the speed as your massive lifter drops off stages keeping you at the best speed without having to deal with terrible fps. Also note that results per computer may be drastically different. A computer that struggles to get 30 fps won't be able to keep the FPS when the load gets high no matter what it does, and whether your computer is CPU or GPU limited also can have a large effect.

From the Tracking Station or KSC:

The rails editor as described above is accessible in the Tracking Station and at the KSC screen. The "Current" option updates appropriately when moving around in the tracking station.

MOD+T shows/hides the TimeControl windows, if you don't want to use Toolbar.


Downloads:

KSP Version 0.24.2 & 0.25:

Plugin v13.2 (Direct via Dropbox)

Available on KerbalStuff

Available on Curse

Supports blizzy78's toolbar!

GitHub Source (MIT Licence)


Known Bugs:

  • KSC can become unresponsive sometimes. I think this is due to an issue with crossing SOI's, will fix ASAP.
  • Warp GUI arrows go screwy with additional warp levels
  • Suppress Results Dialog option can cause buggy camera and control stuff
  • Hyper Warp kills the altimeter, it comes back after a bit, or you can quicksave/quickload
  • Switching locked/unlocked modes at low warp can cause parts to explode
  • A lot of stock GUI elements and controls slow down/pause with the time rate (not really fixable)

Incompatibilities:

  • Kerbal Alarm Clock will cause problems when it stops warps from very high rates. This is supposed to be fixed in the latest version of KAC, but I've not tested it yet.
  • Hullcam will get broken if the "Cam Zoom fix" option is on, turn it off to restore proper functionality for hullcams. Also, the same goes for Camera Tools.
  • Any planet adding mod may or may not work. The only mod officially tested is Kopernicus.
  • Any other "Time" mod will likely break horribly. Don't cross the streams!
  • It should work on KSP x64 on Windows, but I can't give any guarantees, nor do I recommend using it. I will not provide support to people using my mod on x64 unless they can replicate issues in x32.
  • Other mods that may come with toolbar can have older versions that won't work with this mod (ex. FAR comes with toolbar version 1.4.0 while toolbar is currently at 1.6.0). Updating to the latest version of toolbar should fix any problems. Probably not applicable anymore.

If you experience problems please post and let me know what mods you have so I can look into it.


Future Plans: (In order of estimated completion, with comments as to my current thoughts/status)

  • Stuff that will probably happen in the next update
    • Sort out control locks
    • Fix a couple toolbar related NRE's
    • Add support for stock toolbar

    [*]Stuff that might happen Soontm

    • fix for the timewarp GUI element going screwy with more than 8 rates
    • Stock toolbar integration (waiting on its integration into the tracking station)
    • Time jump forward x amount instantly (Somewhat implemented, working through the mechanics as well as trying to prevent it being cheaty. I'll try to figure something out.)
    • Control of the standard phys-warp (more for lols than really being useful)
    • Integrate slow motion throttle control in standard throttle system (might be plausible)
    • Limiters to prevent using high warps or the jump feature to go through planets, pass over SOI's, and other ridiculous stuff (will be optional, but I intend it to be non-intrusive enough that you typically won't notice it unless you intentionally try to do something bad. Should fix a lot of the current problems with the time warping system while still allowing the full control it currently allows.)

    [*]Stuff that won't be for awhile, if ever

    • Thrust on rails for any engines as an advanced form of Hyper-warp (This will be much more complex as it will have to take into account everything necessary to simulate thrust without actually using the built-in system) May be out of scope.


Changelog:


9/23/14 - v13.2 - fixed issue with saving too often, updated logo graphics, fixed update check to work with KerbalStuff changes
9/9/14 - v13.1 - fixed issue with "reset body altitude limits" button, cleared up possible issues with window ID
9/1/14 - v13 - fixed explosions, joystick keybind support, ability to have more than 8 warp levels, new rails GUI, numerous bugfixes and behind the scenes improvements
8/8/14 - v12.2 - fixed window becoming visible, fixed MOD+T toggling SAS, added keybind to set warp to custom-selected rate, included improvements from Teknoman117 to allow for altitude limits for custom planets as well as future-proofing them
7/28/14 - v12.1 - Added hyperwarp limiter, kerbin time option in flight, hotkey hide, delta time to .02, bugfixes, rebuilt config
7/27/14 - v12 - Fixed throttle control, FPS display, frame-steps, custom key controls, fixed camera, hyperwarp, automatic warp, update indicator, flight results supressor, code and GUI complete overhaul
4/23/14 - v11.1 - Removed the throttle control due to it causing severe problems
4/20/14 - v11 - Complete re-write to accommodate for 0.23.5 and the new features within it, as well as substantial internal cleanup
3/29/14 - v10 - Massive code cleanup and restructuring, FPS Keeper, throttle control, pause, and various internal fixes
3/11/14 - v9 - Fixed a couple massive bugs, as well as quite a few minor ones, added a flag for lulz.
3/3/14 - v8 - Added warp control while in the tracking station, also fixed problems with the rails data editing code and general plugin messiness
3/1/14 - v7 - Complete overhaul of most of the code, added rails data editing and various fixes.
2/16/14 - v6 - Added debug menu with slider to control maxDeltaTime and beta version of camera zoom fix, reworked some code
2/16/14 - v5.1 - GUI skin problem fixed completely
2/16/14 - v5 - Possible fix for GUI skin being set to KSP one
2/12/14 - v4 - Support for blizzy78's toolbar, proper mod directory
2/12/14 - v3 - Added button to minimize window, removed control access during on-rails warp
2/12/14 - v2 - Removed control access while paused/phys-warping, slider resets properly now
2/11/14 - v1 - Initial release


THIS NEEDS A REWRITE

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 Xaiier
v13.2
Link to comment
Share on other sites

Also, is there gonna be a button to "reset settings" so

It isn't always changed?

What do you mean? Do you have version 1? The slider doesn't properly reset in version 1 when the game modifies the time itself.

ALSO:

Now (optionally) supporting blizzy78's toolbar.

Link to comment
Share on other sites

Hey, uh, I dropped the gamedata file into my KSP directory, but it isn't showing up in game. All the files are in gamedata, but the toolbar icon isn't there. I have toolbar installed for chatterer and Crew manifest, but it doesn't show his mod. Any ideas?

Are you sure the TimeControl folder is in /GameData? Alternatively, did you remember to enable showing the icon on the toolbar menu?

Link to comment
Share on other sites

For some reason, the toolbar comes up with the KSP skin and not the unity skin and is unusable because it is TINY. This might be a RPM compatibility issue because it doesn't happen with pods without RPM. Oh, and for some reason the game timer speeds up a ton when I adjust the time at all, and map view is very laggy. Any help?

Link to comment
Share on other sites

For some reason, the toolbar comes up with the KSP skin and not the unity skin and is unusable because it is TINY. This might be a RPM compatibility issue because it doesn't happen with pods without RPM. Oh, and for some reason the game timer speeds up a ton when I adjust the time at all, and map view is very laggy. Any help?

I may be able to fix the skin issue, I'll look into it.

What do you mean game timer? If you mean the MET timer then yes, it doesn't slow with the rest of the game. I'll also look into that.

The map being laggy is a result from the slowed physics, just like how the camera zoom is really laggy too. Nothing I can really do about that.

Link to comment
Share on other sites

I got icon in toolbar but nothing happens when I press it. Awesome mod btw, I have seen it in action here :)

Edit: I got quite few other mods so any known possible conflicts maybe? This is best I can explain it pretty much sadly, got like zero experience from modding KSP.

Link to comment
Share on other sites

I got icon in toolbar but nothing happens when I press it. Awesome mod btw, I have seen it in action here :)

Edit: I got quite few other mods so any known possible conflicts maybe? This is best I can explain it pretty much sadly, got like zero experience from modding KSP.

Thanks for letting me know about that video :)

I don't know of any specific incompatibilities as of yet, could you tell me what mods your using so I can try them out and see?

Link to comment
Share on other sites

Anyone knows why it looks like this for me? I can still move the bar but it's so small it just quickly goes from 1 to 1/64th hahaha

http://i.imgur.com/SISU58z.png

This seems to be happening a lot...what mods do you have installed? Somehow it's using the KSP GUI skin instead of the standard Unity one. I may have a fix but I want to be sure it works and I can't seem to replicate the problem.

EDIT:

I put up v5 which might fix the problem. Anyone who is having this issue please try that.

Edited by Xaiier
Link to comment
Share on other sites

Sorry it took long to reply, I was trying to find the conflict and Kerbal takes like 3 mins to load for me... Anyway I've isolated the problem to Ferram Aerospace Research!

I'm going to test your fix now.

edit: Hey your fix works! Thank you! :D

W3HDdJA.png

Ver 4 with FAR

lKKmC3f.png

Edited by Piamette
it works! :3
Link to comment
Share on other sites

Sorry it took long to reply, I was trying to find the conflict and Kerbal takes like 3 mins to load for me... Anyway I've isolated the problem to Ferram Aerospace Research!

I'm going to test your fix now.

edit: Hey your fix works! Thank you! :D

http://i.imgur.com/W3HDdJA.png

Ver 4 with FAR

http://i.imgur.com/lKKmC3f.png

Glad to see that. Looks like it's still using the KSP gui for the window title and background, I'll see if I can fix that too.

EDIT:

Done, v5.1 up.

Edited by Xaiier
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...