Page 1 of 1
[v1.3.0+] Effects Under Actors
Posted: Sat Jul 20, 2019 8:47 pm
by Zizzo
It's a
long-standing complaint: a pack of wretching dropping Corrosive Vapor effects on your head all at once or a couple fire drakes breathing at you can leave your immediate vicinity piled under multiple layers of lingering effect displays, making it nearly impossible to see yourself or nearby NPCs.
Now, I figured that the handling for would be buried somewhere deep in the rendering code beyond the reach of my addon fu, but some source diving suggested that the Map:addEffect() method was a potential inroad. See, unless a talent specifies otherwise, any effect it leaves behind is displayed at the very highest "z-depth", on top of everything else. A few effects like Mucus manually specify a z-depth of 6 to put it under the player (never could find what z-depth actors are drawn on, but since map z-depth ranges from 0 to 19, I'm guessing 10). So I figured if I could sneak in ahead of the engine and insert a z-depth of, say, 7 for effects that don't specify their own, that should put all effects below actors.
The result is my new
Effects Under Actors addon. I can't confirm that I've found every place a z-depth needs to be set for it not to default to the top layer, but I've tested it on wildfire archmages' Burning Wake and it appears to do what it's supposed to do, as depicted in the following screengrab I set up for the Steam page image:

- blastwave-test.jpg (172.45 KiB) Viewed 7026 times
If there are effects that aren't getting caught, here is a good place to report it as a bug.
[Thinking ahead, this addon might or might not be suitable for inclusion in ZOmnibus or Zomnibus Lite, but it would probably need a game option to turn it on/off if we did.]
[Technical notes:]
Code: Select all
Superload:
mod.class.MapEffects:
Map:addEffect() [to change the z-depth of effect particles]
Re: [v1.3.0+] Effects Under Actors
Posted: Sat Jul 20, 2019 9:04 pm
by rexorcorum
Great work as always, Zizzo (and I won't get tired of saying that)!

Maybe a further useful addition to it will be an option to display just one layer of effects when there are multiple ones overlapping on a certain tile? Don't know how hard that would be, but the said wretchlings can wreck havoc on older systems when you meet a pack or three.

Re: [v1.3.0+] Effects Under Actors
Posted: Sun Jul 21, 2019 2:05 am
by Zizzo
rexorcorum wrote:Great work as always, Zizzo (and I won't get tired of saying that)!

*blush* [bows]
rexorcorum wrote:Maybe a further useful addition to it will be an option to display just one layer of effects when there are multiple ones overlapping on a certain tile? Don't know how hard that would be, but the said wretchlings can wreck havoc on older systems when you meet a pack or three.

Definitely can't do that in this addon; it operates at the effect level rather than the tile level.
[sound F/X: source diving] I think I'd have to completely overload Map:displayEffects() and have it keep track of which effects it had drawn in which tiles. Actually, when you say "multiple ones overlapping", do you mean multiple instances of the same effect (as per the aforementioned wretchings), or multiple different effects? My Oozemancer, for instance, frequently has Mucus on top of Nourishing Moss, and I don't think I'd want one to conceal the other. (In fact, now that I think of it, I'd have to make sure there's a way to recognize effects from the same talent cast by different actors as the "same" effect…)
At any rate, if it happens, it'll almost certainly be in a separate addon. Give me some time to investigate.
Re: [v1.3.0+] Effects Under Actors
Posted: Sun Jul 21, 2019 7:06 am
by rexorcorum
Yeah, I mean multiple acid clouds from wretchling packs and such, that is - multiple instances of the same effect. I will be the last one to suggest removing the display of different effects, hehe (as usually I am the one putting them in in the first place).
Re: [v1.3.0+] Effects Under Actors
Posted: Mon Jul 22, 2019 1:10 pm
by Doctornull
This is amazing and totally belongs in zOmnibus.
You're awesome, Zizzo.
Re: [v1.3.0+] Effects Under Actors
Posted: Thu Jul 25, 2019 3:52 am
by Zizzo
Zizzo wrote:[sound F/X: source diving] I think I'd have to completely overload Map:displayEffects() and have it keep track of which effects it had drawn in which tiles.
[sound F/X: source diving] Hmm, now that I look at it, the computationally expensive ones like Corrosive Vapour use particles, which aren't managed in :displayEffects(). Basically, :addEffect() drops an individual particle emitter on each affected grid, and then :processEffects() removes them when the effect expires or moves. Hence the slowdown with overlapping effects, since you have multiple particle emitters running on each overlapping grid.
What this means, I think, is that I might be able to get away with hijacking Map:particleEmitter() and Map:removeParticleEmitter() to do a sort of "reference counting" — have only one vapour particle on a given grid, but keep track of how many are "supposed" to be there, so that removing it the right number of times will make it actually go away. That would probably be doable via superloading, which means I wouldn't have to break it out into a separate addon after all. Will probably need game options to control all these behaviors, though…
So for now, give me a little time to put something together and test it.
Doctornull wrote:This is amazing and totally belongs in zOmnibus.
*blush* [bows] Yeah, in my internal list of addons and how suitable they're likely to be for inclusion in ZOmnibus and/or ZOmnibus Lite (whenever the next merge sweep ends up happening), this one is currently in the "probably good, but would maybe need a game option to turn it off" category.
Re: [v1.3.0+] Effects Under Actors
Posted: Mon Jul 29, 2019 12:20 am
by Zizzo
And after some testing (including a couple run-ins with wretchlings), I'm confident enough that everything is functioning properly to push out v2. The new functionality is controlled by the aptly-named new game option "UI | "Flatten" overlapping effects" (disabled by default, so be sure to turn it on if you're interested). While we're adding options, we also add an option "UI | Display effects under actors" to control the original addon function; with those options in place, I'm more comfortable about picking it up in the next ZOmnibus sweep.
Re: [v1.3.0+] Effects Under Actors
Posted: Mon Jul 29, 2019 6:22 am
by HousePet
Okay, you next impossible task is to have 1 in 10 particles display over the Actors.
(I'm actually serious. If you can find a way to make that work, it should look good and not obscure everything. However I suspect 'impossible' may be accurate...)
Re: [v1.3.0+] Effects Under Actors
Posted: Wed Jul 31, 2019 3:36 am
by Zizzo
HousePet wrote:Okay, you next impossible task is to have 1 in 10 particles display over the Actors.
(I'm actually serious. If you can find a way to make that work, it should look good and not obscure everything. However I suspect 'impossible' may be accurate...)
…? I'm not entirely sure how that would even work. It's not like I could put 10% of a particle emitter at a different z-depth, and if you've got ten particle emitters on the same grid, you've probably got bigger problems.
Re: [v1.3.0+] Effects Under Actors
Posted: Thu Oct 24, 2019 11:50 pm
by Zizzo
v2a is basically a compatibility release for the merge into ZOmnibus/Lite v16. I don't
think it should be possible to have both enabled at once anymore, but just in case, we don't add our game options twice.

Re: [v1.3.0+] Effects Under Actors
Posted: Sat Oct 30, 2021 8:39 pm
by Zizzo
…Well, this is embarrassing.

My reference-counting hackery to "flatten" particles for grid-based effects like Corrosive Vapor was, it turns out, also being applied to stuff like the "icestorm" effect particle for Winter's Fury when it shouldn't — not least because if you move while the effect is active, the reference counting gets messed up and the particle never gets removed.
v2b.2, just released, tries to do a better job of figuring out when to apply our flattening trickery and when not to. It also includes an automatic cleanup sweep to clear up any particles left behind by this bug (and any future bugs, I suppose…

)