Page 1 of 1

Effect of timers and spawn on system?

Posted: Sun Nov 09, 2014 3:36 pm
by jxjxjf
So, I've made a prototype power plant dungeon, and part of what it does is run a timer which spawns shock_bursts every .75 seconds. I've played the dungeon for ~20 minutes with no issues, but are there long-run implications of leaving that process running, say, when the party leaves the dungeon?

I'm assuming destroyed GameObjects are cleaned up from memory to avoid memory issues, but maybe that's not the case? So, if I spawn ~10 shock bursts per .75 seconds for an hour or so, will it keep indexing new memory and eventually run out? I'm also curious if timers each run on their own thread (which seems excessive) or if they all poll from a single thread or even the main thread? So, if I have, say, 100 timers running at the same time is that likely to tax the engine noticeably?

I tried putting down a large number of timers to see if it had any effects, and it didn't seem to, but I'm not sure if A) that's just my machine handling the load well or B) there's maybe some optimization done to virtually "disable" timers that have no connectors?

I know this is probably hard for anyone but the devs to answer, but I'd appreciate any observations. I'm curious if I'm planning too much and will be stuck with a mod that chugs by the time I've gotten to the end of it.

Thanks. :D

EDIT: I didn't actually see before that timers seem to slow down when the party leaves the area the timer is set to. This is interesting, but I'm really curious as to how it all works. :lol:

Re: Effect of timers and spawn on system?

Posted: Mon Nov 10, 2014 6:24 am
by PPanda
If you're really worried about it, place a series of floor triggers to turn it on/off when you enter/leave.

I did something similar so I would leave an area "off" with two floor triggers, a door, a counter, and a short script function.

Re: Effect of timers and spawn on system?

Posted: Mon Nov 10, 2014 10:17 am
by Phitt
If you use a spawner to spawn the shockburst (by using editor functions and not by using a script) I'm 99% sure you won't run into memory problems. It should work like a normal spell, and I doubt spells you cast are kept in memory so you are limited to x spells until the game runs out of memory. Oh, and did you ever mod Elder Scrolls? The memory issue you ask about reminds me of a certain save game bloating issue that many modders had in ES games when they used spawn commands too often.

I would be more worried about the performance impact of possibly having dozens of shockburst effect in a level than about the performance of timers. And can't you use one timer for multiple shockbursts? The player will probably not see all of the shockburst effects at once, so using only, say, 5 timers in a level should probably be enough.

Also, like PPanda said. Disable timers that aren't needed when the player leaves the level. Even if the performance impact may be minimal.

Re: Effect of timers and spawn on system?

Posted: Mon Nov 10, 2014 4:11 pm
by jxjxjf
Thanks for the replies guys.

Yeah, I agree it would be ridiculous to store every particle effect that plays, but I wasn't sure if the spawn() function makes room for the GameObject in a different way than a spell cast, which would still be ridiculous, but possible. I didn't ever mod Elder Scrolls but, knowing those games, I'm not surprised it had issues like that. :lol: The shockbursts aren't causing me any performance issues, but you're right, they could potentially cause someone else issues. Unfortunately, the level doesn't really work without them. :\ But perhaps I can cut their numbers.

You're absolutely right that I should just be safe and turn off the timers and that's actually what I'm doing for the point of being safe. :D I guess if I'm really concerned about the theoretical limit, I can just put the legwork in myself and try to break it. :P I think you're right Phitt, I'm 99% probably fine, I'd just feel better knowing anything I might plan works and won't break the game before I base a lot of work on the back of it. :lol: