ttyborg / castlesand

Automatically exported from code.google.com/p/castlesand
0 stars 0 forks source link

Serious Pathfinding Issue #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Townsmen doesn't using the nearest Storehouse or Inn, instead they take a big 
roundabout to the further storehouse/inn. In critical situations they even die 
in starving bacause they using the further Inn and don't get food in time.

I come up with this error in a multiplayer game, but i made an example map for 
it in the latest revision. Just run it, turn the speed on, and watch how the 
townsmen ignores the nearest storehouse and inn.

Original issue reported on code.google.com by jec...@gmail.com on 8 Nov 2011 at 12:12

Attachments:

GoogleCodeExporter commented 9 years ago
That's because the other inn IS closer by the number of tiles between them. We 
don't have an efficient way to test the length of a route when walking on a 
road, so we can only do a straight distance test. It would have to build a 
route to every possible destination then chose the route with the shortest 
distance. This is similar to the resource harvesting, e.g. your fisherman might 
go fishing on the other side of the river because it is within his harvesting 
radius, even though it takes him 5 minutes to walk there. I've modified the 
item on the bugs list to mention this case but I think this will be complicated 
to fix.

Original comment by lewinjh@gmail.com on 8 Nov 2011 at 1:55

GoogleCodeExporter commented 9 years ago
And what if there is no route to the nearest inn?

Original comment by kocsis1d...@gmail.com on 19 Nov 2011 at 10:19

GoogleCodeExporter commented 9 years ago
Then they will not use that inn. It only selects from inns that are on the same 
floodfill island as the unit is on.

Original comment by lewinjh@gmail.com on 19 Nov 2011 at 10:26

GoogleCodeExporter commented 9 years ago
I wanted to test it, but the result is interesting.

Original comment by kocsis1d...@gmail.com on 19 Nov 2011 at 12:48

Attachments:

GoogleCodeExporter commented 9 years ago
Yeah the delivery system is not designed to handle independent villages on one 
team, so it lags a lot due to failed path finding

Original comment by lewinjh@gmail.com on 19 Nov 2011 at 1:51

GoogleCodeExporter commented 9 years ago
Ok that is fixed. That test mission in Bug.7z now runs smoothly and correctly. 
The delivery queue was not checking whether the serf can access the from house. 
Thanks.

Original comment by lewinjh@gmail.com on 19 Nov 2011 at 2:43

GoogleCodeExporter commented 9 years ago
Maybe you can use a serf path-finding script to find the nearest inn by road 
tiles?

Original comment by ppienia...@gmail.com on 27 Nov 2011 at 1:54

GoogleCodeExporter commented 9 years ago
Yes we can, but path-finding algorithms take a lot of CPU so it must be 
implemented efficiently. That is our final plan for this system, we just 
haven't had time to do it. Same with the fisherman walking miles to the far 
side of the river because it is within a radius of his house, and other 
villagers like stonemasons, woodcutters, etc.

Original comment by lewinjh@gmail.com on 27 Nov 2011 at 2:00

GoogleCodeExporter commented 9 years ago
Lewin has fixed pathfinding bug we had. Also he has made citizens-miners to 
walk wothin their mining radius. Picking Inn uses closest one, that's not a big 
flaw and we probably won't work on it.

Original comment by kromster80@gmail.com on 17 Dec 2012 at 5:51