[FIXED] Follow script
Follow script
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.
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.
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!
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
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.
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:
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.
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
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
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!
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 =-