Trace or projectile?

Discussions about Coding and Scripting
Post Reply
Torax
Adept
Posts: 406
Joined: Fri Apr 20, 2012 6:38 pm
Personal rank: Master of Coop
Location: Odessa, Ukraine

Trace or projectile?

Post by Torax »

Hi there guys. I'm new on these forums, moved here from communities related to Unreal 1 mod making.

I have some question.
What is more expensive for Engine to process - trace or projectile?
I'm writing a mod for UT now, want to create weapons that mostly use projectiles. But also I try to keep stability and performance.
I mostly incline to projectiles because this is the idea of mod, maybe only few trace-using weapons.
Unreal. Alter your reality..forever...
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Trace or projectile?

Post by Feralidragon »

Projectile takes more processing, explanation:

- The trace is just a single engine instruction (function) which processes a line from point A to B and checks if something is between those and where exactly.

- A projectile in the other hand, has to be spawned, has to load all its properties and be allocated in RAM, runs tons of events (PreBeginPlay, BeginPlay, PostBeginPlay, Spawned, ZoneChange [yeah, it runs this one too], etc), and then in at least one of these events you have more code running to setup acceleration and velocity.
Then, as long the projectile exists, it has the overhead of having to be processed and updated in every single tick (to update the location of the projectile over the time).

Projectiles become even heavier in online play: trace just has to run in the server, no bandwidth taken, while a spawned projectile has to be replicated to the client, which takes bandwidth.

But you don't have to worry much about stability and performance in these terms, as long you don't spawn an exceeding amount of projectiles (and actors all together), like a hundred of them at once for example, you're fine with using them.
Torax
Adept
Posts: 406
Joined: Fri Apr 20, 2012 6:38 pm
Personal rank: Master of Coop
Location: Odessa, Ukraine

Re: Trace or projectile?

Post by Torax »

I thought right way when i thought about that..
Cozz if mod will be playable online, players spawned at the beginning of match just with pistols shall cause lags, when shooting each other. Damn :mad2:
I just wanted to create mod with more realistic ballistic parameters of weapons (rendered bullets, with visible flight trajectories Seems the idea failed in original direction...
Unreal. Alter your reality..forever...
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Trace or projectile?

Post by JackGriffin »

The engine is pretty darn stable and I'm often surprised at what you can get away with. Just to give you a frame of reference for this question there is a weapon called Bpak ripper that fires a nearly unending stream of ripper blades too fast to see the individual ones. I've played in a particular map in the gametype monsterhunt (the map is ATAA) and I've been in the room with a half dozen guys all streaming rippers all over the place until it looks like a complete chaotic mess but the engine goes right on computing the rebound of the ripper and the deaths that occur. It's simply amazing to see and it's one event that really showcases the potential you have at your disposal.

Edit: sorry Torax, posted at the same time as you. In response to you, there is no reason at all you can't do what you want to do with no problems whatsoever. The engine will easily handle all the bullets you want to pump out as fast as you want to create them.

BTW, there is a third option. If you are going to spawn some horrendously fast gun like the electric belt-fed minigun that shoots several thousand rounds a minute you could use the same way that the minigun works. It's a tracefire weapon but visually looks like a projectile using the Mtracer class. The tracefire will always draw but the MTracer will begin to not spawn if you are approaching the limits of what the engine can tolerate.
So long, and thanks for all the fish
Torax
Adept
Posts: 406
Joined: Fri Apr 20, 2012 6:38 pm
Personal rank: Master of Coop
Location: Odessa, Ukraine

Re: Trace or projectile?

Post by Torax »

Seems the only way - create and test online.
Challenge accepted :lol2:
Unreal. Alter your reality..forever...
Post Reply