#Entities Netcode Rollback and Replay issue?

1 messages · Page 1 of 1 (latest)

dire oracle
#

Hello, i am making automatic guns. My system sets ShootEvent and delay(1 second) when mouse button is on hold, and does nothing when delay is already present. My expectations is that on server and on client ShootEvent would be activated on player input just once and then after delay it would be able to be activated again. In reality when mouse is pressed (control.primaryAction) i see way more than just two messages like, looks like TriggerJob ignoring delay check which is not really possible or netcode is making some rollbacks/replay for unknown reason and i dont know how to avoid it.
At the end of the day my goal is to activate ShootEvent component once on client(for trails and stuff) and once on server(for dealing damage), because now client shows around 7 trail effects for on shot. I would be grateful for any help!

stone schooner
#

read https://docs.unity3d.com/Packages/com.unity.netcode@1.5/manual/ghost-spawning.html#implement-predicted-spawning-for-player-spawned-objects
it shows how to avoid spawning something multiple times during prediction
and try to understand prediction better - it's really counter-intuitive and I will predict that you will suffer regularly if you will slap prediction on anything and hope it will work as is

I can give you tiny advice:

  • predicted jobs should rely on Simulate tag since netcode has some inside control to predict or not predict some ticks for some entities
  • predicted code should write to and only to ghost components because netcode knows how to backup their values and restore during prediction calls
dire oracle
#

I've read this and ignored all updates except for networkTime.IsFirstTimeFullyPredictingTick but it doesn't solves the problem with visuals, i still have more than one trail spawning and logs shows this. Damage is applying correctly, one instance for one shot. Maybe the issue is that i'm spawning GameObjects with line rendrers through static shenanigans, p.s. in screenshot trails lifetime is long so they stay visible for few seconds. Anyway thanks for advise.

#

I wonder if there is some samples or examples of client predicted bullets or trails.