Download

Just LineTrace or "real" bullets?

Hi,

I have played third person shooter games and noticed that there are two ways of how shooting works.

  1. The evil within : As far as I can remember this game never spawns any bullets, it just uses a simple crosshair-linetrace system.

  2. Watch Dogs : It seems as though real bullets are spawned and fly in direction of the crosshair. On impact some effect is fired, i.e. particle effect, or death animation.

  3. The Unreal “Cowboy” Demo : Also uses real bullets.

In real life you would never ever see bullets flying, but are there any advantages of using real bullets objects and checking if they have hit something in comparison to just checking a traceline towards the crosshair?

Thanks,
Michael

With using actors as bullets you can control the speed and have them affected by gravity. For example, say you were making a rocket launcher and needed to slow it down to not go as fast as a bullet: That’s just modifying a few values in the projectile movement component (if you’re using that)

using “real” bullets can increase realism for example sniper game when you need to predict target movement like in battlefield

“Real bullets” every day, anything else is just lazy. It’s 2015, we should be able to expect proper bullets out of a shooter, it’s kind of a big part of these games. :stuck_out_tongue:

I prefer " real " bullets. :slight_smile:

Depends on the type of game and the weapon in question.
Deciding factors can also be networking, because actors can cause a bigger load on networking. It can be avoided with some optimizations if bullet simulation is kept local.

A recent example would be the new UT. They tried a bullet sniper, but it was completetly unusable in a game that fast and where the movement is about making yourself unpredictable to the opponent.

You should only use “real” bullets if you want to model them realistically and you anticipate long distance fighting with bullets affected by gravity, wind etc, or perhaps you want Max Payne style slow mo. That way you can have bullet drop over long distances, or have them curve due to wind, or have bullet-time.

If you’re making an arcade style shooter, or your arenas are small, then use line tracing. It’s cheaper from a performance cost, simpler to implement, and you can still do stuff like wall penetration, material hit effects and so on. The end result will be the same from a gameplay perspective which is what matters. Nobody in game will care if the bullets are “real” or not, just that they work properly and consistently as established by the rules of the game.

Depends. There is no right answer, as it depends on few things:

  1. Amount of realism you aim towards.
  2. Performance constraints.
  3. Size of levels.

With that in mind, you first have to learn how fast real world bullets move. And bullets can have speeds above 1000m/s, this is hardly noticeable by human eye, and more over, you will be hit, before sound of shoot reaches you (bullets have super sonic speeds).
Even small pistols like http://en.wikipedia.org/wiki/Walther_PP have muzlle velocity very close to supersonic speed.

Is it worth to simulate projectile in this case ? For most games my answer would certainly be no. It will add nothing to gameplay, and you will waste lots of precessing power of something that would be noticed by noone.
In that case simple line trace, and few approximate calculations for gravity and bullet spread will be enough.

For slow moving projectiles, you of course should use normal actor projectile, as there is usually few of them at once, and they usually slower than average bullet.

The simple fact is, that you CANT dodge bullet shot from pistol, from 100 meters. Shot must be inaccurate in first place, for you to dodge it. Line trace will approximate it perfectly. For most games.

What iniside said - it all comes down to how much realism a game wants to portray.

If its a action oriented, over the top shooter, who cares?
Use hitscan/traces.
It may even be a good way to balance out the different types of weapons.

If its a close quarter oriented shooter, it won’t matter.
Use hitscan/traces.

If its a somewhat realistic shooter with some decently size maps, basic bullets would be ok.
Use projectiles.

If its aiming for some degree of realism and has the potential to have mid to long range engagements, decent bullets physics are a must.
Use projectiles with simulated trajectories, air resistance etc.

@iniside: Yes, dodging a bullet doing a 1000m/s at 100m - not gonna happen.
Reaction time for humans just isn’t good enough.
That said, a target already on the move at 2-4m/s would have moved 20-40cm by the time it takes the bullet to cover that 100m.
And it doesn’t take much to miss :slight_smile:

Great answers, thanks a lot. Well, I sort of like the idea of realistic projectiles, but you’re right of course, it depends on level size. Wind and distance don’t really matter in inside levels (“the last of us” game style)

I would probably still use traces. After first trace I would determine distance, and based on bullet travelling speed, I would calculate delay, from fire to hit, and then after delay make second trace for actual bullet.

Yeah you are right, but I was thinking more on static target :D.
When target is on the move, trace might not be as accurate, on the other hand in multilayer games, there is enough delay (hehe), that line trace might be actually somewhat compensated by network lag :D.

I tried to use actual projectiles, but have found traces to be less of a headache. I think it comes down to the fact that there are many, many different ways to accomplish this, and you need to find what best suits your needs. Most of the time, I think, traces are going to be a little more predictable and easier to manage than physical projectiles. Maybe someone from Epic can weigh in (potentially how they handle ranged weapons in Fortnite…? :cool:)

Also true :slight_smile:

Back in the day (Quake2 days) I would use a trace combined with projectiles if the trace failed and the weapon had a chance of doing damage beyond that distance.
The main reason for doing it that way was that Quake2 had a limit to the amount (its version of) actors before it crapped itself.

This method could be viable for a semi-realistic game, as you’d get the best of both worlds.
Simple performance friendly traces at close ranges, gravity and flight time affected projectiles at long range.

That said, projectiles in UE4 are essentially a serious of linked traces anyway, so…