Skipped pseudo-heartbeats, rumor or fact?

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Locked
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Skipped pseudo-heartbeats, rumor or fact?

Post by Ronan »

I've heard that with large module sizes (not sure why mod size would affect it really), DelayCommand()s can sometimes be skipped, breaking pseudo-heartbeats (amung other things). Since OE doesn't seem to be changing Aurora itself very much, I don't want to assume this will be fixed in NWN2. Given that this bug would break parts of the spawn system (and more), I do kind of need to know if I should change it over to using an area heartbeat (which of course would probably only refresh the area every 10 beats or so, to simulate a 60-second pseudo-heartbeat).

Does anyone have any more information on this? Anyone know if its just rumor? I've heard quite a few silly rumors on the BW forums, and I don't know if this is one of them. I've never experienced anything like this myself.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Haven't seen that behavior myself either, though like with everything script related, it probably depends on how much you're throwing at your server hardware.
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

ç i p h é r wrote:Haven't seen that behavior myself either, though like with everything script related, it probably depends on how much you're throwing at your server hardware.
I once DM-killed a few hundred elder water elementals on BG. With the default AI, I think a death event involves a lot of silent inter-creature communication. Whatever the case, CPU went up to 100%, everyone timed out, and it stayed that way for a while. 20 minutes later, the CPU settles, and the server comes back, just like it was but minus some water elementals. So I tried again with more of them, and it took about 40 minutes to come back the next time. So, I'm a bit skeptical that nwserver remains stable throughout all that, but keels over with too many DelayCommand()s running.

In any case, DelayCommand()s are the only way I know of preventing TMIs in some cases. I need them to initialize spawn points, if I try to initialize all the spawn points at once in my load-testing module, the OnModuleLoad event TMIs at point 493. So I added DelayCommand()s and a counter to detect if any spawn points don't get initialized (along with a big error message if they don't) but so far haven't encounted any problems with a few thousand delay commands 1ms apart.

AcadiusLost had normal heartbeats get skipped on NC, but of course normal heartbeats don't break completely like a pseudo-heartbeat would if one was skipped. For all we know BW purposefully skips some heartbeat events if server load is high.
User avatar
Nerine
Skeleton's Knuckle
Posts: 23
Joined: Fri Jun 18, 2004 3:05 pm
Location: Bucks, UK GMT+1 (BST)

Post by Nerine »

I have only seen mention of delayed commands being skipped when long delays were being used and then only with modules that caused heavy CPU loads. But then I've also read that any event (including delayed commands and action queues) can be dropped if the CPU load gets too high for a sustained duration. I think it's just like how windows gets upset if a process takes too long without returning to the message pump. I tend to break things down into a few delayed commands if it has any potential for causing a high load, as such my own spawn scripts used in my personal mods only ever spawn one creature at a time - a function spawns a single creature, then calls itself on a delay to spawn the next one and so on - this way and with a little attention to CPU load I have never lost an event.
Nerine Galatea
ADM: ALFA006 - The Long Road

Member of ALFA2#07 - The Cold Lands
Image
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

*puts on Myth Buster hat*

Well, I've currently got nwserver itterating a local int up to 2^31 - 1 using a pseudo-heartbeat spaced 0.0001s apart. Its pegged my CPU at 99% for a while now, and it just passed the 20 million mark (I've got it reporting progress every 10 million iterations). Effecient it is not, but this seems like a non-issue to me :P I guess I could bloat the mod up and try it then.

I'ma go buy some groceries, come back and see if its done.

Oh, I also tested to see if TMI output was created for TMI'd DelayCommand()s, and it is.
Locked