Jump to content

What is [Max Physics Delta-Time per Frame]?


Recommended Posts

What is [Max Physics Delta-Time per Frame]? How does it affect the playing environment?

Setting are from 0.12 Sec to 0.03 Sec.

0.12 Sec means?

0.03 Sec means?

From wiki

Delta timing

From Wikipedia, the free encyclopedia

Delta Time or Delta Timing is a concept used amongst programmers in relation to hardware and network responsiveness. In graphics programming, the term is usually used but for variably updating scenery based on the elapsed time since the game last updated, and also calculated separately if graphics are being multi-threaded. [1] A user with a slow internet connection or computer is often prone to experience lag or slowness in the responsiveness of the game environment. The purpose of Delta Timing is to eliminate the effects of lag on computers that try to handle complex graphics or a lot of code, by adding up to the speed of objects so that they will eventually move at the same speed, regardless of lag.

It is done by calling a timer every frame per second that holds the time between now and last call in milliseconds.[2] Thereafter the resulting number (Delta Time) is used to calculate how much faster that, for instance, a game character has to move to make up for the lag spike caused in the first place.

Check the throttle-up speed. This is Max Physical Delta-Time set to 0.12.

Setting this high causes two issues:

1st, you can only issue a command every 0.12 game seconds, so you will have trouble flying a twitchy spacecraft.

2nd, the simulation will be less accurate, which can cause your spacecraft to fall apart for no good reason.-by numerobis

(Example:- Landing a HEAVY plane on runway)

Check the throttle-up speed. This is Max Physical Delta-Time set to 0.03.

Setting it low means each game second will take more than one real second, which is bad if you're impatient. -by numerobis

Edited by Sirine
Link to comment
Share on other sites

0.12 means that every 0.12 game seconds, Unity will simulate another frame.

If Unity can simulate and render the scene in less than 0.12 real seconds, it will reduce the time per frame so you get more frames per real second.

Setting this high causes two issues: first, you can only issue a command every 0.12 game seconds, so you will have trouble flying a twitchy spacecraft. Second, the simulation will be less accurate, which can cause your spacecraft to fall apart for no good reason.

Setting it low means each game second will take more than one real second, which is bad if you're impatient.

Link to comment
Share on other sites

The physics simulation works by taking a certain amount of time (the delta-time) and figuring out how much everything will move in that time and then figuring out if anything has collided (and some more advanced things like drag, joint tension and such).

So if you have an object moving at 10 m/s and the game chooses to calculate a delta-time of 0.1 seconds it will move the object 1m forward and then after check to see if it's touching anything. The accuracy of the simulation depends a lot on how small the delta-time is. If the delta-time was 10 seconds then the object would move 100m before checking to see if it was colliding with anything, so most of the time the object would be able to just pass through other objects without hitting them. This can actually happen in the game when flying a ship at very high time warp, if the game doesn't catch it in time and automatically lower the time warp you can pass right through a planet. Other then objects passing through each other there are more subtle effects when the delta-time is too big compared to the level of detail required. Effects like joints and friction where many forces are interacting at once need to move in small steps to ensure all the forces get balanced out nicely. If you try to move them in big steps you get violent jerky motion as parts bounce off each other and often explode from the large forces being applied all at once.

KSP doesn't use a fixed delta-time for each frame. Like with the graphics it will try to calculate as many physics frames each second as it can, leading to a smoother, more accurate simulation. So the delta-time will be as small a the game can make it. but the more parts there are to calculate the more time it will take, leading to a larger delta-time for each complete frame.

The [Max Physics Delta-Time per Frame] is a safety net. It is the highest delta-time the game will use. So if it takes 0.2 seconds to calculate one frame (and so the delta-time would have to be 0.2 seconds to make the game move at 1x speed) but the [Max Physics Delta-Time per Frame] is set to 0.1 seconds then the game will use the maximum value instead. This means the game will appear to run in slow motion - for every 0.2 seconds that pass only 0.1 seconds of game time will be calculated.

In summary:

[Max Physics Delta-Time per Frame] is used to balance the accuracy/stability of the simulation with the speed of the simulation.

Making [Max Physics Delta-Time per Frame] a bigger number means the game won't slow down on slower computers, but may become less accurate.

Making [Max Physics Delta-Time per Frame] a smaller number means the game will always remain accurate but may slow down as you make bigger ships.

Link to comment
Share on other sites

Not much else to add. You answered it in your original post. And others elaborated further. It's best to leave it at default. You can improve your frame rate with it, but then it's basically like watching slow motion because your game is processing "time" slower than real time, to accommodate physics calculations. And that will most likely drive you crazy.

