how do bullets work in games>?

This topic is locked from further discussion.

Avatar image for ixi311downerixi
ixi311downerixi

887

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1 ixi311downerixi
Member since 2004 • 887 Posts

any articles on how they work in games.....?....i googled but couldnt find any

Avatar image for fillup0
fillup0

398

Forum Posts

0

Wiki Points

0

Followers

Reviews: 12

User Lists: 0

#2 fillup0
Member since 2005 • 398 Posts
They enter as a physics objectand go where you aimed the crosshair quickly.If it is interupted by another physics objects, it moves it a little. If it is interupted by a player, it makes the player take damage.
Avatar image for weirjf
weirjf

2392

Forum Posts

0

Wiki Points

0

Followers

Reviews: 20

User Lists: 0

#3 weirjf
Member since 2002 • 2392 Posts

In what sense to you mean by "work"?

I know of two systems for bullets and bullet damage. You have the weapons that fire an actual physical (in game terms) bullet and depending on the damage system will cause X, X-XX, or "your dead" damage to the entity that it strikes. These bullets are the type that you have to lead your target. (think the nail gun in TFC)

Then you have hit-scan bullets. These aren't actual bullets, just an effect. The "bullet" strikes with no delay or travel time. Essentially you click, and if your aiming reticle is on the target it registers damage to that target. (sniper rifle in TFC)

Avatar image for D9-THC
D9-THC

3081

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#4 D9-THC
Member since 2007 • 3081 Posts

To the computer it isn't "bullets." It's an instruction set that produces a result that we interpret as bullets.

Basically every "being" has hit boxes.

Every time you click the "gun" performs a firing operation.The firing operation looks at where the crosshair is, applies the random trajectory/accuracy to the shot depending on the gun, and finally checks if the "bullet" was aligned with a hitbox after the firing operation is complete.

If the "bullet" lines up with a hit box you do damage, if it doesn't then that bullet misses.

The randomization of where bullets go can be looked at in this fashion, which should help you understand accuracy and recoil.

Let's say an ak47 has a standard deviation of 2 on the first shot.That gives the bullet a chance to hit anywhere within "2 units" of the center of the center of the crosshair on the first shot.However, the following shots are less accurate to do recoil and you could express those shot in the following fashion.

Higher number = greater deviation from the center of the crosshair.

