Game Development Community

Sniper Rifles / Machine Guns : Hitscans or Projectiles?

by J.P. Berry · in Game Design and Creative Issues · 02/07/2008 (9:03 am) · 5 replies

I've been prototyping a Delta Force-esque game. After setting up my zoom and breathing effect, I just don't feel that Torque's projectile class is up for what I need.

I am thinking about using hitscans for the sniper rifle, and projectiles for machine guns. However, Torque's weapon state system leads to sporadic, inconsistent firing. I presume their is some server code/fps issues creating the conflict. I have tweaked the states / delay rigorously to no avail.

Do you, as a gamer or developer, prefer an instant, ray-cast/hitscan method, or the slower projectile class that allows for ballistics? Do you prefer a method for automatic machine guns over sniper rifles?

#1
02/07/2008 (9:55 am)
Professionally, I prefer realistic 3D ballistics with time of flight, gravity, drag, and time varying wind fields.
Of course, you should include dust spurts and sparks so when I miss my spotter can at least see where it hit.
It would be nice if I could hand load cartridges and tune the ammo to optimize the accuracy of my personal rifle also.

On the other hand, I have spent a lot of "winding down from work" time by plinking PT boat helmsmen in the head in BattleField 1942. So noisy lasers are fun too.
#2
02/20/2008 (2:34 pm)
Would either of these methods be more or less efficient in a multiplayer environment? Are hitscans more efficient bandwidth wise, or is the discrepancy too low to worry about?
#3
02/20/2008 (3:04 pm)
Projectiles are objects that must be tracked across their entire lifetime. And unless I'm mistaken, use hitscans to determine if they collide with something durring movement.

Think back to older FPS games, like quake and quake2, the weapons with the highest rate of fire were hitscans, while the slow refire, powerful ones were projectiles.
#4
02/20/2008 (3:32 pm)
Quote:
Would either of these methods be more or less efficient in a multiplayer environment? Are hitscans more efficient bandwidth wise, or is the discrepancy too low to worry about?

It depends. We solved it this way:

* Hitscan
Pros: Fully replicated on client so server only has to tell clients the fire state of each image. Uses one raycast only (obviously) so it also doesn't require as many cycles to complete.
Cons: Easily gets out of sync if latency is high.

* Normal projectiles
Pros: Fully replicated on client so server only has to tell clients the fire state of each image. Heavier than a hitscan though because it "travels" and isn't instant.
Cons: Easily gets out of sync if latency is high.

* Accurate projectiles
Pros: More accurate than the two above. We usually only use this for homing missiles.
Cons: Requires more bandwidth than normal projectiles.

Also, in stock Torque the projectiles cast rays on each tick. We don't do this. We modify the tickrate of the raycasts based on projectile speed. For fast projectiles, it won't be noticable.

Hope that gives you some ideas on how to proceed.
#5
02/22/2008 (11:21 am)
I would recommend hit scans because they're efficient. In terms of sparks or hits I would add a particle effect where the bullet would have hit. If it's a sniper rifle the round is moving far too fast to be seen in the air. If players can see it, it's an object, if they can't, it's a hit scan.