[v1.3.0+] Effects Under Actors

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

[v1.3.0+] Effects Under Actors

#1 Post 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
blastwave-test.jpg (172.45 KiB) Viewed 6907 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]
Last edited by Zizzo on Sun Jul 21, 2019 1:49 am, edited 1 time in total.
"Blessed are the yeeks, for they shall inherit Arda..."

rexorcorum
Graphical God
Posts: 482
Joined: Wed Jan 05, 2011 8:05 am
Location: There and Back again

Re: [v1.3.0+] Effects Under Actors

#2 Post 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. :)
~ [ RexOrcorum, a.k.a "rexo": Official Visual Magus, Addon Beautifier, Achiever, Knight of the 561 Trees, Dark Interfacer ] ~
darkgod wrote:~ [ DarkGod whips rexorcorum with Suslik (& many others as well) ] ~

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Effects Under Actors

#3 Post 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.
"Blessed are the yeeks, for they shall inherit Arda..."

rexorcorum
Graphical God
Posts: 482
Joined: Wed Jan 05, 2011 8:05 am
Location: There and Back again

Re: [v1.3.0+] Effects Under Actors

#4 Post 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).
~ [ RexOrcorum, a.k.a "rexo": Official Visual Magus, Addon Beautifier, Achiever, Knight of the 561 Trees, Dark Interfacer ] ~
darkgod wrote:~ [ DarkGod whips rexorcorum with Suslik (& many others as well) ] ~

Doctornull
Sher'Tul Godslayer
Posts: 2402
Joined: Tue Jun 18, 2013 10:46 pm
Location: Ambush!

Re: [v1.3.0+] Effects Under Actors

#5 Post by Doctornull »

This is amazing and totally belongs in zOmnibus.

You're awesome, Zizzo.
Check out my addons: Nullpack (classes), Null Tweaks (items & talents), and New Gems fork.

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Effects Under Actors

#6 Post 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.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Effects Under Actors

#7 Post 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.
"Blessed are the yeeks, for they shall inherit Arda..."

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: [v1.3.0+] Effects Under Actors

#8 Post by HousePet »

Okay, you next impossible task is to have 1 in 10 particles display over the Actors. :wink:

(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...)
My feedback meter decays into coding. Give me feedback and I make mods.

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Effects Under Actors

#9 Post by Zizzo »

HousePet wrote:Okay, you next impossible task is to have 1 in 10 particles display over the Actors. :wink:

(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.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Effects Under Actors

#10 Post 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. :wink:
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Effects Under Actors

#11 Post by Zizzo »

…Well, this is embarrassing. :oops: 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. :oops: :oops:

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… :oops: )
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply