- Exactly which systems, if not all systems, are supposed to use client prediction?
Definitely not all systems are supposed to be client prediction. Prediction is meant for things which need to be snappy. This is usually characters, their movement, shooting etc. If something changes often (as in each frame) and the client needs to use it to respond with what’s on screen, that is also a good candidate for prediction. So for example, do your crop fields change often? Is it important that those crop fields react instantly when the player removes it? If no to both question, then there is not much reason for it to stay in the prediction loop, and it would be fine to have it interpolated. But if yes, then you can put them in the prediction loop.
How can I resolve the problem described above?
Generally, you would not want to put a cooldown inside the command data. Command data is usually used for inputs. The cooldown is then a good candidate to put on a GhostField which is processed in the prediction loop, because that is directly controlled by the input. So instead of syncing the cooldown through the command, you would sync the input through the command instead, and then sync the cooldown through a GhostField so that it is rolled back and predicted correctly.
Do all prediction systems require a command stream? Are the fields in the command stream (either ICommandData or IInputComponentData) supposed to be ghostfields or no?
The prediction loop will only run if you have predicted ghosts, and they do not require commands. For example, you could predict other player character’s movements without their actual input by looking at the velocity from the previous tick. The command and input data do not need to be GhostFields. The only reason you would do this is if you wanted to predict the movement of other clients, which can be useful for physics simulations and really twitchy movement where their inputs are assumed to be the same as the last tick. But in most cases, this is not needed.
Should “server-centric” ghosts be interpolated or predicted (eg. server-spawned resources or AI NPCs)? Intuitively I think they should be interpolated (since they’re authoritative on the server with no client input), but if they interact with “client-centric” ghosts (like extractors or client armies fighting AI NPCs), wouldn’t making them predicted make more sense?
There is no one answer to that question, it is highly context-dependent on your game and it really is up to you to choose the solution as it’s more of a design question at this point. I would say that by default, go with interpolation. If that is too slow or not reactive enough, you can start predicting some of the systems. Prediction only adds more CPU cost on the client side than interpolation, it doesn’t change the bandwidth requirements.
Let me know if that answers your questions!