Misprediction and Server Reconciliation Example

Hi, just trying out the example for Misprediction and Server Reconciliation, but having errors with the code example from here Server-authoritative setup | Unity Multiplayer SDK Documentation | coherence. Do you know what I might be doing wrong?


Also does this example cover rotation reconciliation or just position? If not how would you add that?

Many thanks coherence team :+1:

Hey!

What you’re missing is the import of System.Linq. Please add this somewhere next to existing usings:

using System.Linq;

The FirstOrDefault is an extension method that’s defined in the Linq namespace. We forgot to mention this in the example. I’ll make sure this gets fixed.

Also does this example cover rotation reconciliation or just position? If not how would you add that?

I believe the approach would be identical to position - you’ll want to find the “rotation” binding (make sure it is bound via CoherenceSync configuration first) and subscribe to its sample receive event. Then in the callback you can calculate the difference in angle between predicted and received values and make a correction if needed.

Great thank you very much. :+1:

Ok that has cleared, that error. but now I have a new one:

Assets\Coherence_prediction.cs(13,3): error CS0123: No overload for ‘DetectMisprediction’ matches delegate ‘Action<object, bool, long>’

any thoughts?

Hi AceGames. Apparently the sample on that page is a bit outdated, as the Action you’re listening to has a new signature. (as you can see from the error message you’re getting)

Instead of:

private void DetectMisprediction(object sampleData, long simulationFrame)

try:

private void DetectMisprediction(object sampleData, bool stopped, long simulationFrame)

(you can ignore that incoming stopped parameter for now).

And I’ll fix I fixed the docs, so we don’t get this issue again
 sorry for the inconvenience!

Awesome yea that has cleared all the errors now, thanks very much.

All the best :+1:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.