Search Unity

Changing the fixed timestep: anyone run into problems with this?

Discussion in 'Editor & General Support' started by Marscaleb, Aug 7, 2018.

  1. Marscaleb

    Marscaleb

    Joined:
    Jan 7, 2014
    Posts:
    1,037
    I'm thinking strongly about changing the interval in which FixedUpdate occurs. I don't see much documentation that details what kind of problems could result from this. I'm wondering if anyone else has tried changing it, and what kind of results they have seen.

    One of the main reasons I want to change it is so that it can better match probable framerates for the end user. Specifically, I'd like it to run Fixed Update every 60th of a second. Not only would that better match most framerates, it would also be easier for me to set up my game's timing. Most classic consoles ran their update cycles timed with a 60Hz display, and so most of the movement code I have studied is based off of that timing. The numbers I am using in my game work better at 60 updates per second.

    However, I can't cleanly enter "1/60" as the value in Fixed Timestep. It comes out as a float value that gets rounded off after a few digits. Now sure, it's pretty close, and it really is no big deal if I wind up getting one extra update over my frames after nearly 4 hours of gameplay. (I did the math, that's what it comes out to.) But even so, there may be other unforeseen consequences to changing this value. I don't know how the base system works; I can't say that using an odd and imprecise float value is going to cause little problems with how the engine operates.

    I also thought a little about using 1/64 of a second, as that is a value whose decimal format doesn't lose precision. But while the math would be easy to calculate, being a power of two, I would lose those subtle advantages I mentioned for using 1/60 of a second.

    At any rate, has anyone else here tried changing the Fixed Timestep? Did it cause you any problems, or did it work just fine?
     
    Last edited: Nov 24, 2018
  2. Marscaleb

    Marscaleb

    Joined:
    Jan 7, 2014
    Posts:
    1,037
    I'm still curious about this, if anyone knows anything...
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    We experimented with a 30 Hz Physics rate. Physics look significantly different, noticed it the second I changed that value. Ragdolls start to stretch poly's much more than with a higher physics rate.

    But as far as I remember, and it's been several years, it improved frame-rate or spikes that would occur to catch up with the default rate every now and then.