On Monday 21 July 2008 11:14:10 Quinn Yee Qin Teh wrote: > (I'm assuming that the distance value is not just the physical distance, > but takes into account obstacles in the path. Is that correct?)
You are correct. > Actually, why not for each possible resource (when choosing which one to > collect), look at the *sum* of the distance value from the worker AND > distance value from the building? This way we can find the resource that is > easiest to get without going too far off the shortest path from the worker > to the building. So there is always only one calculation to make which will > always give the best answer, no conditional branches needed. Our pathfinder is gradient-based (aka grassfire/NF1/wavefront). This is great as you need a single pass for all instance of a type of resource for all units in a team. More precise metrics (such as minimizing the distance to both a resource and a specific building) would probably have a much bigger computational/memory cost. > This could only work if it is already known what kind of resource the > worker is supposed to get (the target resource), so I'm just wondering why > is the target resource not known at the start? In any case, what I am doing > with my project here will take care of this as it will break down tasks > (like the construction of a building) into subtasks (the delivery of each > individual resource unit) and each subtask will be allocated to the best > worker to do it. How to figure out which is the "best" worker is the focus > of my project so I will be doing that, whether this gets implemented into > the game or not. I'll let you guys know how it goes at the end of the year. We are all happy that you are enthusiast about glob2, and maybe you'll find new and better solutions; but keep in mind that a bunch of fairly bright people have tackled the problem during the last years and thus a better solution, although certainly possible, would hardly be a trivial one. Have a nice day, Steph -- http://stephane.magnenat.net _______________________________________________ glob2-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/glob2-devel
