Excessive slowdown with lots of sprites

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE/EDuke32/Raze? Did your computer break? Ask here.

Moderator: GZDoom Developers

Forum rules
Contrary to popular belief, we are not all-knowing-all-seeing magical beings!

If you want help you're going to have to provide lots of info. Like what is your hardware, what is your operating system, what version of GZDoom/LZDoom/whatever you're using, what mods you're loading, how you're loading it, what you've already tried for fixing the problem, and anything else that is even remotely relevant to the problem.

We can't magically figure out what it is if you're going to be vague, and if we feel like you're just wasting our time with guessing games we will act like that's what you're really doing and won't help you.
Post Reply
User avatar
Chris
Posts: 2942
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Excessive slowdown with lots of sprites

Post by Chris »

At least, I'm assuming it's due to a lot of sprites, given what I'm seeing. With the Metroid Dreadnought mod (link is for the more-recently-updated overhaul, though the same thing would happen with the original), the charged and missile-enhanced wavebeam shots create a lot of particle effects, which tank performance for me. I'm talking multiple seconds-per-frame in the worst case, and can last 10+ seconds real-time. I see similar slowdown with the powerbomb, although it doesn't last as long.

Here's a screenshot showing a normal frame:


And here's a frame in the midst of the issue (getting about 0.5 to 1 FPS):


CPU:
Athlon64 X2 4200+ @ 2.2GHz (dual-core)
GFX:
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: GeForce GTX 650/PCIe/SSE2
GL_VERSION: 4.5.0 NVIDIA 384.130 (Core profile)
GL_SHADING_LANGUAGE_VERSION: 4.50 NVIDIA

Screenshots were made with the OpenGL renderer, 1280x720 windowed, 2x overscaling, although it also happens with the software renderers without overscaling too. Tried with a fresh ini, no change. Tried turning off dynamic lights, no significant change.

Interestingly, when I first tried out the mod some years ago, the slowdown was very minor. Over time the slowdown got worse, and it's been like this recently. I recognize my CPU is quite old and is the likely culprit (I've not heard of performance complaints from others using the mod), though the slowdown still seems rather excessive even considering that. Assuming there's no improvements to make on the engine's side to help this case, are there any cvars that may be able to keep it from getting so bad?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Excessive slowdown with lots of sprites

Post by Graf Zahl »

Sprites are not cheap to render, as you can clearly see in your numbers. I really cannot imagine that this ever worked well.
The time is split across 3 items:

Think time, where most is spent in script code, preparation time for rendering and actual rendering.
My guess is that this particular mod got hit badly by the scripting VM, because this is where it spends the majority of its time.
But regardless of that, this clearly shows a lack of care towards performance-conscious design. You cannot have 5000 sprites and expect it to work without performance issues. Of all the items in the game, sprites are the most costly ones to set up.
Valken
Posts: 281
Joined: Mon Jun 08, 2015 7:32 am

Re: Excessive slowdown with lots of sprites

Post by Valken »

I noticed excessive sprites would slowdown GZDOOM as well and was wondering if splitting the VM out as a separate game thread to use another CPU core would work and improve performance? Like a blitter from the old consoles such as NEOGEO? That was massive sprite machine and maybe it would help performance on a modern system?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Excessive slowdown with lots of sprites

Post by Graf Zahl »

It's not that easy. Much of the game depends on serial execution and for the vast majority of mods this really is not an issue. Adding a second thread here would also cause other problems and may even slow things down in more common scenarios.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Excessive slowdown with lots of sprites

Post by Nash »

For use cases like this (visual FX), the extremely bloated Actor really isn't the best tool for the job.

Particles with custom sprites would be a much better solution.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Excessive slowdown with lots of sprites

Post by Graf Zahl »

The main problem here is not the size of an Actor object. Most of the time is lost in complex DECORATE stuff where particles wouldn't help.
User avatar
R4L
Global Moderator
Posts: 404
Joined: Fri Mar 03, 2017 9:53 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Pro
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Excessive slowdown with lots of sprites

Post by R4L »

If you look at the code for that charge combo, you'll see why lol. It's been that way since it first released, way before I got my hands on it. ;)

I'm working on nerfing it, which should help with frame rate. On my rig I get slowdown, although not as bad, and I'm using a i5-3570k. I do know it's there though, and I'm pretty sure nerfing it would fix it.
Post Reply

Return to “Technical Issues”