[v1.7.0+] Particle Cleanup

A place to post your add ons and ideas for them

Moderator: Moderator

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

[v1.7.0+] Particle Cleanup

#1 Post by Zizzo »

So is it just me that has this problem? Maybe it's more common when using Nekarcos's Effects Display addon; it seems not at all uncommon for one of the display particles of a temporary effect to get "stuck" and hang around permanently after the effect expires. The particles for disease and acid effects, for instance, seem to be common offenders.

And so, inspired by "fix-up" addons like Marson's Bosses Gone AWOL, I'm trying my hand at cleaning this up. So far I've got an addon that at least appears to correctly distinguish between "orphaned" particles and particles that are associated with an active temporary effect or sustained talent and removes the former. Before I go live with it, though, I'd like to get some feedback from others with experience in this area:
  • Currently I'm looking in game.player.sustain_talents{} and game.player.tmp{} for "legitimate" particles, on the premise that even if the talent/effect isn't using the :effectParticles() and :talentParticles() method, it's probably still storing the particle with the rest of its associated talent/particle information. Also, it turns out we need to do a shallow sweep of game.player{} for stuff like steam generator particles. Is there anywhere else I need to check?
  • Currently we do the orphan check only at character load. Would we want another way to trigger a check, like a key binding?
Last edited by Zizzo on Sat Oct 30, 2021 8:47 pm, edited 1 time in total.
"Blessed are the yeeks, for they shall inherit Arda..."

nsrr
Sher'Tul
Posts: 1055
Joined: Mon Sep 21, 2015 8:45 pm
Location: Middle of Nowhere

Re: [RFC] Particle Cleanup

#2 Post by nsrr »

Yes, I think you are right that some of the most common offenders here are from Neka's effect display. In addition to acid and diseases, I've noticed it with the Slow particles, as well.

I don't know if it would fit within the scope of this, but there are a couple of base/DLC particles that seem to get 'stuck' some times, but I think they exist on the map and not on any character. One is Feed, from Doomed, and the other is a similar visual effect, I believe caused by Metalstar from Psishot.

I think a hot key to check would be nice. Depending on your class and gear, the acid and blight effects you mention can get stuck pretty often, and having some way to clear them without reloading would be nice (although anything would an improvement over the current state where they just stick around forever).

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

Re: [RFC] Particle Cleanup

#3 Post by Zizzo »

nsrr wrote: Sun Oct 24, 2021 5:52 pmI don't know if it would fit within the scope of this, but there are a couple of base/DLC particles that seem to get 'stuck' some times, but I think they exist on the map and not on any character. One is Feed, from Doomed, and the other is a similar visual effect, I believe caused by Metalstar from Psishot.
[sound F/X: source diving] Feeding is indeed a map particle; Bloodstar is an actor particle, but it lives on the target actor. I would be hesitant to attempt a full orphaned-particle check on an NPC (who knows what kind of decorative particles one of your fancier bosses might have, after all), but a targeted check for a particular effect would probably be manageable.

And if we're venturing into map particles, another thing that's annoying sometimes is leftover map effect particles. I've got an Ogre Cursed, for instance (based on bpat's build), wielding Eye of Winter in the offhand, and it's downright spammy about proc'ing Winter's Fury — often enough that sometimes the particle for the effect gets left behind. [sound F/X: source diving] Map effect particles link back to their map effect, so that should be fairly straightforward to check.

This is getting kind of involved, :wink: but I think it'll be worth it.
"Blessed are the yeeks, for they shall inherit Arda..."

RootOfAllThings
Wayist
Posts: 23
Joined: Tue Feb 21, 2017 3:53 am

Re: [RFC] Particle Cleanup

#4 Post by RootOfAllThings »

Note also that particle removal will fail silently. If, for whatever reason, you remove the particle system object that's attached to an Actor "manually", and then the effect that created that particle and attached it attempts to remove it, no error is thrown. So to some degree, an inelegant answer of simply purging all the particles and letting God sort them back out is one way to "fix" the issue.

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

