Sign in to follow this  
DirectXFreak

How to model a good machine gun?

Recommended Posts

Do you shoot a ray out and just apply constant damage on the object? Is there a better way? A more realistic way? How does medal of honor do it? Thanks

Share this post


Link to post
Share on other sites
I don't know about medal of honor specifically but most FPS games just use 'hitscanning' for such weapons which is exactly what you describe (trace a ray out to see what is hit). For 'added realism', some games will have some kind of 'noise' they add to the direction/origin/etc of the ray to simulate 'recoil'/'breathing'/'accuracy'.

Bullets move so quickly that accurately simulating an actual projectile isn't really worth it (since it would be at the end of it's path in a timestep or two, it is almost exactly the same as the ray method unless you do MANY physics step each frame for bullet movement).

Share this post


Link to post
Share on other sites
Quote:
Original post by Extrarius
Bullets move so quickly that accurately simulating an actual projectile isn't really worth it (since it would be at the end of it's path in a timestep or two, it is almost exactly the same as the ray method unless you do MANY physics step each frame for bullet movement).


Or use a ray from lastPos to currentPos at each timestep.

Share this post


Link to post
Share on other sites
I think I'd initially shoot a ray out for each bullet to simulate the scattering effect, then the visual effect matches the bullet. I'd like to trace the path of the bullet so it can go through walls, smash windows enroute etc as well (even being deflected in the process) and obviously you have to detect if the bullet reaches player via 6 feet of concrete and prevent this!

Share this post


Link to post
Share on other sites
Hey,

I've been analysing this in my own game as well and decided to go with ray tracing as well. As Extrarius said, trying to model the real velocity of a bullet is almost a waste of time, particuarly in regards to a floating framerate. You'd have to make the velocity vector of the bullet so large that the client rendering wouldn't really notice it anyways.

I as well am unsure about MoH, but I do know that all Quake engines (as far as I can tell) use ray tracing and simply spawn a tracer every now and then to provide the user with a graphical effect which doesn't exactly simulate the bullet, but gives the user a better feel of unloading on another player ^_^.

Permafried-

Share this post


Link to post
Share on other sites
Actually, some games model the bullet's velocity, because there IS a slight delay when you're sniping long range, and it's totally unrealistic to expect the bullet to hit a guy instantaneously a mile away. So if it's close range, save CPU and shoot a ray, if it's long range, shoot a ray but make it extend over .3 second or something.

Share this post


Link to post
Share on other sites
When using flare ammunition at night you can see the bullets flying through the air. It looks like starwars, and the bullets need some time to reach their target 400m away...

So if you want to keep it realistic you should consider this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this