Timeline for Frame-rate independent friction on movement in 2d game
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 1, 2015 at 1:42 | comment | added | v.oddou | Its imposible that nobody yet mentioned this gafferongames.com/game-physics/fix-your-timestep | |
Jul 15, 2014 at 14:33 | comment | added | Rasmus Øvlesen | I am having one client also run the server and the server decides where everything is. The reason i began looking into this, was that i was making calculations in my AI to predict how much it would move, before it was allowed to think again (I have a delay on my AI's so they don't run every frame). But i have worked around the issue for now. | |
Jul 12, 2014 at 2:49 | comment | added | user1695680 | one client has to be in charge, to be essentially the server, of what went where when. Any client should be able to interpolate a rough estimate themselves, however, the server should constantly be correcting the client. That is how I understand this problem. Often a client is hosting will run a separate server-client along side their client-client and view the world like any other would, with interpolation. | |
Jul 11, 2014 at 15:52 | comment | added | Mihai F | I see. Then it's going to be hard to apply the answer I gave you if you have 2 framerates that can be in any ratio. You will always get different results when running at variable timesteps and non-constant forces. My advice is to run physics with a fixed time step on all machines, e.g. 16 ms for an average FPS of 60 and just ignore if they appear slowing down when the frame rate drops. Other options include doing a number of fixed timesteps per frame and then adapt this number and sync it with other machines - should be easier working with integers. Or work only with constant forces :) | |
Jul 11, 2014 at 15:35 | comment | added | Rasmus Øvlesen | What you describe is exactly my problem. The reason i simulate them at different timesteps, is because that is my unit test. I am trying to make my physics system, so that two computers with different framerate (timestep) will get mostly the same result. Or rather, physics on the server will behave the same, whether the server is stressed and has low fps or if its doing fine with high fps. What type of drag/friction it is, i don't know. I am just looking for a certain feeling in the game, where the ships will float on when turning or stopping the acceleration. | |
Jul 11, 2014 at 15:28 | history | answered | Mihai F | CC BY-SA 3.0 |