AInur Posted October 25 Report Share Posted October 25 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. Quote Link to comment Share on other sites More sharing options...
bb_ Posted October 25 Report Share Posted October 25 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. 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.