Desiging for Projectiles

Question / discussion for anyone with thoughts on this topic.

If a game offers something like a tank, then it makes sense that the shell that is shot from the tank is a projectile, and giving it its own rigid body makes sense too.

But should you use rigid bodies for rounds from SMGs that every player carries? When the number or rounds flying through the air go through the roof, the physics engine is being taxed heavily, because it only knows to solve the physics problems one way and has to treat every rigid body independently of each other. The physics engines don't know or have any insight into the relationship of the rounds (e.g., coming from the same muzzle, pointing in the same direction, with perhaps a slow moving deviation in vector, etc.).

When the number of rounds is expected to be numerous at times, wouldn't it make more sense to create just the visual elements and perform an alternative physics yourself that takes very little input and applies a set of rules to a host of rounds as a group? The visual elements could be prefabs without rigid bodies or even colliders, just bare bones visual candy. It may also be possible to generate the visual elements more efficiently with visual effects.

It depends. Even the tank projectile can be a simple raycast at short distances, or your custom calculation taking into account nothing else but the projectile speed, the gravity and optionally wind force to calculate the point of impact - if an arching shot is important for your game. The tank projectile is so fast it needn‘t even be rendered. Jut look at youtube videos of tanks firing … you will never see a projectile. Of course some games do render tank projectiles but these are arrificially slowed down, not realistic speeds.

Regular bullet fire is almost always raycasting. Unless you want something more realistic like in Sniper Elite.

In games it‘s always a trade off between realism (performance)and fun gameplay that drives a decision like this.

[quote=“CodeSmile”, post:2, topic: 907438]
It depends. Even the tank projectile can be a simple raycast at short distances, or your custom calculation taking into account nothing else but the projectile speed, the gravity and optionally wind force to calculate the point of impact - if an arching shot is important for your game. The tank projectile is so fast it needn‘t even be rendered. Jut look at youtube videos of tanks firing … you will never see a projectile. Of course some games do render tank projectiles but these are arrificially slowed down, not realistic speeds.

Regular bullet fire is almost always raycasting. Unless you want something more realistic like in Sniper Elite.

In games it‘s always a trade off between realism (performance)and fun gameplay that drives a decision like this.
[/quote]

I agree with everything you said. I mention the tank because Halo 4 tank shell is slowed down and sort of looks cool. I think the visual cues it gives are superior to realism and I am exploring something like it for my game.

I do think when massive amounts of bullets are in the air and they are projectile, a rigid body for each doesn’t make sense. I would calculate them in groups or patterns. Just wanted to put that out there for thoughts on how would people approach this problem.