Jump to content

Attack spread and OOS


Recommended Posts

I would like to draw your attention to the code on spread mechanism in /public/simulation/components/Attack.js

let randNorm = randomNormal2D();
let offsetX = randNorm[0] * distanceModifiedSpread;
let offsetZ = randNorm[1] * distanceModifiedSpread;

data.position = new Vector3D(predictedPosition.x + offsetX, predictedHeight, predictedPosition.z + offsetZ);

The offset for each projectile is calculated by sampling from a random 2D Normal Distribution. If each player computes their own offset, then the values of the offsets would be different, the data.position vector would be different and hence total damage dealt would be different for each player, based on their own random sample. My question is: wouldn't this instantly cause OOS? How is it being handled?

I do observe a greater chance of OOS in large battles, could this be the reason?

 

I have tried to change the parameters and that results in instant OOS.

Link to comment
Share on other sites

It won't cause an OOS. Random numbers are all over the simulation and they do no harm in OOS'es. This due to the simple fact that it are all pseudo-random numbers. Basically, there is a set list of numbers, which is randomly created at the start of the match and agreed by all clients, used for all the random numbers generated in game.(The first call of a random function will give the first entry on the list and so on) So all clients will have the same random number at each instant a random number is asked for.

Also see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random

You can check your commands.txt which has the random seed in the header. That is how replays keep in sync too.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...