Jump to content

fixed update functions?


amo yeh
 Share

Recommended Posts

Great engine, really love it and have been playing around for some time.

 

I don't know to get the precise control of how many frames or time to update in the game, not using requestAnimationFrame but manually. I noticed that I can set Game.lockRender property yet I am not sure what to do after.

 

The game is a network based multiplayer game. To ensure that all players act the same, I need to update them based on how many steps in the future from server value, so that both physic simulation and render looks the same across all players.

 

Really appreciated for the answers, thanks~  :)

 

Link to comment
Share on other sites

Sweet, a topic about multiplayer / real-time! :D

 

If I understand you correctly, you want to synchronise the ticks so that client and server build the same updates history? It could make it easier for lag compensation and prediction.

 

I'm trying to build a PvP engine too, and for the time being I'm not using this strategy : both clients and server update gameState at 60PFS, but there is no notion of tick. So when client receive authoritative data from the server, it just uses the latency to adjust the data and then updates its state accordingly.

 

Everything is based on time (use epoch timestamp for solid reference). Phaser itself is based on time : I mean, when the updates run they use deltaT (since last update). So whatever the FPS the results are consistent.

 

I don't know how you could implement the tick strategy. I think it's tough to achieve and not really viable either : you have to think about less performant devices or computers, who won't be able to run at 60FPS but 50 or even 30. If you rely on the ticks too much, you will definitely exclude those people.

 

Always worth mentioning, you can set the FPS manually in a game with desiredFps. Doc : http://phaser.io/docs/2.3.0/Phaser.Time.html#desiredFps

 

If you make any progress, I'd love to hear about it!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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