Jump to content
  • Advertisement
Sign in to follow this  
ill

How are bullets and other weapon effects drawn in FPS games?

This topic is 2594 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

One thing I noticed in FPSes is things like bullets aren't necessarily drawn where they really are in the world.

For example in Doom 3 when you fire the plasma gun I can see the plasma globs originating from the gun he is holding in his hands. But when you see the character in 3rd person the weapon effects still originate from the weapon.

weaponshot1.jpg300px-Plasma_Rifle_Header.jpgteam-fortress-2-20070413051122360-000.jpg

In most games the first person animation doesn't necessarily correspond to how the character looks in the third person, but when a character fires its gun the weapon effects still seem to be perfectly aligned with the gun held in the hand. This leads me to beleive this is all faked somehow. I can see how it's doable with fast things like bullets because no one is going to notice the tracer is a bit off. But what about slower moving things like rockets and plasma globs? Is their path also faked? Do they get drawn along some path originating from the gun that is somehow projected along the true real world path? Do players not notice that things sometimes go through walls or hit walls they shouldn't have?

Or do developers actually keep things like this pretty well aligned? If they do I imagine it's only for the slow moving projectiles at least, because I've definitely seen bullet tracers originate from the gun no matter what. (One example is Medal of Honor Allied Assault. When you shoot a guy and they play a pain animation while firing the gun, the bullets still go towards the player even when the gun is totally rotated the other way)

Share this post


Link to post
Share on other sites
Advertisement
(1) what about slower moving things like rockets and plasma globs?
(2) Is their path also faked?
(3) Do they get drawn along some path originating from the gun that is somehow projected along the true real world path?
(4) Do players not notice that things sometimes go through walls or hit walls they shouldn't have? Or do developers actually keep things like this pretty well aligned?
Of course everyone will use a different solution depending on their needs and time frame.

(1) Plasma globs are rendered by using "billboarding" so they always face the camera. For all other things, they just move as a typical 3D model. In my experience rockets and grenades are generally real models rendered normally. In terms of generating the starting position, they're fairly similar.
(2) Of course everything is fake... it happens in a computer. But anyway... They build the model with special annotations such as "bullets_get_spawned_at_this_point". When they run the numbers, they keep track of the transformations involved, player, its arm, its weapon, the "bullets_get_spawned_at_this_point" point and guess what? The engine spawns the bullet there... or perhaps they'll just spawn them at some fixed position if they have to cut short on time.
(3) What does that mean? huh.gif
(4) Most of the time, the projectiles are spawned with reasonable accuracy. Yes, sometimes they are a bit off and the player notices but it's fairly rare in my opinion. Not really "as rare nobody can recall" but "as rare it's a minority". Or perhaps I'm just accustomed to games programmed by people who care. Sometimes teams can be cut short on budget on timeframe, hence the defect in the product you mention. That's life.

Share this post


Link to post
Share on other sites
Oh yeah I know all about those basics such as billboarding and "spawn_bullets_here"

My question is more like: Are projectiles actually drawn at the real world location or at an approximation of its real world location to help it look like its coming straight from the gun?

I don't think there was nothing really wrong with the way they did it in Medal Of Honor. They just needed to have the character stop firing when doing a pain animation.

Another case is where the character is holding the gun to the right like the Doom guy holding the plasma gun above. What if there's a window in the way to the right a little? I never see something like that in modern games get in the way of a projectile. If my crosshair is pointing at it, I can shoot it. The plasma gun won't get blocked by the wall just because it's coming from the right of the screen and not straight from the center of the screen. This makes me think that the plasma globs are drawn to look like they are coming from the gun while their real world position is a bit off and actually coming from the center of the player. It just seems like it would be a nightmare to try to keep things like this perfectly aligned.

I looked at the character animations in Doom 3 for looking straight, up, and down. There's no way they are truly perfectly aligned with the character's aiming direction. Yet when projectiles come out they look like they come from the "spawn_here" point.

Share this post


Link to post
Share on other sites
For a game I helped out with bullets were objects with real XYZ position, pathing nodes, and collision trigger events, independent of the gun or player that fired it. However, im sure there are as many ways of handling bullets as there are first person shooters.

Share this post


Link to post
Share on other sites

Oh yeah I know all about those basics such as billboarding and "spawn_bullets_here"

My question is more like: Are projectiles actually drawn at the real world location or at an approximation of its real world location to help it look like its coming straight from the gun?

I don't think there was nothing really wrong with the way they did it in Medal Of Honor. They just needed to have the character stop firing when doing a pain animation.

Another case is where the character is holding the gun to the right like the Doom guy holding the plasma gun above. What if there's a window in the way to the right a little? I never see something like that in modern games get in the way of a projectile. If my crosshair is pointing at it, I can shoot it. The plasma gun won't get blocked by the wall just because it's coming from the right of the screen and not straight from the center of the screen. This makes me think that the plasma globs are drawn to look like they are coming from the gun while their real world position is a bit off and actually coming from the center of the player. It just seems like it would be a nightmare to try to keep things like this perfectly aligned.

I looked at the character animations in Doom 3 for looking straight, up, and down. There's no way they are truly perfectly aligned with the character's aiming direction. Yet when projectiles come out they look like they come from the "spawn_here" point.


take a look at tf2. as a heavy you can strafe so that you are looking at a wall, but your gun is still firing past it, because it is carried to the right of the players mesh center.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!