So I have a Nuclear-Throne like weapon system in my game, and I'm working on bullet spray. Originally, there was equal odds that the bullet sprayed at any angle within the spray range.

That felt weird and very inconsistent, so I used a power function to randomize the vector. Power functions are locally crushing at zero, so the vector was more likely to hit exactly where the player was aiming and less likely to spray at the extremes, although it was still possible.

However, this just feels unnatural as well. For most of the hits, the bullets go exactly where you want, and then suddenly a single bullet shoots far off to the right or something. Are there better ways of randomly spraying weapons? I've heard of normal distributions and am considering that, but I'm wondering if there are any industry standard methods of doing this.


1 Answer 1


This is a question of game balance and feel, so existence of an 'industry standard' is unlikely.

If you're trying to somewhat approximate real-world projectile spray patterns, a normal distribution will work well. You can tweak the variance to control how accurate the weapon/player are. (If there is an industry standard, this is it.)

If you aren't concerned with matching real-world feel and instead want your projectiles/weapons to seem a bit artificial/alien, you could combine your prior approaches (or something new) probabilistically.

I.e., write something simple like

if(Random.value < randomThreshold){ 
  directionVector = getRandomizedVector(sprayRange);
} else {
  directionVector = getPowerVector(sprayRange); 

Then you can tweak randomThreshold until it feels right.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .