Client side projectile prediction lag compensation

Hi,

I am stuck at correctly updating the projectile I am shooting from my player.
I am updating it every OnUpdate:

    [UpdateInGroup(typeof(PredictedSimulationSystemGroup))]
    public partial struct NetworkProjectileSystem : ISystem
    {
        public void OnUpdate(ref SystemState state)
        {
            foreach (var (data, transform, entity) in SystemAPI.Query<NetworkProjectileData, LocalTransform>()
                         .WithEntityAccess().WithAll<Simulate>())
            {
                var newTransform = transform;
                var newData = data;

                var from = transform.Position;
                var distance = data.stats.velocity * deltaTime;
                newTransform.Position += newTransform.Forward() * distance;
                ecb.SetComponent(entity, newTransform);
            }
            ecb.Playback(...)
        }
    }

However when I log out the data, only the server successfully updates the values of the projectile.
[Client] [124] [Entity(428:2)] Pos: 2.631364 → 2.763488
[Client] [125] [Entity(428:2)] Pos: 2.631364 → 2.763488
[Client] [126] [Entity(428:2)] Pos: 2.631364 → 2.659181

As you can see I am updating the positions in the loop, but in every prediction step the values are reset to their original value again.

The projectile prefab is set to OwnerPredicted, with HasOwner flag enabled.
The projectile gets instantiated in the client & server OnUpdate and the owner is correctly set.

Do you have any idea what I am missing to get this working?

I am working on the latest ECS 1.0

I’m seeing this exact same problem with a laggy client (~1s) setting their LocalTransform position. Within the predication loop, the client sets their position, but then in the next loop with the next serverTick, it’s back to using the server’s value. I don’t see how the predication can work if the server always stomps the value, even though the client is far behind the server’s tick.

Nevermind, I only see this pattern when using the simulator in the multiplayer tools. With a natural lag, all is working as expected.