Jump to content

fps performance and time issues


pixeldublu
 Share

Recommended Posts

Hello guys.

As a beginner javascripter been working on a multiplayer 2d drag racing game but i ran into some issues now.

Managed to create rpm, speed, motion, gear change and stuff and then got into node and socket io and managed to sync 2 players in real time with a little bit of lag.

But i noticed a huge issue for me: if one player has a slower computer it will be slower.

Tryied to use advancedTiming,  desiredFps and fpsMax but no luck.

The player who has better pc will move alot faster on X.

 

Got any ideas what i can do ?

 

Thanks in advance!

 

Link to comment
Share on other sites

Yeah I had a similar problem but we did not care due to the project type. 

 

The older the device, the higher the score, because everything is slower and so its much easier for a person to play.  This is the opposite of your problem I guess but the same realm.

 

I feel I knew what the issue was but I cannot quantify it. 

 

If the game was based on 60fps..... 1 second encompases 60 updates.... At this point the game is perfect.  If a device runs at 30fps,  then there is 30 updates, but they should be twice as "big".   If a game was 1fps, then there is 1 update, but it should be 60 times "bigger".   The end result is that all of these have moved by 60 updates, not 60, 30, 1 respectively.

 

I cannot state how the phaser game update loops work, and although I do see the math, I cannot figure out how to integrate it cleanly.

Link to comment
Share on other sites

Latests Phaser versions do not rely on fps anymore but on real delta-times. If you use body's velocity for example for giving speed to your objects, it does not matter how much FPS you have, speeds will (almost) be the same.

 

I think that you can manually access the deltaTime value by the way, in your own update loops.

 

And desiredFps should work. That could be a workaround for your problem, like others mention, you could set the number to 30 for all devices.

Link to comment
Share on other sites

You're probably letting your clients tell your server the state of the world. This isn't a great multiplayer practice. It also makes it easier for people to cheat.

 

If you switched it around so the server told the clients what was going on they'd be synced.

Link to comment
Share on other sites

  • 2 weeks later...

If you track the time elapsed and multiply that by your velocity, it'll ratio so that the slower computer and faster computer will match distances. The only problem may be that turning will not be the same radius, so one may jump to the other ( If you compute circumference traveled to get your new coordinates, should be fine). I found that out after testing my game from desktop against tablet. (60fps vs 30fps)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...