Counter strike recoil feel

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
gokoon
Posts: 9
Joined: Fri Jan 27, 2012 10:57 am

Counter strike recoil feel

Post by gokoon »

http://www.youtube.com/watch?v=gGXijf32L1g

I would like to have the same recoil-feel counter strike has.

I'm currently focusing on the camera angle (the pitch, not the yaw) and not the bullet trajectories.

I had some feedback and code from a cspromod dev who reverse engineered counter-strike behavior, but it lacks the KickBack() function and I'm stuck for now.

I found some simple function f(t) = c*t*exp(1-c*t). c is a constant, t is time and it behaves like this https://www.google.fr/search?aq=f&ix=hc ... rom+0+to+1

The function works for single shots, but for full automatic weapon it does not because it does not accumulate.

I wonder if I should use some other kind of algorithm, like some integration ? I thought that when shooting bullets, the body muscles work like springs and dampers, and I wonder if there are some facilities in bulletphysics to do that.

So 2 questions:

Have you any idea or experience about recoil simulation in FPS games like counter strike, call of duty ?
If not how would you simulate a spring+damper force in bullet (and is it a good idea) ?
kloplop321
Posts: 55
Joined: Sun Jan 01, 2012 7:37 pm

Re: Counter strike recoil feel

Post by kloplop321 »

The player isn't actually moving, its all just an aim and camera effect.

No real forces are involved in this.

It looks like simple noise and pull-up with the gun.
VicariousEnt
Posts: 50
Joined: Fri Oct 29, 2010 1:37 am

Re: Counter strike recoil feel

Post by VicariousEnt »

yep, he pretty much got it. There is no actual physics used in classic CS to do the recoil (or ballistics for that matter). Its been years since I worked on a FPS, but as I recall when I implemented it for anothe CS style game from that era I used a simple meter that accumalted the kick. Every shot put it up a little bit and a decerementor brought it down, the rate of which would be based on the state the player was in (standing, crouching, runing, walking etc). The Pitch and Yaw variance of the spray was set based on the level of the kick meter and the state of the player, with an additional timer that started on state changes that would scale the inaccuracy up and down from the previous state. I used a random number generator to pick the pitch and yaw of each shot from the camera's dead center using the max extents computed as mentioned.

Like many things in games, you could put the time in to simulate them with real physics but its more often then not far more work then just faking it, far less controllable, more problematic and no one will notice anyways.
Post Reply