Various performance questions

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Various performance questions

Post by Tormentor667 »

Concerning GZDoom I have various performance questions, I hope some of the developers team can give me an answer :)

PK3 - Uncompressed or compressed?
Does it make a performance difference ingame (after the game has startet) if a PK3 is heavily compressed or uncompressed? From my understanding, the data gets decompressed before the game starts and loaded into the memory, so it shouldn't make any difference, right?

Shaders or ROLLSPRITE for rotating sprites?
What is more performance intensive when it comes to rotating sprites? If I do this through shaders or if I do this through a ROLLSPRITE flag and rotating the sprite in the actor states?

Ambient Sounds
Imagine I have a map with about 100 ambient sounds placed, but the player is only at a position where he can hear about 10 of them at the same time, are the others still "calculated" and impact performance or are they ignored?

Thanks already for answering these, we are currently improving the performance in BoA so these might be good to know.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Various performance questions

Post by Nevander »

I don't know much from the technical side but I can say that I would prefer to use an uncompressed file so that everything is already decompressed. I'd imagine it would save the engine some work but I don't know how much. And for ambient sounds, what I would do is build my map in such a way that the sounds that you will hear will get activated when the player gets close enough to hear them, I think you can do that with Thing_(De)Activate but I could be mistaken. Changing this for existing maps might be a PITA though, but I'm speaking as a novice on these subjects and not as an engine developer, we need Graf or somebody to truly confirm.
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: Various performance questions

Post by D2JK »

...what I would do is build my map in such a way that the sounds that you will hear will get activated when the player gets close enough to hear them...
This sort of optimizing isn't always beneficial; you have to consider the total performance cost of constantly checking distances from each sound source to each player vs the cost of simply letting all the sounds stay active regardless.
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: Various performance questions

Post by Tormentor667 »

The question simply is: How much performance does this draw if there are 100 ambient sounds scattered around and you only are in the range of 10 of them?
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Various performance questions

Post by Nevander »

How did Duke Nukem 3D do it's ambient sounds? There are some maps where there are quite a few (can't name one off the top of my head) going off around the map. I never remember any performance hits because of it.
User avatar
Marinelol
Posts: 69
Joined: Sun Feb 06, 2011 7:37 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Various performance questions

Post by Marinelol »

http://infosuite.duke4.net/index.php?page=ae_sfx_a2 Seems to be sector based. Explains the strange sudden stop of ambient sounds in some places in Blood.
User avatar
kodi
 
 
Posts: 1361
Joined: Mon May 06, 2013 8:02 am

Re: Various performance questions

Post by kodi »

Shaders or ROLLSPRITE for rotating sprites?
I think shaders are less performance intensive because they don't have to change or store any values ever tic, but the difference should be very small.
User avatar
Ozymandias81
Posts: 2068
Joined: Thu Jul 04, 2013 8:01 am
Graphics Processor: nVidia with Vulkan support
Location: Mount Olympus, Mars
Contact:

Re: Various performance questions

Post by Ozymandias81 »

Would be better if a dev could give us a reply in this particular case
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: Various performance questions

Post by Kinsie »

How long is a piece of string?
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Various performance questions

Post by Enjay »

Twice the distance from its middle to its end.
User avatar
Rachael
Posts: 13959
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Various performance questions

Post by Rachael »

Ozymandias81 wrote:Would be better if a dev could give us a reply in this particular case
Here you go.
User avatar
Rachael
Posts: 13959
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Various performance questions

Post by Rachael »

Tormentor667 wrote:Concerning GZDoom I have various performance questions, I hope some of the developers team can give me an answer :)

PK3 - Uncompressed or compressed?
Does it make a performance difference ingame (after the game has startet) if a PK3 is heavily compressed or uncompressed? From my understanding, the data gets decompressed before the game starts and loaded into the memory, so it shouldn't make any difference, right?

Shaders or ROLLSPRITE for rotating sprites?
What is more performance intensive when it comes to rotating sprites? If I do this through shaders or if I do this through a ROLLSPRITE flag and rotating the sprite in the actor states?

Ambient Sounds
Imagine I have a map with about 100 ambient sounds placed, but the player is only at a position where he can hear about 10 of them at the same time, are the others still "calculated" and impact performance or are they ignored?

Thanks already for answering these, we are currently improving the performance in BoA so these might be good to know.
- PK3 - Do not know, sorry. You have to ask Graf. I think ultimately they come out the same in memory no matter what, so in terms of performance leaving it uncompressed would be better since that's less CPU overhead when hot-loading resources during intensive play. But if a user has a very slow hard drive, compressed will obviously be much more efficient since a CPU can crack a compressed file quicker than a hard drive can load one uncompressed.
- GPU dependent, but if you're really concerned about performance on older systems then rollsprite is faster.
D2JK wrote:
...what I would do is build my map in such a way that the sounds that you will hear will get activated when the player gets close enough to hear them...
This sort of optimizing isn't always beneficial; you have to consider the total performance cost of constantly checking distances from each sound source to each player vs the cost of simply letting all the sounds stay active regardless.
If that was the case then dynamic lights in QZDoom (or now GZDoom's software renderer) would not be possible. Imagine checking distances for 2 million individual pixels per frame per light. I think 100 ambient sounds aren't going to be a huge issue.

- Leaving ambient sounds alone should be fine. Performance issues with them are likely going to come more from actor overhead, itself, than actual sound calculations. That's inavoidable - but you can mark a sound object +NOINTERACTION and "RenderStyle None" to reduce some of that.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Various performance questions

Post by Graf Zahl »

- compression: The only thing where it really matters is streaming music. The game can stream directly from an uncompressed archive so the load time is shorter, but in return the callback takes longer (but this is on a second thread so on modern hardware irrelevant.)
- shaders: The sprite rotation is a single matrix multiplication. Setting up a shader for this takes disproportionately longer than having a handful of multiplications.
- sound: Mostly irrelevant. Sound mixing is done on a separate thread, you only need to be careful that you do not run out of sound channels. I would recommend against too much checking here, maps that try to do too much preemptive actions tend to sound bad. The AmbientSound actor is doing this automatically for you if you set the parameters accordingly, so there's absolutely no point adding a second check on the user side.
- no flag hacks for AmbientSound things, please. They are already set to the invisible sprite and use the NOSECTOR flag and since they do not move they barely need processing time. NOINTERACTION won't do much for them.
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Various performance questions

Post by Nash »

Regarding +ROLLSPRITE vs shaders, one important difference is the former is in playsim context. Which means each individual rolled actor can have different rotations, and you can script things that will affect the rotation directly.

A shader is uniformly applied globally across every copy of the actor; same speed, same angle, etc. There is no way to influence the rotation via scripting.

Something to be aware of when deciding your visual goals.
User avatar
Ozymandias81
Posts: 2068
Joined: Thu Jul 04, 2013 8:01 am
Graphics Processor: nVidia with Vulkan support
Location: Mount Olympus, Mars
Contact:

Re: Various performance questions

Post by Ozymandias81 »

Thank you kindly friends, we'll take in consideration all of your advices then. :wub:
Post Reply

Return to “General”