Maybe one of you scripting/geometry gurus can write a script that generates move positions for a particular building model. For a building type, we can currently detect Building Positions, and Doors. But that is not enough positions to calculate a path for a scripted AI to move through (see topic JBOY Scripted Path). What I am hoping is possible, is to do the following:
Find External Doors (entrances to buildings). Pick one External Door to be beginning of path.
Create position on outside of door (outside building) (Red Marker 1 in screenshots below).
Create position inside of building (Red Marker 2)
Ray cast around, can entire room be seen from this inside position?
Locate interior door or transitions to other rooms by line of sight and capture position.
Bottom line, calculate a path as presented in the ordered Red markrs below.
Key for screenshots:
Yellow markers in door jambs are door positions (which we can get now)
Blue markers are Building Positions we can get now (but may be of no use to Scripted AI Paths)
Red markers are Positions we hope can be calculated to make a path through a building. They are numbered 1 through N to simulate the path we want AI to travel to clear rooms.
For this building, we find an external door, and use that to calculate starting position of path: Two positions should be calculated (one outside door (1), and one inside door(2)).
Then we enter the building. From here the layout is analyzed and find that we need to connect to the internal hallway across the room. There is no hard door, but we want a position calculated inside room we are in, and other side of door in hallway (positions 3 and 4 by the internal door). From position 4 we can see the whole hall way so do not have to go further down the hallway. Next we detect that this is a two story building, so we must find the bottom of the stairs (6), the landing corner (7), and the top of the stairs (8). When we know bottom of stairs (6) we need to connect our path from the hallway (4) to bottom of stairs (6). But this cannot be a straight line, because there is a wall blocking line from 4 to 6. So we calculate an intermediate position (5) in the room (so AI can walk from hallway (4) through position (5) then to bottom of stairs (6) -- i.e position 5 can see both 4 and 6 unobstructed).
Next we move up to second floor. We have top of stairs position (8). This is a divide room, so position 8 cannot see entire room behind partial wall. So calculate the next position (9) which allows full unobstructed view of upper side room. Once he have position 9 we can see all the upstairs except for side room that has a physical door (position 10). Calculate a position on either side of door (10 and 11). Then AI can enter this 2nd floor side room.
Once inside second floor side room (11), we need a position inside room (12) where we can see entire move for clearing. For clearing we may not need position 13 but maybe we want to move there because of the window. Not sure about that.
If we were able to calculate all of the above, then an AI could clear every room in this 2 story building.
BUT, this building has a back entrance also (see below). So we would want to calcualte a path for walking this building from this alternate entrance also. So beginning position outside door (1), another path is analyzed to walk the same building. Maybe if we already have a path segment for going upstairs, it only needs to calculate new path to position 4. And then it would use the same path segment to go upstairs that was previously calculated.
This is some crazy stuff and I don't know if its doable. Maybe one of you cool geniuses out there can do it!!!
Good luck!!!!
Hi all, quick update. Made good progress over the past few days (bug-fixing, refactoring, etc). Notably, I'm now caching the floor points in profileNamespace, which has sped up development considerably. News-flash, moved onto Chokepoints!
To get Chokepoints, we need two critical ingredients:
A good clean outline.
A reliable way to get all nodes contained within the outline.
Recall as of last update, our outlines were pretty good but did not line up with the stairs (so not clean). I now added a process by which the outlines clean themselves, and change shape over as many iterations as necessary to arrive at final cleaned shapes. A few snapshots of the process in action:
Original (rough) outline:
Detection Process (picture this happening potentially multiple times as the outline mostly shrinks & sometimes grows slightly):
Final Clean outline:
Now, you may be wondering: “Why have the outlines self-clean like this? What happened to dumping and rebuilding the collections?” For those curious, here’s why:
Also, the cleaned outlines do a great job now on balconies and porches, by detecting those skinny rails, etc. (Note- We can't check all the collection's connections like this, as that would be prohibitively expensive CPU-wise, grinding down development of these scripts to a halt. Sticking to this increased level of detection on just the outlines is quite CPU friendly.)
In the mean time, I found a way to get all the nodes inside the outline of any collection, even if it wraps up above & over itself. This is a huge breakthrough, as using inPolygon (and cutting the collections) is no longer necessary!
Now we can get the Chokepoints (… well almost). So far, we have raw "chokeway" points. I’m going to have to pour over a bunch of possible chokeway point / outline arrangements and develop a good algorithm, in order to ultimately refine these raw chokeway points into usable Chokepoints. Yeah, babysteps!
Raw "chokeway" points: