#Recommendations on prediction for rare player actions

1 messages · Page 1 of 1 (latest)

crude stump
#

I have some gameplay where I have player triggered actions that will trigger once every couple of seconds at most and not for a couple of minutes at other times.
Since the actions are rather rare, the IRpcCommands would seem suitable, however https://docs.unity3d.com/Packages/com.unity.netcode@1.0/api/Unity.NetCode.IRpcCommand.html says that they are not meant for player commands, referencing ICommandData and IInputComponentData instead.
ICommandData however says you should prefer it over Rpc if you need to send a constant stream of data from client to server (which is not the case here).

I've now implemented the logic using RPC Commands, however I'd like to do predictions on the results of the actions on the client. Are there any good ways of doing client side prediction (the RPC should have some impact on GhostComponent data).

As an example (my use case isn't exactly that but it's easier to explain) - having an RTS game where you rather rarely issue a move command where you provide a target location.

Is the way to go to just have an ICommandData/IInputComponentData on every single unit, very rarely change it and hope delta compression is good enough to take care of it? Seems rather dirty and like a waste of transmitted data.

barren rock
#

you're supposed to have Input component only on connection aka player

#

what instead you do is you pass entity reference inside (I believe it works)

#

and whatever command is associated with it

crude stump
#

@barren rock do you have any reference on where it says that you're supposed to only have Input components on the entity with the connection?
This is the first time I'm hearing this, haven't found it anywhere in the documentation or manual sections and it would seem very counter-intuitive for any type of gameplay where it's not the classic player controlling a character style pattern.

When you say passing entity reference inside, do you mean inside ICommandData/IInputComponentData or on an RPC?

Even with that all, that doesn't address at all on how prediction would be done.

barren rock
#

With input component

#

It can only be one

#

By reference I do mean just entity field in input struct

crude stump
barren rock
#

Prediction is same as everything else

#

You sync input, clients predict using input values

#

That's it

crude stump
#

Okay, so basically what you are saying is that I should use IInputComponentData even for very rare actions?

barren rock
#

Yeah

#

Unless you want a guarantee of delivery for action

#

But you are ok with required boilerplate and strictural changes and lack of built in prediction