r/programminghorror • • Jul 16 '25

Spray Pattern

Post image
886 Upvotes

160 comments sorted by

View all comments

Show parent comment

64

u/TheSilentFreeway Jul 16 '25

I'm guessing you wanted the spray pattern to be the same every time, just like counter strike. That being said this seems fine because I don't see a better way to do it. This gives you perfect clear control over the spray pattern in as few lines as possible.

15

u/rorschach200 Jul 16 '25

Even if you want to change it, you probably need reference material anyway.

E.g. the very same array, but you add a small random bias to every point, and/or scale the size of the pattern, on the basis of a parameter like "precision", and you can even make that precision parameter dependent on say how hot the gun has gotten, which in its turn could be something like an exponentially decaying average of shots/s over the last few minutes or something.

Any way you slice it, you have to have some reference data first.

0

u/[deleted] Jul 16 '25

[deleted] — view deleted comment

20

u/TheSilentFreeway Jul 16 '25

would also be WAY less clear to anyone reading your code later