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

Server Updated Shots

From BZFlagWiki
Revision as of 17:05, 14 April 2007 by JeffM2501 (Talk | contribs)

Jump to: navigation, search
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.

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

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

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.