Q: Why can the client not predict the entire world?

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:
Q: Why can the client not predict the entire world?

Post by Carsten » 2007-08-04, 11:36

Q: Why can the client not predict the entire world?

A: The key idea behind this question is to have the Cl run exactly the same code as the Sv for all entities, hopefully obtaining the exact same results. The Sv then only transfers the entities origins + angles in its occasional snapshot messages to the Cl, so that any divergences can be snapped back into sync with the Sv state.
Unfortunately, client prediction requires that the Cl knows the exact and complete state of the entity it wishes to predict.
This is true for the local human player, where it knows the origin, the angles, the player mouse and keyboard input and other parameters. Later, when the exact same data arrives at the Sv, the Sv will perform the exact same calculations which will in most cases yield the same result as on the Cl. (Otherwise there was a prediction failure and the Cl is updated in the next snapshot).
For all other entities however, the Sv normally keeps huge and complex state information for each entity (e.g. the AI or physics state). Although this information can normally be serialized to savegames, it is quasi impossible to transfer it with the network snapshot messages.
(Note that 3D world GUIs are "regular" entities in this regard: They can run eye-candy on their own, but everything beyond that must occur via the server.)

Therefore, Cl prediction has a natural limit: It can only predict entities for which it also knows the entire relevant server state. This is typically true for the local human player only, and for entities that have no relevant state. Such entities require no prediction in the first place, however. ;)


:!: IDEA: Can we skip reprediction when the incoming Sv update is identical with the previously predicted state? :?: (Have a convar control this.) (Must the state be bitwise identical? E.g. the origin can be rounded to a fixed-point number instead.)
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 101 guests