[FIXED] Follow script

Here we stuff all the bugs we've managed to squash/squish/squelch.
Locked
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Follow script

Post 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.
Grimson
Developer
Posts: 802
Joined: Sat Jun 04, 2005 1:52 am
Location: Germany
Has thanked: 0
Been thanked: 0

Post by Grimson »

Do you have ADVANCEDPATHFINDING enabled in the uox.ini?
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post 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?
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post 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.
Scott
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post 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!
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post 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?
Scott
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post 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!
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post 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. ;)
Scott
Maarc
Developer
Posts: 576
Joined: Sat Mar 27, 2004 6:22 am
Location: Fleet, UK
Has thanked: 0
Been thanked: 0
Contact:

Post 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.
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

It is directional, thus each tile we'd need to store 8 cost values for it.
Scott
Maarc
Developer
Posts: 576
Joined: Sat Mar 27, 2004 6:22 am
Location: Fleet, UK
Has thanked: 0
Been thanked: 0
Contact:

Post 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 :)
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Good point....
Scott
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Still an issue. :)
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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!
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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.
-= Ho Eyo He Hum =-
Locked