From BZFlagWiki
Jump to: navigation, search


The current method of having a fixed list of shots per player is not very good. It does not allow the server to do much with the shots and often runs into problems with the reload code

Decouple Reload List From Shot List[edit]

The first thing to do to clean up the shot ID system is to give each client and the server a single dynamically allocated shot list, with unique IDs per shot.

When a player fires a shot, they allocate an item in the existing per player shot array that is limited to the value of MaxShots from the server. This list represents the shots the tank has fired normally and is used for reload computations. These shots are given a temporary ID based on the slot number and sent to the server. The server will then add the shot to the master shot list and give the shot a global ID. The shot will then be sent back to all players including the shooter. The shot data will include the temporary shot ID the client assigned it in addition to the GUID. Players other then the shooter will add the shot to their global list and draw it as normal. The shooter will add the shot to the global list and replace the shot in his local per player list with a reference to the new global shot.

World weapons or server created shots will simply be added to the global list and processed. Shots need to contain more info then they do now, including the flag fired, shot data, and player data. This allows a shot to be processed independent of its shooter.

When clients draw and process shots they must process the entire global list, and any local shots with temporary IDs.

Server Side Shot Paths[edit]

Once the server has a global shot list, it would then need to have shot paths for each shot that is updated with time. This can lead to the ability to detect hits and deaths server side if the simulation is actuate enough.

This can be done in stages.

  1. Add a message to let the server update the location of any shot
  2. Move the GM logic to the server, it is a simple shot path that doesn't need rico and already has lag.
  3. Add server side paths for the other shots and then compare death messages to predicted death locations and see how close they are.