This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "Server Updated Shots"

From BZFlagWiki
Jump to: navigation, search
(Server Shot State)
Line 9: Line 9:
  
 
It would also be up to the server to send out endshots to all clients. The game client should never send an actual endshot.
 
It would also be up to the server to send out endshots to all clients. The game client should never send an actual endshot.
 
==Guided Missile Update Changes==
 
The MsgGMUpdate will be changed to only send out the newly targeted player.  This update should [clarify] happen after a PlayerUpdateMessage, so the server has the most accurate state for the player. If the lock-on change is valid ( verified via the server DR state that should now match the client DR state ) the server will send out Shot Updates for the GM shot to all players, including the shooter.
 
  
 
==Generic Shot Updates==
 
==Generic Shot Updates==
A new MsgShotUpdate will be created that can send a new time stamp, position, vector, and lifetime for any shot. Any client that receives this message needs to find the shot, delete the old shot path, create a new shot path/strat with the starting position, vectors, and times, then plot the shot position forward to the current server time. This may make shots "pop" as they update if there is a discrepancy, but all states will be valid. This prevents clients from providing invalid GM shot updates, and lets the server do non standard shot dynamics such as gravity well, and enforcing shot ends in a predictive manner. Shot updates should be exposed to the API [clarify, which API].
+
A new [[MsgShotUpdate]] will be created that can send a new time stamp, position, vector, and lifetime for any shot. Any client that receives this message needs to find the shot, delete the old shot path, create a new shot path/strat with the starting position, vectors, and times, then plot the shot position forward to the current server time. This may make shots "pop" as they update if there is a discrepancy, but all states will be valid. This prevents clients from providing invalid GM shot updates, and lets the server do non standard shot dynamics such as gravity well, and enforcing shot ends in a predictive manner. Shot updates should be exposed to the API [clarify, which API].
  
====Reload Slot From the server====
+
==Guided Missile Update Changes==
The reload shot slots will be made to be set by the server on a per player basis using a new MsgShotAmmo message. This message will tell each player how many shot slots they have and what there reload times are. This will be sent out on each flag update and spawn. It will be exposed to the API.
+
The [[MsgGMUpdate]] will be removed. A new message 'MsgLockon' will be added. This message will simply tell the server who the player wishes to lock on to, and notify locked players that they are locked on to. The shot updates will come from the server with a generic [[MsgShotUpdate]].
  
===Shot ID===
+
==Reload Slot From the server==
 +
The reload shot slots will be made to be set by the server on a per player basis using a new [[MsgShotAmmo]] message. This message will tell each player how many shot slots they have and what there reload times are. This will be sent out on each flag update and spawn. It will be exposed to the API.
 +
 
 +
==Shot ID==
 
Shot IDs should be separate from the slot.  The client should take all newly fired shots and assign them a temporary shot ID until it gets the shot back from the server. At this time it would replace the shot ID with a valid server ID to be used with shot updates at a later date. The local client should send it's temporary shot ID when sending a new MsgShotBegin and be passed that local ID back in the verification message. When the server sends the shot back to the local player, it should recompute the shot path from the new data as if it was a remote path, as the server may have modified it. All local shots can go into one big list on the client, as they will have unique IDs.
 
Shot IDs should be separate from the slot.  The client should take all newly fired shots and assign them a temporary shot ID until it gets the shot back from the server. At this time it would replace the shot ID with a valid server ID to be used with shot updates at a later date. The local client should send it's temporary shot ID when sending a new MsgShotBegin and be passed that local ID back in the verification message. When the server sends the shot back to the local player, it should recompute the shot path from the new data as if it was a remote path, as the server may have modified it. All local shots can go into one big list on the client, as they will have unique IDs.
 +
 +
==GM Bhavor==
 +
A clarification of the GM behavor is as follows:
 +
  Having The GM flag confers 2 linked abilities to a tank
 +
    The ability to generate GM type shots
 +
    The ability to set a lockon target.
 +
  All live GM shots in the world will always track to the current lockon target for the player they belong to. This behavor is regardless of the target set when the GM is fired.
 +
  When a tank has no lockon target GMs are unguided.
 +
  When the flag is dropped ( ether manually, or by death) the current lockon target is cleared.
  
 
[[Category:TODO]]
 
[[Category:TODO]]

Revision as of 06:28, 7 April 2008

Picture Frame.png This page contains the design document for an enhancement or feature. It is a work of collaborative development, and may not represent the final design. If you are not part of the development or design group, please post comments and suggestions on the talk page and not in the middle of the design.

This document describes planed changes to shot handling on the client and server.

Problem

Shots can not be updated in mid flight. We need the server to be able to modify any shot in flight and have the game clients adapt to the new changes.

Server Shot State

To do this, we need the server to have an accurate/authoritative representation of the shots in the game. We need to move the shot strategies over from the client into libGame so they can be tracked by both the players and the server. Shots are time stamped with a server clock so syncing the states should not be too hard.

It would also be up to the server to send out endshots to all clients. The game client should never send an actual endshot.

Generic Shot Updates

A new MsgShotUpdate will be created that can send a new time stamp, position, vector, and lifetime for any shot. Any client that receives this message needs to find the shot, delete the old shot path, create a new shot path/strat with the starting position, vectors, and times, then plot the shot position forward to the current server time. This may make shots "pop" as they update if there is a discrepancy, but all states will be valid. This prevents clients from providing invalid GM shot updates, and lets the server do non standard shot dynamics such as gravity well, and enforcing shot ends in a predictive manner. Shot updates should be exposed to the API [clarify, which API].

Guided Missile Update Changes

The MsgGMUpdate will be removed. A new message 'MsgLockon' will be added. This message will simply tell the server who the player wishes to lock on to, and notify locked players that they are locked on to. The shot updates will come from the server with a generic MsgShotUpdate.

Reload Slot From the server

The reload shot slots will be made to be set by the server on a per player basis using a new MsgShotAmmo message. This message will tell each player how many shot slots they have and what there reload times are. This will be sent out on each flag update and spawn. It will be exposed to the API.

Shot ID

Shot IDs should be separate from the slot. The client should take all newly fired shots and assign them a temporary shot ID until it gets the shot back from the server. At this time it would replace the shot ID with a valid server ID to be used with shot updates at a later date. The local client should send it's temporary shot ID when sending a new MsgShotBegin and be passed that local ID back in the verification message. When the server sends the shot back to the local player, it should recompute the shot path from the new data as if it was a remote path, as the server may have modified it. All local shots can go into one big list on the client, as they will have unique IDs.

GM Bhavor

A clarification of the GM behavor is as follows:

 Having The GM flag confers 2 linked abilities to a tank
   The ability to generate GM type shots
   The ability to set a lockon target.
 All live GM shots in the world will always track to the current lockon target for the player they belong to. This behavor is regardless of the target set when the GM is fired.
 When a tank has no lockon target GMs are unguided.
 When the flag is dropped ( ether manually, or by death) the current lockon target is cleared.