Factors to consider when building an algorithm for gun recoil

Posted by Nate Bross on Game Development See other posts from Game Development or by Nate Bross
Published on 2011-01-11T06:20:39Z Indexed on 2011/01/11 6:58 UTC
Read the original article Hit count: 429

What would be a good algorithm for calculating the recoil of a shooting guns cross-hairs?

What I've got now, is something like this:

  1. Define min/max recoil based on weapon size
  2. Generate random number of "delta" movement
  3. Apply random value to X, Y, or both of cross-hairs (only "up" on the Y axis)
  4. Multiply new delta based on time from the previous shot (more recoil for full-auto)

What I'm worried about is that this feels rather predicable, what other factors should one take into account when building recoil? While I'd like it to be somewhat predictable, I'd also like to keep players on their toes. I'm thinking about increasing the min/max recoil values by a large amount (relatively) and adding a weighting, so large recoils will be more rare -- it seems like a lot of effort to go into something I felt would be simple.

Maybe this is just something that needs to be fine-tuned with additional playtesting, and more playtesters? I think that it's important to note, that the recoil will be a large part of the game, and is a key factor in the game being fun/challenging or not.

© Game Development or respective owner

Related posts about algorithm

Related posts about playtesting