zoukankan      html  css  js  c++  java
  • 关于游戏网络延迟的资料

    client-server

    1. the server takes snapshots of the current world state at a constant rate and broadcasts these snapshots to the clients.
    2. server -> snapshot  -> client
    3. server  <- userinput <- client
    4. server runs a physical simulation step, checks the game rules, and updates all object states
    5. the client has to tell the server its incoming bandwidth capacity
    6. server doesn't send a full world snapshot each time, but rather only changes, Usually full (non-delta) snapshots are only sent when a game starts or a client suffers from heavy packet loss for a couple of seconds

    Input prediction

    1.local client just predicts the results of its own user commands. 2.if server result != client, Then the client has to correct its own position, since the server has final authority over client-side prediction 3.Prediction is only possible for the local player and entities affected only by him

    Lag compensation

    1.The lag compensation system keeps a history of all recent player positions for one second. If a user command is executed, the server estimates at what time the command was created as follows:

    Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation

    Then the server moves all other players - only players - back to where they were at the command execution time. The user command is executed and the hit is detected correctly. After the user command has been processed, the players revert to their original positions.

    end

    Network latencies and lag compensation can create paradoxes that seem illogical compared to the real world. For example, you can be hit by an attacker you can't even see anymore because you already took cover. What happened is that the server moved your player hitboxes back in time, where you were still exposed to your attacker. This inconsistency problem can't be solved in general because of the relatively slow packet speeds. In the real world, you don't notice this problem because light (the packets) travels so fast and you and everybody around you sees the same world as it is right now.

  • 相关阅读:
    2014/7/24
    POJ 3414 Pots BFS
    hdu5119 Happy Matt Friends(dp)
    hdu1285 拓扑排序+优先队列
    串口參数具体解释:波特率,数据位,停止位,奇偶校验位
    浅谈软件销售工作
    设计模式及其学习方法的个人理解
    Apache + Tomcat + JK 集群
    SpringMVC案例2----基于spring2.5的注解实现
    poj
  • 原文地址:https://www.cnblogs.com/lightlfyan/p/4201109.html
Copyright © 2011-2022 走看看