Link to comment
Share on other sites

I have always assumed that it is the time step that the game uses when numerically integrating the forces that act on your spacecraft while it is on "physics" (rather than while on rails).

Longer time steps in numerical integrations typically introduce more error because they represent a courser approximation. Think of it like a low resolution image; the longer the time step (i.e. the 0.12 second setting), the lower the resolution and the "grainier" the result.

Shorter time steps can also introduce error, however, because computers have only limited precision in the numbers that they store. Rounding errors can accumulate to become very large over enough time steps. See Lies my computer and calculator told me for a good description of some of the pitfalls of performing calculations with computers. The article is a bit dated now but it is still relevant.

I wish I could give a better answer than that, but I can't tell you which setting to use without knowing the details of how the game integrates the forces acting on your spacecraft while on physics. It is probably best to experiment with it. I have it set towards the low end on my game.

Edit: Wow, uber sniped by three guys!

Link to comment
Share on other sites

@TechnicalK3rbal because English is not my primary language and I don't really understand it, and need more elaboration, aside from wiki (technical detail) explanation.

@numerobis @Dave Kerbin @iBeej @PakledHostage Thanks for the answer!

Edited by Sirine
add in @PakledHostage
Link to comment
Share on other sites

I wish I could give a better answer than that, but I can't tell you which setting to use without knowing the details of how the game integrates the forces acting on your spacecraft while on physics.

There's two parts: Physx, which performs Euler integration; and the scripts that Squad have written, which go part by part in each timestep, which for the most part is equivalent to Euler integration also (exception is e.g. one jet will run out of air before the others).

Another thing that depends on the physics deltaT: Some thresholds aren't multiplied by dT like they should be. Parachutes come to mind: notice how they rip off at 4x speed but not at 1x speed? I believe that's because 4x speed is multiplying the dT by 4, which multiplies the force by 4 -- but the strength of the joints isn't increased by a factor of 4.

Link to comment
Share on other sites

0.12 means that every 0.12 game seconds, Unity will simulate another frame.

That's definitely not true because in that case you'd run at 8 FPS with that setting.

The game works in steps - it does a physics simulation step, followed by frame rendering step. At the start of each cycle it records current time.

When it goes to do a physics step, it compares current time with time at which it was starting the previous physics simulation step. If this time difference is smaller than the value of "max physics time step", it performs physics step for the measured time difference. Only if the time difference is bigger than "max physics time step", it performs physics step for time configured in this parameter, making game time pass slower than real time. It also colors the MET timer yellow to indicate that.

I did my own experiment.

Ship 1: small 3-part ship, time till runs out of fuel. Takes 1:09 game time

Ship 2: large heavy ship, time till its first stage runs out of fuel. Takes 1:01 game time

I measured real time from launch till these events.

MPTS = 0.12: Ship 1 - 1:09 (100%), Ship 2 - 1:03 (103%)

MPTS = 0.03: Ship 1 - 1:09 (100%), Ship 2 - 1:27 (143%)

Link to comment
Share on other sites

Max Delta time is for when the game slows down, as the physics starts to take a hit, the game will start to slow the time down in game to allow the system to perform all the physics needed.

Before max Delta time was a known setting, larger ships would slow the game down and cause massive bugs, such as not even being able to be loaded onto the launch pad. The worst I ever had was over 45 seconds for the game to render one single frame, and due the the nature of the old system that 1 frame was showing 1 second of game time elapsed, and you could go from a fine ship to a full screen of explosion with no idea what failed.

Now the game brakes frames down to a maximum amount of game time before displaying what is going on. So if you are not lagging you should notice no real difference what the setting is, but load a larger ship and see. The lower the setting the more smooth a lagging game will seem.

Link to comment
Share on other sites

  • 4 weeks later...
There's two parts: Physx, which performs Euler integration; and the scripts that Squad have written, which go part by part in each timestep, which for the most part is equivalent to Euler integration also (exception is e.g. one jet will run out of air before the others).

Another thing that depends on the physics deltaT: Some thresholds aren't multiplied by dT like they should be. Parachutes come to mind: notice how they rip off at 4x speed but not at 1x speed? I believe that's because 4x speed is multiplying the dT by 4, which multiplies the force by 4 -- but the strength of the joints isn't increased by a factor of 4.

They really use Euler's method? Jees I would've thought they'd have at least gone with a 2nd order Runge-Kutta algorithm. Much better performance/accuracy ratio. Maybe i should write to them and offer them a hand. Really don't have time right now though

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