Moving floor/ceiling thinkers are very expensive

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Nash
 
 
Posts: 17450
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Moving floor/ceiling thinkers are very expensive

Post by Nash »

Can anything be done to improve this? I summoned 500 medikits on top of a moving floor and the think time just blows up.

"Doctor it hurts me when I do-"

Shhh shhh. Real use case scenarios would be mods that spawn a lot of effects like bullet casings, gore, debris, etc.

Heck, maybe someone wants to make a segment in a map where you have to descend an elevator but have to survive waves of monsters spawning into the lift. Once the body piles reach the hundreds, the game's performance starts to scale very poorly...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49096
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Moving floor/ceiling thinkers are very expensive

Post by Graf Zahl »

How does "don't do that?" sound?

I'm sorry to say but the entire code to move actors on a moving floor along is very, very, very expensive because it has to account for such nasty things as stuff getting crushed, some gibs or debris being spawned by some movement-induced action and what not. And of course it has to do this in a way that remains compatible with both Vanilla and Boom. Not to forget ZDoom's only actors-pushing-actors code.
User avatar
Nash
 
 
Posts: 17450
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Moving floor/ceiling thinkers are very expensive

Post by Nash »

While "don't do that" for special effects arguably makes sense (spamming Actors in huge quantities is never good, in any game engine), for monsters, not so much.

It is completely possible for someone to make vanilla levels with huge monster battles on a moving floor. They'd run into the same issue and they wouldn't have been aware that the engine is hostile to the concept of many actors standing on a moving floor. Because under normal circumstances, Doom CAN handle hundreds of monsters on screen at once. They'd have no knowledge of thinker costs and what-not.

Anyway, thanks for the explanation. I suspected just as much when I was looking at the source. No way around this issue, I suppose. Other than actively warn people not to create situations where too many actors spawn on sectors that are meant to move.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49096
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Moving floor/ceiling thinkers are very expensive

Post by Graf Zahl »

In vanilla the cost is even worse, because it doesn't just check all the actors touching the sector, but all actors touching the bounding rectangle of a sector. The cost involved here is also very dependent on actors overlapping other actors or linedefs. The more checks are needed the more costly this becomes.
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33

Re: Moving floor/ceiling thinkers are very expensive

Post by Kinsie »

I noticed this while playing through Hell Ground with High Noon Drifter a while back, and engaging in a fight on a long, slow, downward elevator where I made the mistake of using lots of grenades (which launch bouncing fragments upon explosion)... After this, I added a similar long, slow downward elevator to my modder test map, so mod developers can stress-test this specific scenario.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: Moving floor/ceiling thinkers are very expensive

Post by StroggVorbis »

@Kinsie

How far down does your elevator go, anyway? :P

Return to “General”