Very bad performance with FX-heavy scenes

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Re: Very bad performance with FX-heavy scenes

Postby Rachael » Fri May 19, 2017 5:25 pm

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
Rachael
 
Joined: 13 Jan 2004

Re: Very bad performance with FX-heavy scenes

Postby Graf Zahl » Fri May 19, 2017 5:35 pm

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
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Very bad performance with FX-heavy scenes

Postby Xaser » Fri May 19, 2017 6:04 pm

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
Xaser
autodefenestrator
 
Joined: 20 Jul 2003

Re: Very bad performance with FX-heavy scenes

Postby Nash » Fri May 19, 2017 10:16 pm

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 allExpand view

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
Nash
Nash Muhandes [Audio Engineer | Game Designer | Scripting]
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia

Re: Very bad performance with FX-heavy scenes

Postby Graf Zahl » Sat May 20, 2017 2:46 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests