Page 1 of 1
Follow script
Posted: Tue Apr 03, 2007 7:54 pm
by stranf
Lag hits when an NPC set to follow a GM or a pet following a PC gets stuck behind an obstacle. If the PC/GM gets too far away the server goes into a super-lag mode. The cooling fans go into turbo speed, and the only thing the server does is try to plot an impossible path-find. The only way to break this cycle is to either:
1- log out as the offended GM/PC (this frees up the server)
2- kill and/or teleport the offending animal near the gm/pc
3- set the animal or pc to follow itself.
We have had a few games recently struggle because of this phenomenon (my PCs are getting into animal taming).
Could we have a check in the script or something to cancel the follow script if the animal/PC gets too far away from the target? Maybe a message sent to the PC/GM that says "<NPCNAME> is now lost"
Thanks.
Posted: Tue Apr 03, 2007 9:21 pm
by Grimson
Do you have ADVANCEDPATHFINDING enabled in the uox.ini?
Posted: Wed Apr 04, 2007 8:37 pm
by stranf
I do not have my .ini with me, as I am at work. I will check.
I assume I want it to be off, correct?
Posted: Fri Apr 06, 2007 1:52 am
by giwo
It's not so much a question of what it should be, to narrow down the issue we just need to know which pathfinding routine is screwing up.
I would recommend, however, that once you let us know what the option is, you switch it.
Posted: Fri Apr 06, 2007 3:03 am
by stranf
advancedpathfinding was set to 1.
I removed it to zero and played. It seemed to solve the lag issue, but nobody could walk up stairs!
Posted: Fri Apr 06, 2007 8:23 pm
by giwo
Now when you say nobody could walk upstairs, do you mean at all, or they simply couldn't follow you up the stairs?
Posted: Sat Apr 07, 2007 12:01 am
by stranf
Sorry, I was just trying to point out that I noticed a difference between the two scripts. If an NPC was following a GM with the advanced script, and the gm was "above", the NPC would most likely find the stairs and climb up. On the new script he likes to walk back and forth underneath the NPC.
I believe my lag issue IS in the AdvancedFollow script. Apperently it dosen't like to terminate (or teleport to) the PC, if that NPC is genuinley stuck. If your PC gates to the other side of Britannia, the server seems to try to calculate multiple "follow" paths from the NPC to the PC, and this ultimately bogs the server until the offending PC logs out.
Oh, and kudos to whoever coded the advanced follow script. Now that I am running with it off, I really miss how it worked!
Posted: Sat Apr 07, 2007 5:53 am
by giwo
Yeah, AdvancedPathfinding is still a work in progress. Though I thought I did add a maximum distance check in there *shrug*.
I created the routine, though it is largely based on the A* pathfinding standard. But even when it's not completely lagging the server out, it's definitely slower than the old pathfinding.

Posted: Sun Apr 08, 2007 3:41 am
by Maarc
It might be possible to add some optimisations in there giwo. You do have a max # of steps in there, but it's not controllable, and it's set to 1000

May want to make this controllable?
I suspect that most of the sluggishness would occur in the costing algorithm. You could look at potentially trading off memory for speed. You could attach a cost structure to a MapRegion, along with a delay value. If the MapRegion hasn't been touched in a long time, throw out the costing. Otherwise, you could keep an in memory map of that MapRegion and each tile's cost to go there (which you could then update any time an item is dropped, or a character moves). Saves you recalculating costs all the time.
Granted, the memory hit may not be cheap

And I've had only a superficial look, so I don't know if the cost really is on a per tile basis, or based on directional access to a tile. But just a thought.
Posted: Mon Apr 09, 2007 2:56 pm
by giwo
It is directional, thus each tile we'd need to store 8 cost values for it.
Posted: Tue Apr 10, 2007 12:07 am
by Maarc
That'd smart a little. Though if you think it'd never have a cost higher than 32, you could probably stuff all 8 values into a single byte

Posted: Tue Apr 10, 2007 3:05 am
by giwo
Good point....
Posted: Wed Jul 02, 2008 2:04 am
by Xuri
Still an issue.

Posted: Sun Jan 18, 2009 11:20 pm
by Xuri
Tested in 0.98-4.0, and I'm unable to reproduce this. I've tried fencing in my pets to make them unable to follow me, I've tried outrunning them (and that's hard!) and I've tried 'RTELEing my way across the map so they'd lag behind.
At no point did the server appear to grind to a halt. Unless anyone else can reproduce this in the near future, this goes in the bug archive as FIXED!
Re: Follow script
Posted: Mon Mar 19, 2012 9:57 pm
by Xuri
Fixed numerous issues of server coming to a halt due to (advanced) NPC pathfinding. Fixes are up on CVS, and included in UOX3 0.99.