Hah, like I said I'm still learning.
😉
I'll try to use the Erase Event command and see if that works better. The only problem I foresee that having is I base the number of splash events on the screen at once with a formula based on the event IDs in an array. And with Erase Event, the event ID of the event you're erasing actually retains its key. But if it works better for performance I could rework that.
And yes, I could create a custom class for animations but I have little to no experience with scripting them. Now would probably be a good time to learn.
And lastly, I've looked at a couple of different weather scripts but they're too obfuscated for my beginner Ruby-fu.
*Edit - That's a no-go also. I changed the code to this:
Spoiler
def precipAnim if @splashesTimer >= 60 while @splashCounter < 5 xVariance = rand(8) yVariance = rand(6) dirVarianceCalc = rand(2) if dirVarianceCalc == 1 dirVariance = 1 else dirVariance = -1 end splashXpos = $game_player.x + (xVariance * dirVariance) splashYpos = $game_player.y + (yVariance * dirVariance) if $game_map.any_direction_passable?(splashXpos, splashYpos) == true spawn_event(2, 1, 1, splashXpos, splashYpos) @splashCounter += 1 end end @splashCounter = 0 @splashesTimer = 0 else @splashesTimer += 1 end end
This test spawned 5 splash animations at the same time on the map every 60 frames. Each event waits 25 frames and then calls the 'Erase Event' command and it still degrades the performance drastically only after a couple minutes. I can try doing this by animations, but I'd REALLY like to figure out what's causing the performance degradation as its had me stumped for quite awhile now.
*Edit 2 - All of this led me to Spriteset_Weather. Maybe it'd be easier to just alias update_sprite_rain and set a counter there.
*Edit 3 - Thanks to Balrogic, it looks like the problem was that the sprite array wasn't being cleared. Everything else in the code seems to work fine. All I had to did was change the local sprite array in the spawining script to a global array and have the event set a class variable to its value in said array. In the process of unspawning the event, I simply added a line to clear that value out of the sprite array and voila, no more performance degradation. One other problem I noticed was that the first frame of the events SOMETIMES stayed behind on the map until the haltAnim value was set to true. Not really too sure why but I simply made the first frame of the splash animation completely blank just so they won't show up on the map for the extra second or so. Anyway, its working fine now!