How to properly set up predicted spawned ghosts to start from correct tick?

If you predictivly spawn a ghost through BeginSimECB, from what I can see it may not end up being setup to start predicting from correct tick? You might e.g. run two IsFirstTimeFullyPredictingTick in the predicted loop. Is there some feature to work around this like setting the tick it was spawned to a component in the instatiation?

It is possible in case the client runs slow to have in the same frame multiple ticks for which the IsFirstTimeFullyPredictingTick is set.
Indeed, using the ECB for the spawned ghost the spawn tick will be off slight a bit in respect to the correct spawn time, and while correct (in that sense it is like it was spawned in the last full predicted tick) it may cause mis-classifcation.

Unfortunately not out of the box. The system responsible to assign the spawning tick is the PredictedGhostSpawnSystem, that uses the current tick to mark the spawn time.

However, it is not such a problem the spawn tick does not match, in general, if the classification system uses other way to match the spawned ghost.

That being said it is still possible to change this behaviour with your own custom component and logic after the spawn occur, i.e via change filter to detect the newly spawned ghost. It is a little sub-optimal, I do understand.

We can provide such a component if felt really necessary or we have can expand
the PredictedGhostSpawnRequest to contain the spawn tick too (while that may cause a slight increase in memory usage for nothing). Or another approach would be to let you write in the CommandBuffer the initial value of the GhostInstance.
All these still require package changes.

1 Like

Did you ever decide on improving upon the GhostInstance.spawnTick? From what I can see PredictedGhostSpawnSystem will set spawnTick one tick less when using ECB in BeginSim to spawn ghosts.

No we did’t yet properly changed that.
Also not, spawning from ECB was the only proper correct way (I fixed couple of bug when spawning directly inside the prediction loop in 1.3).

Sorry, I don’t understand what you meant with this? Was my statement wrong?

No the statement was correct.
It was me overthinking and mentioning another bits of information on top of it (the fact predicted spawning in the prediction loop does not work correctly in 1.2. The correct approach is to use the command buffer to avoid certain problems).

1 Like