[v1.7.0+] Particle Cleanup

#5 Post by Zizzo »

Okay, I think I'm ready to release this. I haven't had a chance to test handing of the Feeding or Bloodstar effects, because I haven't seen either of this get orphaned recently, but the player cleanup works fine. (The map effect stuff turned out to be something entirely different:oops: ) The keybinding for the particle check is bound to Ctrl-Shift-Alt-P by default, and can be changed in the usual manner.

And at some point I should probably add a FAQ entry below to catch the inevitable "How do I add this to an existing character?" question.

[As for potential future inclusion in ZOmnibus, my first inclination is to view this is a "bugfix" addon, which makes me hesitant to include it for fear of needing to claw it back out later.]

[Implementation notes:]

Code: Select all

Hooks:
  ToME:load [to install our "orphan check" function and a keybinding for it]
  ToME:runDone [to do an orphan check at load time]
Superload:
  mod.class.Game:
    setupCommands() [to handle our "orphan check" keybinding]
Last edited by Zizzo on Sun Nov 07, 2021 1:37 am, edited 1 time in total.
"Blessed are the yeeks, for they shall inherit Arda..."

astralInferno
Uruivellas
Posts: 803
Joined: Mon Jan 27, 2014 10:40 am

Re: [v1.7.0+] Particle Cleanup

#6 Post by astralInferno »

Zizzo wrote: Sat Oct 30, 2021 8:47 pm [As for potential future inclusion in ZOmnibus, my first inclination is to view this is a "bugfix" addon, which makes me hesitant to include it for fear of needing to claw it back out later.]
I think if you manage to find a solution for the Feed, problem, this may qualify as a "if you give darkgod the code he may embrace you" addon. :wink:

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

Re: [v1.7.0+] Particle Cleanup

#7 Post by Zizzo »

And already found a bug. My check for orphaned Bloodstar particles was messed up, neglecting to check whether a given entity even has a :hasEffect() method before checking it for the Bloodstar effect. That's fixed in v1a, just pushed out. We Apologize for the Error.™
"Blessed are the yeeks, for they shall inherit Arda..."

nsrr
Sher'Tul
Posts: 1055
Joined: Mon Sep 21, 2015 8:45 pm
Location: Middle of Nowhere

Re: [v1.7.0+] Particle Cleanup

#8 Post by nsrr »

It's refreshing to know that even a modder as versed as yourself still runs into the ole 'forgot to make sure the method exists before trying to call it' mix-up :)

(I feel like I do this a minimum of once per add-on)

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

Re: [v1.7.0+] Particle Cleanup

#9 Post by Zizzo »

Been playing around with Werekracken's Evoker class, and I tripped over an unfortunate interaction with this addon. See, the Evoker's various demon-summoning sustains keep a reference to their respective summoned demon in their sustain_talents{} information, and our recursive-descent sweep for orphaned particles was thus dutifully descending into the demon's data… and back up its tactic_leash_anchor reference to the player, and so on ad recursum infinitum. I'm sure my computer science professors are all duly disappointed in me. :oops:

The quick fix is for our particle sweep to refrain from recursively descending into anything that looks like an entity (Actor, Object, stuff like that); I've convinced myself that we're not likely to miss any orphaned particles by doing this. That's going out as v1a.1; We Apologize for the Inconvenience.™
"Blessed are the yeeks, for they shall inherit Arda..."

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

Re: [v1.7.0+] Particle Cleanup

#10 Post by Zizzo »

So I've noticed my Ogre characters tend to have a lot of orphaned "nerve" particles (no surprise, since Ogric Wrath and Ogre Fury both leave that behind). I think I've had as many as 60 of those at one point, making the dialog taller than the screen — which, in retrospect, seems like a bad thing. :oops: :wink:

The fix, of course, is to merge duplicate lines in the orphaned particles list into a single line with a count. That's going out as v1a.2.
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply