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

Difference between revisions of "DevelopmentPlans/ShotIDCleanup"

From BZFlagWiki
Jump to: navigation, search
(Created page with "==Overview== 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 w...")
(No difference)

Revision as of 19:15, 22 November 2012

Overview

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

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 there 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 it's 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

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.