The eternal Server Clock issue
#1
Posté 17 mars 2011 - 05:41
And finally, my world reached the apparent size/script complexity to cause it to happen.
So I went through all of the scripts to make them as efficient as possible, and I ran the NWNX profiler to determine where the resources are being used. After all of that, and essentially a clean profilier bill of health, I still have the clock problem.
Two questions.
1. is there any other known issue that prevents the game clock from being updated? (CEP, etc?)
2. If an NPC has it's heartbeat script completely removed, and has no other interactions in an area (for example, is put in a zone PCs never get to) does that NPC still eat resources? I cannot see evidence of it in the profiler, but I don't know if the game still assigns resources to NPCs with no scripts simply because they are NPCs. Anyone know?
TIA.
#2
Posté 18 mars 2011 - 10:31
Their priority is kept low in such areas where the pc cannot get to.
In areas where the Player can see the npc, the priority is raised.
Virusman posted on nwn forums not long ago, that he was working on a fix for the server clock issue via nwnx.
Some people have tried to solve the issue themselves, via using a Heartbeat script that
Sets the Calendar date and time to the current time and date etc, to force the server to register the new time and date.
Varying success.
I am just holding out for Virusman to make a win32 approach for nwnx.
#3
Posté 18 mars 2011 - 12:09
#4
Posté 18 mars 2011 - 01:09
SetAILevel(
object oTarget,
int nAILevel
);
AI_LEVEL_DEFAULT -1 Default game-specified setting. The game will apply the appropriate AI setting as necessary.
AI_LEVEL_HIGH 3 High priority, smartest AI, but extremely high CPU usage required for AI. Avoid using this except during a cut-scene.
AI_LEVEL_INVALID -1 Invalid AI level setting.
AI_LEVEL_LOW 1 Low priority, mildly stupid, but slightly more CPU usage for AI. Typically used when not in combat, but a player is in the area.
AI_LEVEL_NORMAL 2 Normal priority, average AI, but more CPU usage required for AI. Typically used when creature is in combat.
AI_LEVEL_VERY_HIGH 4 UNKNOWN
AI_LEVEL_VERY_LOW 0 Very Low priority, very stupid, but low CPU usage for AI. Typically used when no players are in the area.
You can try setting their AI manually, perhaps this may solve it.
Also -
Are you sure you need 580 zombie npc's in all areas of the module.
That translates not just to 580 zombie npc's given heartbeats to fire, but the areas also get a hightened priority for having npc's in them too.
Perhaps working on a clean-up script that
1. When the area is empty, create a waypoint at the location of the npc, waypoint contains data relating to that npc.
2. When area is entered, or player enters server etc, the waypoint spawns its payload, nd destroys itself.
This way, the npcs clean themselves up, and cpu usage and prioritization is somewhat resolved.
#5
Posté 18 mars 2011 - 01:14
And what if you remove all of these zombies? Does it go away?Ivanovich wrote...
Well, NPCs must eat resources regardless of their script package, because I removed every single firing script and just have 580 areas with zombie npcs - no other scripts firing and the stupid clock bug is still there.
Baaleos: Im don't trust this SetAILevel in any way. From what I know the AI level is just checked in default AI scripts to choose behaviour, but the scripts are still fired. Do you have any proof for it?
#6
Posté 18 mars 2011 - 01:42
#7
Posté 18 mars 2011 - 04:42
#8
Posté 18 mars 2011 - 05:27
#9
Posté 18 mars 2011 - 05:54
Increasing areas can actually help if its done by splitting a large map into 2 or 3 smaller, but connected areas.
Setting all or most NPCs to use a spawn in system whether via encounter triggers or other scripts is something I always recommend.
For modules that are simply still too large. Try the following in the module's hearbeat script.
void main()
{
int iHour = GetTimeHour ();
int iMinute = GetTimeMinute ();
int iSecond = GetTimeSecond ();
int iMillisecond = GetTimeMillisecond();
SetTime(iHour, iMinute, iSecond, iMillisecond);
}
#10
Posté 18 mars 2011 - 07:01
Well I was trying to point out that there is no way to indicate this. I don't know if the eat anything, well probably yes because there are still hardcoded instructions that fires the script if creature perceive player (or other creature?) though there is no script to run, the hardcoded part of this probably still works. But if they are in non-accessable area it should be fine.Ivanovich wrote...
All of the scripts from the "zombies"
are removed. So what I was trying to find out was whether or not an NPC
still used resources even without any scripts in it's events.
Doesn't this advance the date by a day everytime? I can't test it because I don't have this issue, but from my knowledge about SetTime function, it can only go forward and if you set the same hour which is now, you advance date by a one day. Question is if the hour is really the same when clocks saying 8 but GetTimeHour says 9. But this script does updating clock every 6 seconds so hour is the same at least 9 times from 10.kalbaern wrote...
void main()
{
int iHour = GetTimeHour ();
int iMinute = GetTimeMinute ();
int iSecond = GetTimeSecond ();
int iMillisecond = GetTimeMillisecond();
SetTime(iHour, iMinute, iSecond, iMillisecond);
}
#11
Posté 18 mars 2011 - 08:45
kalbaern wrote...
Shrinking resources can help alot. IE ... anything on the pallettes that a DM does not actually need or is not created via a script or spawning should be deleted.
Increasing areas can actually help if its done by splitting a large map into 2 or 3 smaller, but connected areas.
Setting all or most NPCs to use a spawn in system whether via encounter triggers or other scripts is something I always recommend.
For modules that are simply still too large. Try the following in the module's hearbeat script.void main() { int iHour = GetTimeHour (); int iMinute = GetTimeMinute (); int iSecond = GetTimeSecond (); int iMillisecond = GetTimeMillisecond(); SetTime(iHour, iMinute, iSecond, iMillisecond); }
Yeah, i've seen this script before and I guess I'm going to have no other alternative. The only thing I don't like about it (apart from the obvious) is that the skybox transitions will be instant, and not gradual (sunset, sunrise, etc).
#12
Posté 18 mars 2011 - 09:07
Be well. Game on.
GM_ODA
#13
Posté 18 mars 2011 - 09:16
Now this is just pure speculation on my part but ultimately I think the amount of areas plays a huge part in whether or not someone will end up with this problem. You have 580 areas. That's 580 heartbeats firing every 6 seconds. So take that plus any other heartbeats that you might be using for creatures, objects, triggers and then add to that any recursive (pseudo heartbeats) that you might be using + pretty much everything that is using delayed commands. Might this point to a specific limit on the amount of heartbeats & delays the engine can handle? Or does that number depend on the machine running the PW? It would be nice if there was a definitive answer but I don't think we will ever get one. : (
EDIT: although as ehye khandee pointed out with 1250 areas and no clock issue...just gos to show how confusing it is.
Modifié par GhostOfGod, 18 mars 2011 - 09:44 .
#14
Posté 18 mars 2011 - 09:45
NESS ofcourse is not required. You could use any spawning system that allows you to restrict creature spawning to when a PC is present.
Modifié par henesua, 18 mars 2011 - 09:49 .
#15
Posté 18 mars 2011 - 09:47
One thing certainly most have noticed is if you have a group of PC's fighting in one area and it will cause noticeable lag. I use this evidence to support the conclusion that it is running scripts, i.e. PC's fighting is running a lot of scripts, and their hierarchy is very high, is what causes lag. Since there is also a hierarchal element to how scripts are called the low hierarchy of the time element contrasted against that of combat scripts supports this conclusion. In other words all scripts are not created equal.
Modifié par ffbj, 18 mars 2011 - 09:58 .
#16
Posté 18 mars 2011 - 09:58
So if your server's average loop time is over 6000/n ms, the clock is never updated.
Modifié par virusman, 18 mars 2011 - 10:00 .
#17
Posté 18 mars 2011 - 10:00
kalbaern wrote...
For modules that are simply still too large. Try the following in the module's hearbeat script.void main() { int iHour = GetTimeHour (); int iMinute = GetTimeMinute (); int iSecond = GetTimeSecond (); int iMillisecond = GetTimeMillisecond(); SetTime(iHour, iMinute, iSecond, iMillisecond); }
By the way... when we were having issues with our server clock the above did NOT work. Rather than waste time with such hocus pocus, I suggest going after the problem - server load. and reduce it.
I missed the fact that you removed the NPCs and yet with only 580 areas you have clock issues. Wow. You must have some resource hogging scripts running somewhere else. Or perhaps these areas are large and complex?
Modifié par henesua, 18 mars 2011 - 10:09 .
#18
Posté 18 mars 2011 - 10:08
http://nwn.bioware.c...350798&forum=56
#19
Posté 18 mars 2011 - 10:28
Current statistics
-----------------------------------------------------------------------------------------------
x2_def_percept 37 msec 388 calls | minetrigger 0 msec 1 calls |
revealzone 0 msec 89 calls | sit_chair 0 msec 1 calls |
saltypearl 0 msec 1 calls | nw_ch_ac1 0 msec 32 calls *|
@MaraadanSorcere 7 msec 9 calls | sc_barsit1_os 0 msec 1 calls |
loc_spawn_herb 0 msec 2 calls | npcomarsit 0 msec 2 calls |
x2_def_spawn 75 msec 224 calls | sleeponspawn 0 msec 2 calls |
x2_def_heartbeat 0 msec 128 calls *| waitressonspawn 0 msec 1 calls |
sc_barmaid_os 0 msec 1 calls | trigspawnguards 7 msec 82 calls |
nw_ch_ac2 0 msec 19 calls | spawnsleeping 0 msec 2 calls |
sc_barsit3_os 0 msec 1 calls | x3_mod_def_load 1 msec 1 calls |
nw_c2_dropin9 0 msec 2 calls | spawnguard 0 msec 1 calls |
transfersandstrm 0 msec 2 calls | nw_c2_default1 0 msec 48 calls *|
trap_on_load 0 msec 1 calls | raidingpartyspaw 0 msec 2 calls |
NW_G0_sleep 4 msec 68 calls | trigspawncreatur 0 msec 1 calls |
nw_c2_sitting 0 msec 11 calls | minestrigge2 0 msec 4 calls |
sitwarden 0 msec 1 calls | sc_guardspawn 7 msec 1 calls |
x0_ch_hen_spawn 0 msec 1 calls | x2_mod_def_aqu 1 msec 1035 calls |
pack_ox_spawn 0 msec 6 calls | nw_ch_ac9 0 msec 1 calls |
nw_c2_herbivore 0 msec 2 calls | nw_c2_default2 0 msec 516 calls |
sc_barsit2_os 0 msec 1 calls | x0_ch_hen_percep 1 msec 15 calls |
nw_c2_default9 97 msec 466 calls *| npcprincesit 0 msec 2 calls |
sc_bar_ud 0 msec 3 calls |
-----------------------------------------------------------------------------------------------
Elapsed time : 6422 msec
Runtime delta : 1 msec
Total cumulative runtime : 237 msec
Total number of scriptcalls : 3177
This is hardly anything to get concerned about. I keep wondering if it's something to do with the CEP 2.3 (of which I've had issue after issue with).
If it's none of this, then it's simply the number and size of the areas (many of them are 32x32). But since they dont call anything or cause processing time until someone is in them, it doesn't make any sense.
Modifié par Ivanovich, 18 mars 2011 - 10:39 .
#20
Posté 18 mars 2011 - 10:31
http://www.nwnx.org/...p?p=14161#14161
Modifié par virusman, 18 mars 2011 - 10:32 .
#21
Posté 18 mars 2011 - 10:39
virusman wrote...
The fix for this bug is now available in NWNX Fixes (Linux only at the moment):
http://www.nwnx.org/...p?p=14161#14161
That's good to know, virusman. Spacibo. Unfortunately we do not use Linux.
Modifié par Ivanovich, 18 mars 2011 - 10:40 .
#22
Posté 18 mars 2011 - 10:57
Well anyway, try to delete half of the areas from module.
Also, whats your server machine specifics and what about internet connection?
It happens immediately when you start a game or later?
(Since you using cep2 i guess you are short on blueprints so I wont ask for this)
Have you tried to run the module without NWNX?
Or if you do not run on NWNX, then try to.
Modifié par ShaDoOoW, 18 mars 2011 - 10:59 .
#23
Posté 18 mars 2011 - 11:10
This is clearly a bug in the server, and NWNX plugin fixes that bug. The fact that it appears only on heavily loaded servers doesn't mean that the behavior is by design.ShaDoOoW wrote...
This "fix" is actually rather workaround (of course for certain servers its a neccessary, but is it for yours?). The issue itself indicates, that something is not totally right.
#24
Posté 18 mars 2011 - 11:11
ShaDoOoW wrote...
This "fix" is actually rather workaround (of course for certain servers its a neccessary, but is it for yours?). The issue itself indicates, that something is not totally right. Your scripts looks fine, and if its not the area number as ehye_khandee said, then maybe the problem is in cep? I wouldn't be surprised much, because CEP overstepped many limits and it caused many issues like DM client crashing.
Well anyway, try to delete half of the areas from module.
Also, whats your server machine specifics and what about internet connection?
It happens immediately when you start a game or later?
(Since you using cep2 i guess you are short on blueprints so I wont ask for this)
Have you tried to run the module without NWNX?
Or if you do not run on NWNX, then try to.
1. Deleting approximately 50 areas makes it go back on again.
2. The machine and server are top of the line. I won't bother with the specs, but trust me, I spared no expense.
3. Happens immediately on game start.
4. Have tried with NWNx and without. But not with the NWNx fix since, as I said, we dont use linux and it's only available in linux.
#25
Posté 18 mars 2011 - 11:25
We had 200 more areas than you, but almost none of our areas are anywhere near 32x32 in size.
Also.. you are using a windows box for your server .... ouch. Thats gotta reduce performance.
Modifié par henesua, 18 mars 2011 - 11:26 .





Retour en haut







