Give Server a chance to validate a predicted object instantiation #292
Replies: 7 comments 1 reply
-
Just had a thought about it again: So I also propose to introduce asynchronous response values for ServerRpcs in addition to or as replacement for
|
Beta Was this translation helpful? Give feedback.
-
I tried to workaround this in my 'fire projectile' example, by
That theoretically works but is practically an impossible task:
After thinking about it for too long, I think the best and easiest would be to:
But that in turn would result in having to validate on the server per spawned object instead of per action, which easily becomes hard to validate on server / rollback on client when multiple objects are spawned als a result of an illegal action (e.g. shooting multiple RB projectiles as a triple-shot action). This mainly because you lose the action context. |
Beta Was this translation helpful? Give feedback.
-
Just letting you know I'm aware of this and I've not had a chance to review your comments yet. I will do so by 3.6.1 release though. |
Beta Was this translation helpful? Give feedback.
-
I reviewed your notes but I'm waiting until Prediction v2 before I visit future prediction tasks since version 1 is no longer receiving updates. |
Beta Was this translation helpful? Give feedback.
-
Will this work? #402 |
Beta Was this translation helpful? Give feedback.
-
Accepted but closing out as 402 will cover this. |
Beta Was this translation helpful? Give feedback.
-
This was resolved via Read/WritePayload for NetworkBehaviours. |
Beta Was this translation helpful? Give feedback.
-
There are two ways to spawn a synced NetworkObject (CSP object that use [Replicate] and [Reconcile] methods / NetworkTransform), triggered by an input on the client:
I propose to add a way to allow merging/rollbacking of client-side predicted spawned objects depending on validation done in a server-sided [ServerRpc] method. This would allow to combine CSP (Replicate and Reconcile), client-sided predicted spawning and server validation with the advantages:
Something like:
Use cases for validation:
Example code:
If in the following example actions of other clients can cause a depletion of the ammo, a desynchronization can occur and the client may fire a missile while the server already knows that the ammo is depleted. The server would block the missile spawn for itself and other clients to fight desynchronization artifacts and cheating. Without the proposed solution the missile would still live on on the client, causing even more desynchronization. Instead, we give the client a chance to get in sync again by telling it to despawn the wrongfully spawned stray missile.
The idea of having a ServerRPC method on the server doing the validation is to have full control over a successful application of the action or a possible rollback, while knowing the exact usecase including all involved objects (actually only their objectIds) that were predictably spawned on the client: One validation and rollback for all at once.
The proposed solution is fully compatible with the projectile lag compensation example of FN, which currently does work with two independently spawned, possibly desynchronizing projectile objects - With no reconciliation support at all - on client and server.
Discussion: https://discord.com/channels/424284635074134018/1034477094731784302/1084178038910103563
Beta Was this translation helpful? Give feedback.
All reactions