Shotguns and playing with time

shotgun fire how do u simulate it :? pretty much figured out, rate of fire, semi/auto fire and reload time by playing with HelloIntersection :slight_smile: but I have no idea how to simulate fragmentation/spread of the shell :oops:



and as for playing with time, how would u go about doing a camera affect like the image attached

mcbeth said:

and as for playing with time, how would u go about doing a camera affect like the image attached


Well, there is always the simplest possibility of multiplying the fps in the update method of your GameStates by a value between 0 and 1 before updating anything else (bullets, animations, ...)

float fpsNew = fps * timeSpeedFactor;



whereas timeSpeedFactor starts out with 1 and when slowing down is decremented (timeSpeedFactor *= 0.95f) until it reaches your desired speed (e.g. 0.1f). then you just leave timeSpeedFactor at 0.1f until you decide to speed up again and (timeSpeedFactor *= 1.05f) to speed it up over time until it reaches 1 again.

if you programmed it right you should use a shitload full of Controllers, just update them with fpsNew instead of the original fps  :)

hope that helps

thank man, I think I understand cheers :slight_smile:



anybody on shotgun scatter :?

mcbeth said:

anybody on shotgun scatter :?


I'm just shooting from the hip here (heh, pun totally intended), but I'd make a number of rays starting from the same location and going out in random, but really similar directions..  Remember that the further the shots go, the less likely you'll be to hit something, so it'll take a bit of playing with the degree of variation available to the different bits of buckshot.

As a suggestion to the tune of sheer badass, make an option to shoot slugs and sandbags as well :D
sbook said:

mcbeth said:

anybody on shotgun scatter :?


I'm just shooting from the hip here (heh, pun totally intended), but I'd make a number of rays starting from the same location and going out in random, but really similar directions..  Remember that the further the shots go, the less likely you'll be to hit something, so it'll take a bit of playing with the degree of variation available to the different bits of buckshot.

As a suggestion to the tune of sheer badass, make an option to shoot slugs and sandbags as well :D


I'm going for visible bullets/slugs :), as for the scatter, when I was playing HelloIntersection and auto-fire I tried to add variation due to "kickback" to getDitection.y/z by adding a random float between 0 and 1, didn't look too good but then didn't spend more then a couple seconds on it, I'll try it again and look around to see if there are exanple code foror that can be adapted to scatter on the forum

the way i've seen most games handle kickback/recoil is by changing the direction of the next projectile