Jump to content
  • Advertisement

semanse

Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About semanse

  • Rank
    Newbie

Personal Information

  • Interests
    Business
    Design
    DevOps
    Programming
  1. It is possible to run client physics on the different rate from server physics? For example client update internal physics (and predict movement) at 40Hz, but at the server physics is running on 20Hz to save CPU time. Also, how to deal with Input packages in this case? How often do I need to send them on the server?
  2. Thanks, will do. Yes, I know that it is almost impossible to make physics absolutely deterministic on different machines, but anyway I think it is better to have as deterministic system as possible to reduce differences between client&server.
  3. Here is some background info: I have shared PhysicsEngine which is fully deterministic (if you have the same exact state feeding the same exact inputs and tick the same exact number of times, the end result will be the same). The simulation “ticks” at a constant frequency 20Hz. RenderEngine is working separately at its own refresh rate, so I will no describe it here. Client-side step: Creates Input package based on the current keyboard/mouse state. Assigns unique id (basically frame number) to the Input and send it to the server. Saves Input in the array for future reconciliation. Passes the Input to the PhysicsEngine and calculates predicted WorldState. Receives WorldState from the server, search for the relevant Input in the array and make server reconciliation (re-applies inputs that are not confirmed yet and clears all confirmed inputs based on the id) Makes a smooth transition from predicted to the authoritative position (if needed). So, on every step of the simulation, we receive two snapshots: Input - a packaged information about the current input device state (mouse position, keys pressed and attached unique id) WorldState - calculated with PhysiscsEngine information about all entities (position, velocity, etc.). Also includes unique id. Server-side step: Generates a WorldState based on received Input packages. Sends a current WorldState to the clients. QUESTION: Basically, client-side prediction and server reconciliation works well except one thing. As I said before, both client and server sides running with the same PhysicsEngine code (thanks to js) at the refresh rate 20 times per second. BUT on the client side it runs a little bit faster (here is why). So WorldState and Input snapshots are generating faster on the client side that server side, e.g. while server generates 484 tick, a client is at 502 or even more. After some time, a difference so big that the client starts to be littered with non-accepted inputs because they are produced more frequency than on the server side. In ideal will be cool if client and server simulation rates will be independent. How to deal with that? Any ideas?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!