mtk on 30/6/2019 at 12:08
So I'm working on fleeing AI, and basically it looks like all the AI, across multiple floors run to the same escape point located on the 2nd floor, even tho I've placed escape points all over the place.
On top of that, AI located in a place that has no direct route for the AI to reach upper floors does not flee at all, even tho there are escape points located in his area.
I'm getting confused on how this works, does AI prioritise some escape points over other? If so, how can I change it for specific AIs?
AI setup:
Inline Image:
https://i.imgur.com/c5bmmuX.png
Unna Oertdottir on 30/6/2019 at 12:28
Maybe pathfinding doesn't work.
You can set a custom flee point very each AI
AI--Response--Alert response
set a Goto object command there, also set the speed (very fast or fast)
mtk on 30/6/2019 at 13:13
Ok I did some initial testings, it really seems to me AI priorities escape points in order I placed them or something. I had around 3 escape points per floor, but I deleted all the new ones and placed the first 3 old ones across all floors. (1 per floor)
And it seems to be working now, tho I admit it is kinda confusing.
Thanks Unna for the tip.
R Soul on 30/6/2019 at 15:30
The distance is also taken into account, but I think it's calculated as a straight-line distance between coordinates, not the overall route, so a FleePoint on the next floor directly above the AI will be considered closer than another one on the same floor but at the opposite end of the building.
vfig on 30/6/2019 at 21:20
It's straight-line distance, yes, but the Z distance is slightly more complicated than that. If the Z coordinate difference to the flee point is less than 10 feet, then only the X and Y coordinates are taken into account when calculating the distance, i.e. sqrt(x^2 + y^2); otherwise the Z difference is *doubled* when calculating the distance, i.e. sqrt(x^2 + y^2 + (2*z)^2). I guess the idea is that the AI should slightly prefer to flee on level ground than up or down stairs?
AIs will also never flee to a flee point that's within 20 feet of themself or within 20 feet of whatever they're fleeing from (both using the above distance measurement). This might be the reason some of your AIs weren't flee to points near them.
After this, the weight of the flee point (i.e. the value of the Flee Point property on it) is used to pick the preferred flee point; it can have a maximum of 1.0. If the direction to the point (in a straight line) is towards the pursuer, then the weight is divided by 5. Then the distance divided by the weight is used to sort the flee points in preferred order. This means that a weight of 0.5 makes a flee point rank as if it was twice as far away; a weight of 0.33 makes it rank as if it was 3x as far, and so on. Once the points are ranked, then the AI attempts to pathfind to them in order; it will pick the first one that it can pathfind to.
If you create AIFleeTo links from an AI to one or more flee points, then it will only consider those points when deciding where to flee; otherwise it will consider all the flee points in the mission (up to a max of 256). In either case, the above distance and weight checks apply.
Incorrect: If you create AINoFlee links from an AI to one or more flee points, then it will never consider those points when deciding where to flee; the expiration property of the link is unused. Correction: AINoFlee links are supposed to work like that, but do not work in practice: the AI also uses them to keep track of where it has recently fled to, and will destroy all its AINoFlee links, regardless of whether they were ones the mission designer created or ones the AI was using internally. Sucks. If you want to limit an AI to only a given set of flee points, then create AIFleeTo links from the AI to all the flee points it should try.
(Remember too that the Flee Point property can be placed on guards, not just fixed objects. The flee code doesn't care—so it also doesn't know or care if the guard is alive or not; you should probably have a script remove the property if the guard goes braindead.)
(I was going to put all this sort of stuff into the Dromesday book last year, but I didn't have edit permissions.)
R Soul on 30/6/2019 at 23:41
That's good information, thanks for posting. Did you get that from the leaked source code or did you experiment?
Also, try again with the Dromesday Book. I just looked at the list of users and saw you as 'unverified', and my account seems to have permission to change users' statuses.
mtk on 1/7/2019 at 06:28
wow, great insight vfig, thanks a lot!