Very bad performance with FX-heavy scenes

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Rachael
Posts: 13527
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Very bad performance with FX-heavy scenes

Post by Rachael »

AFADoomer wrote:Even if they're not visible (like when DistanceCheck keeps an actor from rendering), the actor is still present, and all of the internal actor mechanics are still firing, and that's what causes processing delay.
Exactly this.

At 8000+ actors, this is what will get you - every single time.

One thing you might try is put enemies to sleep if they are more than 5000 units away from the player. In the spawn state, do a distance check since it's relatively uncostly, and just have the actor sit in a single frame for 70 tics and then check again before reverting back to its spawn state. Don't even A_Look when they're far away.

Doing a distance check every 70 frames is a LOT easier on the CPU than doing A_Look every 8-16-ish frames. Especially if you number your enemies in the thousands.

Plus - there's absolutely no reason for any of them to be active in the cinematic intro, except the ones that are actually in the cinematic itself.

This will have to be applied to every single enemy to be effective, though...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Very bad performance with FX-heavy scenes

Post by Graf Zahl »

It's not the enemies which cause the problems in this map, though. It is fully sufficient to have inert actors doing minimum checks to add up to several milliseconds if there's several 1000.
The only chance I see to get processing time further down is to explicitly put those into a non-thinking statnum.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Very bad performance with FX-heavy scenes

Post by Xaser »

Man, how many times am I going to have to ask a simple question before getting an actual answer and not a non-sequitur?

I guess since it's necessary to explain this now: I'd like to limit the weather spawning to a radius around the player (I figured this part was clear given the post snippet of Rachael's I was quoting). This will increase performance by spawning less actors. Success and whatnot.

The caveat though is if there's two players in the area, Player 1 will see rain FX around oneself, but also catch glimpses of distant rain spawning around Player 2. That's ugly, hence my actual question (for the third time): Is it possible to make the rain actors spawned around Player X only visible by Player X?
User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Very bad performance with FX-heavy scenes

Post by Nash »

Xaser: the mechanics to filter it to specific players already exist - this is how the speed trails in gzdoom.pk3 work. Basically, you check against consoleplayer.

Code: Select all

class LADPrecipitation : Actor
{
    // snip
    
    override void Tick()
    {
        Super.Tick();

        // snip
        
        if (!tracer)
        {
            return;
        }

        // destroy precipitation from other players
        if (tracer && tracer != players[consoleplayer].mo)
        {
            // Hexen speed trails are doing this
            //bINVISIBLE = true;
            
            // but instead, I do this
            Destroy();
        }
    }
}
 
I talked about this issue briefly in the ZScript thread when ZScript was still very new (I can't find the post) but my solution involves destroying the precipitation immediately if the check fails. As Graf said, this is a recipe for sync disaster, which is why I was very, VERY careful in how my precipitation stuff is setup.

They have absolutely no chance to interact with anything else in the game, so the way I've set it up, it doesn't ruin multiplayer.

And yes I've tested this in actual MP games, it works. :)

Obviously if GZDoom supports true C/S then I'd do it differently, but given the currently available mechanics in the engine, this is all that I have to work with for now.

NOW! That said... you'd probably be disappointed in how it actually looks in-game. You always get the feel that the precipitation is following you. Like it's only raining on you.

Things I have also tried and the results were "meh"

1) Hard-offsetting the precipitations' position relative to the camera. This has the "Oblivion" effect where the rain/snow is stuck hard on to the screen. It looks ridiculous

2) Soft offset via checking the player camera's current velocity and spawning the precipitation at an offset. Well it sort of works but sometimes when the player moves too fast, you will notice the precipitation density be sparse until you stop moving

I have settled with (2). Precipitation effets have come a long way in my weather system Bumi since a few years back but there's still plenty of room for improvement.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49053
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Very bad performance with FX-heavy scenes

Post by Graf Zahl »

The best way to handle is would be the same as ZDoom's own SpawnBlood and SpawnPuff implementations, i.e. set the render style to 'none' if the console player is not the one the item is for.
Post Reply

Return to “General”