1st Shot: (1(2x1) = 2 - 2nd shot: (2(2x1) = 4 - 3rd shot: (2.5(2x1) = 5

The more successive shots, the lower the accuracy.

I hope this helps...and I only typed this much because 311 is my favorite band.

This is an example of what hit boxes look like.

Avatar image for ixi311downerixi
ixi311downerixi

887

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#6 ixi311downerixi
Member since 2004 • 887 Posts
so quick question..if i shot a "bullet" then paused the ga,e or something ..could i see that bullet?
Avatar image for D9-THC
D9-THC

3081

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#7 D9-THC
Member since 2007 • 3081 Posts

so quick question..if i shot a "bullet" then paused the ga,e or something ..could i see that bullet?ixi311downerixi

Nope...nothing is flying through the air at all. Only in Farcry and Crysis would that be possible...because bullets are physical objects in those games.

Avatar image for fillup0
fillup0

398

Forum Posts

0

Wiki Points

0

Followers

Reviews: 12

User Lists: 0

#8 fillup0
Member since 2005 • 398 Posts
You would see the bullets in halo 2 or gears even if the game in't paused. The bullets move so slow!
Avatar image for -Unreal-
-Unreal-

24650

Forum Posts

0

Wiki Points

0

Followers

Reviews: 7

User Lists: 1

#9 -Unreal-
Member since 2004 • 24650 Posts
I don't think he's asking about cone of fire, spread and other things relating to the actual gameplay mechanics. I think he is asking about how bullets are represented as objects in games, and noone here has the answer, its one for people that know how things work inside games.
Avatar image for humbugdude
humbugdude

278

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#10 humbugdude
Member since 2004 • 278 Posts

[QUOTE="ixi311downerixi"]so quick question..if i shot a "bullet" then paused the ga,e or something ..could i see that bullet?D9-THC

Nope...nothing is flying through the air at all. Only in Farcry and Crysis would that be possible...because bullets are physical objects in those games.

Wrong. Actually I was playing CSS today and unloaded an automatic rifle into a door, then walked backward and to the side, and noticed two bullets hanging in the air in front ofwhere my rifle was positioned. Cool glitch, but disappeared after 4 seconds just like decals and corpses, so i couldnt get a screenshot.

Plus, bullets in FEAR are quite very real XD.

Avatar image for D9-THC
D9-THC

3081

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#11 D9-THC
Member since 2007 • 3081 Posts

Wrong. Actually I was playing CSS today and unloaded an automatic rifle into a door, then walked backward and to the side, and noticed two bullets hanging in the air in front ofwhere my rifle was positioned.

humbugdude

Ok...then tell me the location of the bullet model within the CSS folder...

Avatar image for adrake4183
adrake4183

668

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#12 adrake4183
Member since 2006 • 668 Posts

both max payne's simulated actual bullet travel so if you paused the game you could see the bullets.

Avatar image for SoulOrigin
SoulOrigin

25

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#13 SoulOrigin
Member since 2007 • 25 Posts
very interesting thread and topic
Avatar image for ixi311downerixi
ixi311downerixi

887

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#14 ixi311downerixi
Member since 2004 • 887 Posts
i just would like to jknow though...like just some useful facts...like how each gun...(take cs for instance) differs from one another
Avatar image for Dopemonk736
Dopemonk736

2731

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#15 Dopemonk736
Member since 2006 • 2731 Posts
You aim ata target,press the left button on the mouse. Your weapon fires a projectile, and said projectile penetrates the enemy often killing/wounding them.
Avatar image for D9-THC
D9-THC

3081

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#16 D9-THC
Member since 2007 • 3081 Posts
[QUOTE="humbugdude"]

Wrong. Actually I was playing CSS today and unloaded an automatic rifle into a door, then walked backward and to the side, and noticed two bullets hanging in the air in front ofwhere my rifle was positioned.

D9-THC

Ok...then tell me the location of the bullet model within the CSS folder...

Alright that was somewhat of a riddle because the model doesn't actually exist...I just wanted to see if you would own yourself.

What actually happened is you lagged out for four seconds, fired a couple of rounds from the m4, didn't realize you were lagged out, and stepped back to see the last instance of data that arrived at your system. Thanks to the zero-ping mechanics of valve games, you stay in the game world for about 20 seconds after you lose connection to a server and never realize you've lost connection. So you lost 4 seconds of data causing everything in the game to "freeze" until the next packet arrived.

It wasn't a bug or a glitch...you were looking at the shell casings hanging in mid air because you didn't receive any further data...until 4 seconds later.

When they disappeared you also heard the sound of someone splashing in water.

I've played CS for 9 years...I know it doesn't have visible bullets.

Avatar image for orr25
orr25

25

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#17 orr25
Member since 2003 • 25 Posts

Damn.......you push the fire button, a bullet leaves the barrel of your sellected weapon and if your good enough it kills the target...simple.. why try to complecate things by bringing in physics, unless your trying to make a game, then you are the only one who knows' how bullets are going to react in different situations that arise during combat....

Avatar image for adamus007
adamus007

852

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#18 adamus007
Member since 2007 • 852 Posts
this is an AWESOME thread ive learnt so much hahah keep up the original posts ;)
Avatar image for zbiggie
zbiggie

363

Forum Posts

0

Wiki Points

0

Followers

Reviews: 6

User Lists: 0

#19 zbiggie
Member since 2004 • 363 Posts
i too have noticed the glitch in CSS were the bullets stay in the air hanging around, so i know they do make a physical object, but to the place where they put it in the folder i have no idea
Avatar image for humbugdude
humbugdude

278

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#20 humbugdude
Member since 2004 • 278 Posts
That's a pretty good explanation. Might have been the casings - but I didn't lag out. I killed a few more people going through that doorway during those 4 seconds, which is why I didnt take a moment to look for my print screen key to take a shot of the bulets/casings. No splash of water either. Just people going back and forth and shooting/dying without any unnatural lack of aim.
Avatar image for gs_gear
gs_gear

3237

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#21 gs_gear
Member since 2006 • 3237 Posts
If they hit you they can kill you.:P
Avatar image for END3R330
END3R330

401

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#22 END3R330
Member since 2006 • 401 Posts
it was shell casings or debris from the door. there are no physical bullets flying around in any games, at least until recently. up until the most recent games when you click your mouse it tells the program to execute the lines of code that show your gun fire and register damage. all its doing is seeing if your crosshairs were over a hitbox, like a previous poster said. some games have bullet lag, and take into account how fast the target is moving in what direction and how far away, but in CS the AWP for instance hits immediately wherever your crosshairs were at the time you clicked. if over a hitbox it causes damage the moment the other player's computer recieves the information stating that you clicked their hitbox, thus executing the lines of code that cause your targets damage meter to go down or to execute the graphical representation of death (or whatever you wanna call it)
Avatar image for spam-Robot
spam-Robot

653

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#23 spam-Robot
Member since 2007 • 653 Posts
CSS has absolutley no bullets. Just the casings. TF2 on the other hand has visible bullets other than the sniper.
Avatar image for dual_barrel
dual_barrel

139

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#24 dual_barrel
Member since 2006 • 139 Posts

The way guns differ in a game is as follows (from a gamer's perspective):

handgun- is relatively accurate for shooting targets that you can see without sniper scope and who are not very far away, do relatively lower damage than the other big shot weapons (handguns start out as the basic weapons in a game, generally); not automatic, i.e.,takes some milliseconds delay to fire the next shot, the mouse has to be cilcked to fire every shot, gun firing frequency depends on how faster you click the mouse button; reloading time depends from game to game but this is something you can guess right

shotgun- at point blank range it's supposed to kill enemies, handy for combat in close quarters, especially in narrow corridors; bullets from a shotgun starts to spread out as they travel out from the muzzle, so the enemies nearer sustain the most damage since the bullets deviate as they fly farther; not very useful for shooting enemies that you can see without sniper scope and are far away; reloading time depends from game to game but this is something you can guess right

submachine gun- does good damage; one good way to visualize this weapon is to imagine how the spray of a perfume works for that's exactly how this gun fires bullets; useful in close range, not useful in long range; automatic, i.e., if the mouse is being clicked on, the gun will keep firing, delay inbetween the shots (i.e., bullets going out) is very minimal to the eye; reloading time depends from game to game but this is something you can guess right

sniper rifle- shots are dead accurate; suppose to be one shot one kill; high velocity weapon, i.e., bullets travel way fast, is a powerful weapon both in close range and long range, but there's a time delay inbetween the shots; comes with a scope; reloading time depends from game to game but this is something you can guess right

assault rifle- this is my weapon of choice; may or may not come with a scope; shooting with this kind of game is the ultimate luxury a shooter gamer looks forward to; delay inbetween the shots is minimal just like the submachine gun but is way powerful than the sub; accuracy is cool for both close range and long range; does considerable and satisfactory amount of damage on both the ranges; reloading time depends from game to game but this is something you can guess right

Thankyou.

Avatar image for dual_barrel
dual_barrel

139

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#25 dual_barrel
Member since 2006 • 139 Posts
correction:
At point blank range shotguns are supposed to kill enemies with just one shot.

btw, you wanted to know whether you can see bullets if you pause the game. Yes, you can, if in the game, bullets are separate individual objects and have their rightful animation then you'll be able to see.

In some past games there were subtle animations for bullets like a line connecting the gun to the target to create the illusion that a bullet has traveled. This was done in games where bullets were not actually separate and individual objects.

In modern games that deal with bullets as separate and individual objects, you'll see lines of specific length flying towards you or your comrades from the enemies' guns.

When bullets are individual and separate objects you can dodge them to see them hitting where you were just moments ago.
Avatar image for dual_barrel
dual_barrel

139

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#26 dual_barrel
Member since 2006 • 139 Posts
*fiery lines of specific length
Avatar image for mrbojangles25
mrbojangles25

60619

Forum Posts

0

Wiki Points

0

Followers

Reviews: 11

User Lists: 0

#27 mrbojangles25
Member since 2005 • 60619 Posts

Damn.......you push the fire button, a bullet leaves the barrel of your sellected weapon and if your good enough it kills the target...simple.. why try to complecate things by bringing in physics, unless your trying to make a game, then you are the only one who knows' how bullets are going to react in different situations that arise during combat....

orr25

Its called curiosity, and its a really great thing. Maybe you should have some.

Avatar image for ElectricNZ
ElectricNZ

2457

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#28 ElectricNZ
Member since 2007 • 2457 Posts

The way guns differ in a game is as follows (from a gamer's perspective):

handgun- is relatively accurate for shooting targets that you can see without sniper scope and who are not very far away, do relatively lower damage than the other big shot weapons (handguns start out as the basic weapons in a game, generally); not automatic, i.e.,takes some milliseconds delay to fire the next shot, the mouse has to be cilcked to fire every shot, gun firing frequency depends on how faster you click the mouse button; reloading time depends from game to game but this is something you can guess right

shotgun- at point blank range it's supposed to kill enemies, handy for combat in close quarters, especially in narrow corridors; bullets from a shotgun starts to spread out as they travel out from the muzzle, so the enemies nearer sustain the most damage since the bullets deviate as they fly farther; not very useful for shooting enemies that you can see without sniper scope and are far away; reloading time depends from game to game but this is something you can guess right

submachine gun- does good damage; one good way to visualize this weapon is to imagine how the spray of a perfume works for that's exactly how this gun fires bullets; useful in close range, not useful in long range; automatic, i.e., if the mouse is being clicked on, the gun will keep firing, delay inbetween the shots (i.e., bullets going out) is very minimal to the eye; reloading time depends from game to game but this is something you can guess right

sniper rifle- shots are dead accurate; suppose to be one shot one kill; high velocity weapon, i.e., bullets travel way fast, is a powerful weapon both in close range and long range, but there's a time delay inbetween the shots; comes with a scope; reloading time depends from game to game but this is something you can guess right

assault rifle- this is my weapon of choice; may or may not come with a scope; shooting with this kind of game is the ultimate luxury a shooter gamer looks forward to; delay inbetween the shots is minimal just like the submachine gun but is way powerful than the sub; accuracy is cool for both close range and long range; does considerable and satisfactory amount of damage on both the ranges; reloading time depends from game to game but this is something you can guess right

Thankyou.

dual_barrel

Errrrr, no. Just no.

Avatar image for aussieboy911
aussieboy911

980

Forum Posts

0

Wiki Points

0

Followers

Reviews: 10

User Lists: 0

#29 aussieboy911
Member since 2007 • 980 Posts

yea read the forum before you make an ass of yourself dual_barrel. this is about bullets not how much damage a shotgun will do over a handgun.....

and on whether a bullet would be a real object or an effect- i reckon it would have to be an effect because otherwise the computer would have to process every bullet- the game would just be lag heaven wouldnt it? if it didnt lag it would only be because the bullets are so small..... im not much of a techie guy so i dunno.....

Avatar image for xcryonicx
xcryonicx

1294

Forum Posts

0

Wiki Points

0

Followers

Reviews: 5

User Lists: 0

#30 xcryonicx
Member since 2006 • 1294 Posts

Damn.......you push the fire button, a bullet leaves the barrel of your sellected weapon and if your good enough it kills the target...simple.. why try to complecate things by bringing in physics, unless your trying to make a game, then you are the only one who knows' how bullets are going to react in different situations that arise during combat....

orr25

Because THINKING is a perfectly normal and healthy mental process? Oh and because it's not outlawed in the United States (yet) either.

Avatar image for xcryonicx
xcryonicx

1294

Forum Posts

0

Wiki Points

0

Followers

Reviews: 5

User Lists: 0

#31 xcryonicx
Member since 2006 • 1294 Posts
Something I might be able to add to the topic: Think about how in Oblivion, when you fire arrows/projectiles at an enemy. It isn't an instantaneous damage hit, but moreso based off the actual object making contact with the NPC. I think shooters work slightly different to accomodate the rapid firing speed (much faster than a longbow, der der), but just an example of what I think people might confuse on the subject. Given the tactical nature of FPS's and my lack of knowledge in programming, I think this question would be best answered by someone who has worked with game development...
Avatar image for fillup0
fillup0

398

Forum Posts

0

Wiki Points

0

Followers

Reviews: 12

User Lists: 0

#32 fillup0
Member since 2005 • 398 Posts
Halo and gears has moving bullets... but the sniper in both games I think just makes whatever is under the crosshair take damage.
Avatar image for DrDoomed
DrDoomed

11386

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#33 DrDoomed
Member since 2003 • 11386 Posts

watching the bullets won't really teach you how a gun works. knowing the damage it deals and the actual impact anims and player hit sounds will. Otherwise the projectiles will probably be visible to the naked eye or have a tracer effect.

research your game of choice on the net and you will probably find the weapon stats for it if it is played seriously online.

Avatar image for D9-THC
D9-THC

3081

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#34 D9-THC
Member since 2007 • 3081 Posts

The way guns differ in a game is as follows (from a gamer's perspective):

handgun- is relatively accurate for shooting targets that you can see without sniper scope and who are not very far away, do relatively lower damage than the other big shot weapons (handguns start out as the basic weapons in a game, generally); not automatic, i.e.,takes some milliseconds delay to fire the next shot, the mouse has to be cilcked to fire every shot, gun firing frequency depends on how faster you click the mouse button; reloading time depends from game to game but this is something you can guess right

shotgun- at point blank range it's supposed to kill enemies, handy for combat in close quarters, especially in narrow corridors; bullets from a shotgun starts to spread out as they travel out from the muzzle, so the enemies nearer sustain the most damage since the bullets deviate as they fly farther; not very useful for shooting enemies that you can see without sniper scope and are far away; reloading time depends from game to game but this is something you can guess right

submachine gun- does good damage; one good way to visualize this weapon is to imagine how the spray of a perfume works for that's exactly how this gun fires bullets; useful in close range, not useful in long range; automatic, i.e., if the mouse is being clicked on, the gun will keep firing, delay inbetween the shots (i.e., bullets going out) is very minimal to the eye; reloading time depends from game to game but this is something you can guess right

sniper rifle- shots are dead accurate; suppose to be one shot one kill; high velocity weapon, i.e., bullets travel way fast, is a powerful weapon both in close range and long range, but there's a time delay inbetween the shots; comes with a scope; reloading time depends from game to game but this is something you can guess right

assault rifle- this is my weapon of choice; may or may not come with a scope; shooting with this kind of game is the ultimate luxury a shooter gamer looks forward to; delay inbetween the shots is minimal just like the submachine gun but is way powerful than the sub; accuracy is cool for both close range and long range; does considerable and satisfactory amount of damage on both the ranges; reloading time depends from game to game but this is something you can guess right

Thankyou.

dual_barrel

You forgot something very important...Armor penetration. Oh yeah and damage degredation over distance.

A pistol will own someone without armor...but someone with armor will take minimal damage. I would guess that armor reduces pistol damage by about 200%...unless it hits the head in which case a helmet lowers the damage by about 50-60%. Pistol damage reduces significantly at a distance. Sniping someone with the glock can take 30 hits...

Shotguns can easily kill in one shot if someone doesn't have armor...but with armor I would guess that shotguns do about 50-75% less damage per shot. Helmets really stop buck shot too. Not too much damage degredation over distance but you don't take sniper shots with a shotgun anyways so it's hard to tell.

SMGs are super deadly against people without armor but going against armor with an SMG can be frustrating. SMGs do about 100% less damage against someone with armor. It might take 5 shots with an mp5 to drop someone without armor and with armor you can realistically expect 10 shots to drop someone. Lots of damage degredation over distance with SMGs...similar to pistols but not that extreme.

Sniper Rifles really ignore armor. Two shots with the scout to the body = kill no matter what armor. One shot to the head = death no matter what armor. I don't know about the AWP because I refuse to use it. No damage degredation over distance.

Assault Rifles pretty much ignore armor. It might take 3 shots to kill someone without armor but it will probably take 4. Against someone with armor it will probably take 4 shots but sometimes it takes 5 if you have an m4. No damage degredation over distance.

Avatar image for D9-THC
D9-THC

3081

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#35 D9-THC
Member since 2007 • 3081 Posts

yea read the forum before you make an ass of yourself dual_barrel. this is about bullets not how much damage a shotgun will do over a handgun.....

and on whether a bullet would be a real object or an effect- i reckon it would have to be an effect because otherwise the computer would have to process every bullet- the game would just be lag heaven wouldnt it? if it didnt lag it would only be because the bullets are so small..... im not much of a techie guy so i dunno.....

aussieboy911

Did you read it?

i just would like to jknow though...like just some useful facts...like how each gun...(take cs for instance) differs from one anotherixi311downerixi

Avatar image for NosmoKing1984
NosmoKing1984

115

Forum Posts

0

Wiki Points

0

Followers

Reviews: 4

User Lists: 0

#36 NosmoKing1984
Member since 2007 • 115 Posts

D9-THC is absolutely correct about CSS, this method of bullet calculation is also true for a lot of games. The current trend is to use a physical object and calculate impacts with the actual playermodels via the physics engine. Engines that do this are Doom3Engineand Unreal Engine 3 off the top of my head, I also hear that Crysis uses a similar method as well.

With physics controlling the collision with bullets, you actually need to aim slightly ahead of the enemy to accomodate for bullet travel which is far more realistic than the CSS method of instant detection. You'll also notice in the screenshot that D9-THC posted that the hitboxes are larger than the player model, which is obviously not very realistic.

Most games that actually use the physics engine to calculate bullet collisions don't draw a bullet as such, they might draw a line to indicate something moving fast like has already been mentioned but only Max Payne and Fear that I can think of actually draw a bullet model. I'm not sure but I think Fear only draws a bullet when in slow motion though.

Personally I think it's much better using the physics engine because it increases the realism in the game which makes the game more believable, but it can get frustrating sometimes when you just can't hit anyone.

aussieboy911, calulating the bullets in physics doesn't harm performance at all. Physics calculations are very optomised these days, I believe the Havok 2 engine in HL2 is capable of calculating 400+ solid body objects in real time without harming the FPS. The PhysX on the other hand can do many thousand solid body collisions as well as many other effects like cloth and liquid. Though the PhysX requires added hardware.

Have fun.

Avatar image for dual_barrel
dual_barrel

139

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#37 dual_barrel
Member since 2006 • 139 Posts

Thanks for the info, D9-THC.

Avatar image for DJGOON
DJGOON

603

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#38 DJGOON
Member since 2005 • 603 Posts

how bullets are modelled in a game depends on the developer. A simple approach is to fire a ray and loop through all bounding boxes (hit box) in the world to find an intersect(quadtrees probably used to optimise). They may choose to animate a bullet moving its vector position in each update call. For something a little more advanced like physics, the physics routine would calculate the updated variables (position, velocity, acceleration, mass, friction, gravity) of the bullet each update call and check for any collisions and handle them accordingly. Operation flashpoint is a good example, for snipers you need to aim sometimes up to 3m above and in front to counter bullet drop and time delay (althoughwhile this is more accurate than most gamesI am not sure howit would stack up to areal world test).

Avatar image for Termite551
Termite551

1125

Forum Posts

0

Wiki Points

0

Followers

Reviews: 14

User Lists: 0

#39 Termite551
Member since 2006 • 1125 Posts
From what I tell, its either the "Bullets are rendered objects traveling at high speed through the game world" or the "The bullet is just a line of code which shows where the bullet hit and if something is there damage it" model. For instance in Halo 3, the spiker shoots out those slow moving very visible shots. In BF2, there is a balistics model but Im not sure if that is actually a bullet traveling time or just a modified contact algorithm. But in general, the instant bullet shot model is the most prevalent, and to the guy who said he saw CSS bullets, those are just the casings, look at the side of your gun while shooting, those have a tendency to glitch and freeze in midair.
Avatar image for humbugdude
humbugdude

278

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#40 humbugdude
Member since 2004 • 278 Posts
Watch some sniping replay videos in Halo 2. Don't know about Halo 1, but in H2 there is a bullet as well as the trail. It just travels much faster. However, you can slow down the recording to the point where you can see it travel.
Avatar image for Mankyblobs
Mankyblobs

188

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#41 Mankyblobs
Member since 2007 • 188 Posts

D9-THC is absolutely correct about CSS, this method of bullet calculation is also true for a lot of games. The current trend is to use a physical object and calculate impacts with the actual playermodels via the physics engine. Engines that do this are Doom3Engineand Unreal Engine 3 off the top of my head, I also hear that Crysis uses a similar method as well.

With physics controlling the collision with bullets, you actually need to aim slightly ahead of the enemy to accomodate for bullet travel which is far more realistic than the CSS method of instant detection. You'll also notice in the screenshot that D9-THC posted that the hitboxes are larger than the player model, which is obviously not very realistic.

Most games that actually use the physics engine to calculate bullet collisions don't draw a bullet as such, they might draw a line to indicate something moving fast like has already been mentioned but only Max Payne and Fear that I can think of actually draw a bullet model. I'm not sure but I think Fear only draws a bullet when in slow motion though.

Personally I think it's much better using the physics engine because it increases the realism in the game which makes the game more believable, but it can get frustrating sometimes when you just can't hit anyone.

aussieboy911, calulating the bullets in physics doesn't harm performance at all. Physics calculations are very optomised these days, I believe the Havok 2 engine in HL2 is capable of calculating 400+ solid body objects in real time without harming the FPS. The PhysX on the other hand can do many thousand solid body collisions as well as many other effects like cloth and liquid. Though the PhysX requires added hardware.

Have fun.

NosmoKing1984

The hit box thing is interesting, but im pretty sure its alot smaller for bf2. Ive shot people in the helmet, missing the faceand not got an instant kill. :(

Most hard to learn and pleasureable once learnt weapon models out there. Bf2 is da s**t

Avatar image for solaris1979
solaris1979

1592

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#42 solaris1979
Member since 2003 • 1592 Posts

how bullets are modelled in a game depends on the developer. A simple approach is to fire a ray and loop through all bounding boxes (hit box) in the world to find an intersect(quadtrees probably used to optimise). They may choose to animate a bullet moving its vector position in each update call. For something a little more advanced like physics, the physics routine would calculate the updated variables (position, velocity, acceleration, mass, friction, gravity) of the bullet each update call and check for any collisions and handle them accordingly. Operation flashpoint is a good example, for snipers you need to aim sometimes up to 3m above and in front to counter bullet drop and time delay (althoughwhile this is more accurate than most gamesI am not sure howit would stack up to areal world test).

DJGOON

DJGoon's got it.

Depending on how realistic the developers want to make a game, there are quite a few ways to go about doing bullets. Now to expand what he said a bit:

I assumed you know how 3d game basically works, by sewing triangles together one after another. Now in order to determine if two object are occupying the same space, you can check to see if any of the triangle between two object intersects. While math for that isn't complex, when your model has 3-4000 polygons computer can be quickly be bought down to its knee just to check if two models intersects (4000 checked against 4000, that's 4000^2 operations, and that's only for 2 model). Here is the appromixation that was mentioned earlier. By using hitbox, instead of using each triangle, the check is much simplified, we can set up an invisible box arounder the player, and if anything breaks that invisible boundry, we then check each of the hitbox to detect if a collision has occur, and this is the basis of 3D collision detection.

Why mention this? Because you can think bullet as an arbitary line, by dectacting if the line intercepts any hitbox on the model, we can then say if tareget has been hit or it misses. precision of the detection then is determined how tightly hitbox is bounded to the body (where quake only uses 1 rectangle box to check for collision and IIRC Half Life uses circle)

Bullet can be defined in two ways. 1) as a projectry object, or 2) as a straight line until it encounter some object.

let's use 2) as it's easier to describe. Whenever you click on fire button, computer will draw a like based on the angle of the view you are looking toward to. so we get this basic 3d line equation of ax+by+cz=0. The computer then draw this line, starting from the gun-point, untile it comes across any bounding box, then detect against crossing the hitbox. Once registered as hit, then computer automatically remove health from the hit object, or if the target is environment, makes some sparks or destroy the hit object. Games where this type of collision is used. Quake's chain gun, majorty of all halo human techology weapons (beside rocket launcher), Half-Life, TFC, CS, Ghost Recon series, Splinter Cell, Unreal, etc. the list goes on and on.

The spread effect of the weapon can be caused by (a+delta)x + (b+delta)y + (c+delta)z=0, where each delta would be programmed to match certain behavior. If you think Halo actually draws bullet, think again, what they did is a clever use of the line equation. Once the line hits a target, they simply replace the line with trail of smoke. Games that uses this effect cleverly include Halo's sniper rifle, and Unreal's ASMD (the hit is determined when you fire the shot, laser traveling were drawn afterward and is actually harmless. )

For 1), that's where things gets interesting. the bullet basically would be treated like a super fast moving rocket. This design makes sense on a big map or realistic shooters as there is no bullet that is instant hitting and at long distance can create illusion of realism. The game basically treat a bullet as a point that will move dx, dy, dz per frame. and when the bullet is moved, you can draw a line between the old position to the new position. and if this line intercept any hitboxes. The object is count as hit. To simulate the effect of gravity, the game can slowly change the position of bullet closer to the ground, hence causing you having to "lead" the target while shooting.

Games that utilize such method, Delta Force, Max Payne series, Stranglehold, any rocket or grenade type weapon you see in game. or any weapon you can clearly see the projectry.

Avatar image for solaris1979
solaris1979

1592

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#43 solaris1979
Member since 2003 • 1592 Posts

D9-THC is absolutely correct about CSS, this method of bullet calculation is also true for a lot of games. The current trend is to use a physical object and calculate impacts with the actual playermodels via the physics engine. Engines that do this are Doom3Engineand Unreal Engine 3 off the top of my head, I also hear that Crysis uses a similar method as well.

With physics controlling the collision with bullets, you actually need to aim slightly ahead of the enemy to accomodate for bullet travel which is far more realistic than the CSS method of instant detection. You'll also notice in the screenshot that D9-THC posted that the hitboxes are larger than the player model, which is obviously not very realistic.

Most games that actually use the physics engine to calculate bullet collisions don't draw a bullet as such, they might draw a line to indicate something moving fast like has already been mentioned but only Max Payne and Fear that I can think of actually draw a bullet model. I'm not sure but I think Fear only draws a bullet when in slow motion though.

Personally I think it's much better using the physics engine because it increases the realism in the game which makes the game more believable, but it can get frustrating sometimes when you just can't hit anyone.

aussieboy911, calulating the bullets in physics doesn't harm performance at all. Physics calculations are very optomised these days, I believe the Havok 2 engine in HL2 is capable of calculating 400+ solid body objects in real time without harming the FPS. The PhysX on the other hand can do many thousand solid body collisions as well as many other effects like cloth and liquid. Though the PhysX requires added hardware.

Have fun.

NosmoKing1984

Guess the question is already answered, but here's a few point i I will say about physics engine. a) no, physics engine still has to treat each object as a practiles. It is impossible and improper for any computer system to treat each moving object as a continous body. How would we do calculation about that? do we check to see if object collide after .001s? .002s? 1s? Hardware or not, evey supercomputer cannot do this kind of calculation in realtime for each object. It is wastful when the object is still moving. Either way, best approxmiation is to a) calculate two moving object to see if they would intercept each other during the time escaped, and b) if they do, when does this collision occur. This is when the extra hardware comes into place.

PhysicsX is basically a super fast calculator that can crunch numbers faster then CPU can as they are dedicated to do nothing but math. Where as physics usually is handeled by CPU, if the extra hardware is presented, CPU can off load all these operation to the card and just wait for the card to return the result. Fundamental of the 3D collision detection still does not change because physicX card is present, it simply is handeled by a much more dedicated hardware.

Now if you are into graphic card as well, that's where hardware physics starts to get funny. I am sure that you are aware of the pixel shader on the DX9 card generation. To produce these shader effect, the graphic card uses the shader instruction to preform some mathematical operation to alter the apparence of pixel on a given image/model. Notice the term mathematical? It turns out through cleaver use of pixel shader engine, you can actually modify the pixel shader to act as a dedicated calculator capable of preforming physics calcation as well. This provides two different ways of dealing with physice, 1) buy physicsX card from Ageia, or b) Havok's ragdoll engine which would be using GPU's shader engine to do the work for them if you have 2 graphic cards.

Here's some afterthought. I do not know if Havok's method is already in effect. But in order to use graphic card in that way, you are suppose to have at least 2 cards, so 1 can be used for graphics and another for physics. In other words, SLI or crossfire has to be disabled (donno if they changed it now). Ageia's card may seem to be a better choice, the only problem is there is yet any game that shows significiant difference behavior by utilizing their cards. Big one comes to mind is GRAW, where having the card active actually makes game a lot more laggy and doesn't provide enough environment interaction that justified the price tag. As of now, Physics card is an even worse offender then Vista's DirectX in the market penetration.

Avatar image for Metroid_16
Metroid_16

254

Forum Posts

0

Wiki Points

0

Followers

Reviews: 9

User Lists: 0

#44 Metroid_16
Member since 2004 • 254 Posts

Im just going to put it out there.

Only in certain new games can bullets be seen. Sure, you could say you saw them in BF2, but you must remember, you don't. Many Machine gun turrets, Helos, and tanks and etc. have a certain number of bullets and tracers. For example, The jeep from BF2 claims to have 4 bullets then 1 tracer. so you know every time you see something yellowy white shoot out, 4 bullets have already come out.

As for physics, in older games it was merely as someone else had previously stated, the bullet travels along its path at x units per second, where x is the speed of the bullet and the units are defined by in game pixels/polygons. Recoil is determind as well often by for every adiitional bullet the gun is pushed x units this way and that (usually predetermined).

Bullets are relatively new. I know in STALKER the bullets actually have good physics - apparantly weight, speed, and the like affect the rate of bullet drop. Most new-ish games will have bullet drop, meaning, gravity affects the bullet. of course, it wont matter from relatively close conditions because of the speed of the bullet, though even a fast sniper will drop after a long time.

does that help?

Avatar image for GodLovesDead
GodLovesDead

9755

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#45 GodLovesDead
Member since 2007 • 9755 Posts

People need to understand is that there are no games where bullets are actual projectiles unless they are slowed and clearly have a texture. It's all instant hit-registration. D9 THC is completely right.

Avatar image for bob9999999999
bob9999999999

103

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#46 bob9999999999
Member since 2005 • 103 Posts
For those of you who don't know much about programming almost all games have actual bullets that leave the position of the gun and travel until they interact with something. However, this usually isn't accompanied by drawing the bullet - the "bullet" is just an object which contains variables such as x-coordinate, y-coordinate, speed(vector), acceleration(vector) etc. If the "bullet" interacts with an "opponent" model (which is mathematically determined by calculating the intersection of shapes - usually rectangles) then you score a hit.
Avatar image for bob9999999999
bob9999999999

103

Forum Posts

0

Wiki Points

0

Followers

Reviews: 8

User Lists: 0

#47 bob9999999999
Member since 2005 • 103 Posts
[QUOTE="NosmoKing1984"]

D9-THC is absolutely correct about CSS, this method of bullet calculation is also true for a lot of games. The current trend is to use a physical object and calculate impacts with the actual playermodels via the physics engine. Engines that do this are Doom3Engineand Unreal Engine 3 off the top of my head, I also hear that Crysis uses a similar method as well.

With physics controlling the collision with bullets, you actually need to aim slightly ahead of the enemy to accomodate for bullet travel which is far more realistic than the CSS method of instant detection. You'll also notice in the screenshot that D9-THC posted that the hitboxes are larger than the player model, which is obviously not very realistic.

Most games that actually use the physics engine to calculate bullet collisions don't draw a bullet as such, they might draw a line to indicate something moving fast like has already been mentioned but only Max Payne and Fear that I can think of actually draw a bullet model. I'm not sure but I think Fear only draws a bullet when in slow motion though.

Personally I think it's much better using the physics engine because it increases the realism in the game which makes the game more believable, but it can get frustrating sometimes when you just can't hit anyone.

aussieboy911, calulating the bullets in physics doesn't harm performance at all. Physics calculations are very optomised these days, I believe the Havok 2 engine in HL2 is capable of calculating 400+ solid body objects in real time without harming the FPS. The PhysX on the other hand can do many thousand solid body collisions as well as many other effects like cloth and liquid. Though the PhysX requires added hardware.

Have fun.

solaris1979

Guess the question is already answered, but here's a few point i I will say about physics engine. a) no, physics engine still has to treat each object as a practiles. It is impossible and improper for any computer system to treat each moving object as a continous body. How would we do calculation about that? do we check to see if object collide after .001s? .002s? 1s? Hardware or not, evey supercomputer cannot do this kind of calculation in realtime for each object. It is wastful when the object is still moving. Either way, best approxmiation is to a) calculate two moving object to see if they would intercept each other during the time escaped, and b) if they do, when does this collision occur. This is when the extra hardware comes into place.

PhysicsX is basically a super fast calculator that can crunch numbers faster then CPU can as they are dedicated to do nothing but math. Where as physics usually is handeled by CPU, if the extra hardware is presented, CPU can off load all these operation to the card and just wait for the card to return the result. Fundamental of the 3D collision detection still does not change because physicX card is present, it simply is handeled by a much more dedicated hardware.

Now if you are into graphic card as well, that's where hardware physics starts to get funny. I am sure that you are aware of the pixel shader on the DX9 card generation. To produce these shader effect, the graphic card uses the shader instruction to preform some mathematical operation to alter the apparence of pixel on a given image/model. Notice the term mathematical? It turns out through cleaver use of pixel shader engine, you can actually modify the pixel shader to act as a dedicated calculator capable of preforming physics calcation as well. This provides two different ways of dealing with physice, 1) buy physicsX card from Ageia, or b) Havok's ragdoll engine which would be using GPU's shader engine to do the work for them if you have 2 graphic cards.

Here's some afterthought. I do not know if Havok's method is already in effect. But in order to use graphic card in that way, you are suppose to have at least 2 cards, so 1 can be used for graphics and another for physics. In other words, SLI or crossfire has to be disabled (donno if they changed it now). Ageia's card may seem to be a better choice, the only problem is there is yet any game that shows significiant difference behavior by utilizing their cards. Big one comes to mind is GRAW, where having the card active actually makes game a lot more laggy and doesn't provide enough environment interaction that justified the price tag. As of now, Physics card is an even worse offender then Vista's DirectX in the market penetration.

By the way... it actually ISN'T that resource intensive to keep track of bullets... Adding two numbers together every few clock-cycles and checking interactions isn't all that difficult. When you fire normally that all happens anyway - INSTANTANEOUSLY. It merely isn't done, because its somewhat wasteful because no-one can actually see the bullets. Even if you can pause the game most bullets are traveling so fast that it would be merely luck if you could even see one while pausing. Havok is able to calculate thousands of INTERACTIONS simultaneously... but most bullets stop after one interaction (eg hitting a wall). This isn't necessary for bullets though.

Avatar image for solaris1979
solaris1979

1592

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#48 solaris1979
Member since 2003 • 1592 Posts

For those of you who don't know much about programming almost all games have actual bullets that leave the position of the gun and travel until they interact with something. However, this usually isn't accompanied by drawing the bullet - the "bullet" is just an object which contains variables such as x-coordinate, y-coordinate, speed(vector), acceleration(vector) etc. If the "bullet" interacts with an "opponent" model (which is mathematically determined by calculating the intersection of shapes - usually rectangles) then you score a hit. bob9999999999
About the only game that draws bullet during game time is probably Max Payne. for others it's just air moving at high speed :D
Avatar image for Atlas_FTW
Atlas_FTW

565

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#49 Atlas_FTW
Member since 2007 • 565 Posts
I love this thread. Everyone's an expert ;)