Jump to content
johnnyboy

Generate AI path for building

Recommended Posts

On 4/26/2019 at 9:17 PM, madrussian said:

Ok, got some time today and took all my spaghetti code and made it into an proper system (broken into parts, etc).  Because it was getting crazy scrolling up and down through one giant init file.  Next up, somewhat in order:

 

1. Fix a couple (semi-trivial?) bugs I found trying it on other ruins.
2. Split the collections up by floors/rooms.  This is tricky, because for instance see that pic of how the bottom of the stairs outline (yellow rays) and the collection outlines (green rays) don't line up?  I think I know how to tackle this:  Get the initial collections.  Then get stairs and "choke point areas" (think doorless doorways).  Then dump the initial collections and rebuild them, now with the stairs and "choke points areas" as the new boundaries between the collections.  This will line up the outlines properly and should give us the coveted Rooms (by floor).

3. Get all the Perceived Entry Points (PEPs), for first floor only.  (Which is probably the best I can do, for buildings like those ruins missing entire walls, etc)

4. Tackle actual doors.  Detecting them, assigning them to Rooms, etc.  Thankfully, actual doors already act as boundaries between collections (for collection detection purposes).

5. Figure out what we actually need to store.  I know johnnyboy you would prefer simple paths, as that's what your script uses to move the AIs.  OK, more on what I envision pathing-wise once I have more to show.

 

This is incredibly impressive! I can't wait to see how this comes together - I am definitely going to be following this thread. 

  • Like 4

Share this post


Link to post
Share on other sites

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:

  1. A good clean outline.
  2. 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:

Scan-Buildings-9.png

 

Detection Process (picture this happening potentially multiple times as the outline mostly shrinks & sometimes grows slightly):

Scan-Buildings-10.png

 

Final Clean outline:

Scan-Buildings-11.png

 

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:

Spoiler

 

I ran into a bit of chicken/egg conundrum. From my perspective, cutting up the collections served two purposes:  First, to get each outline on it's own level, so that we could use the inPolygon command to check whether any point was inside the outline or not.  In other words, using inPolygon to check whether point is within an outline always works... as long as the outline does not wrap up and over itself!!! (like in a multi-floored building).  Second, to get clean outlines (which it turns out we actually need for the chokepoints).  Recall we were going to use the chokepoints and the stairs as the boundaries to cut the collections (by dumping and rebuilding).  Here's the problem.  Based on recent experience, getting the stairs is not always going to be 100% reliable.  There will always be edge cases, and of course I'll fix them as I encounter them.  But unfortunately long story short, this is not a reliable way to cut the collections.  And again to get Chokepoints we absolutely need clean outlines, which we were going to get by… (drum roll) cutting the collections.

 

Thankfully, I busted out of this vicious chicken/egg mind-trap cycle by implementing the self cleaning outlines, described above!

 

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:

 

Scan-Buildings-12.png

 

Scan-Buildings-13.png

  • Like 10
  • Thanks 1

Share this post


Link to post
Share on other sites

That is beautiful progress man.  I hope Bohemia doesn't recruit you before this is done!    (I feel guilty on my end, as I have no new progress to report...I had to give my brain a rest for a few days).

  • Like 2
  • Haha 1
  • Sad 1

Share this post


Link to post
Share on other sites

@madrussian dude, this is just nuts. Amazing work (so far already!).

Sorry if it was mentioned somewhere before but I can't read the whole thread right now - how will AI be able to navigate through this?
Like, will people need a function to make them enter the house or did you find a way to navigate your nodes on their own?

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, laxemann said:

Sorry if it was mentioned somewhere before but I can't read the whole thread right now - how will AI be able to navigate through this?
Like, will people need a function to make them enter the house or did you find a way to navigate your nodes on their own?

 

Please johnnyboy correct if I've got any of this wrong, but basically his script motors the AI around using playMove (or similar, by playing animations).  Once we have a good set of usable points (which my building scanner will hopefully be able to generate), we'll apply Sarogahtyp's Simple Shortest Paths (or one of the other node path selection functions he's developing) to pick a path, and motor our AIs in and out:

 

My ultimate goal is to assemble a giant array with the type names of all buildings in the game (including all popular mods), and have my building scanner run all night (or for days?) and capture all the important points from all those buildings.  After we get all the basic points covered, I hope to include "fighting positions"  so AI could potentially take up positions in a building based on the direction of the threat, etc.  Btw - Froggy mentioned this quite excellent idea, thanks for that!

 

From my perspective, johnnyboy's project is 100% worthwhile and his awesome demo videos sealed the deal getting us on board to help out.  However, I would suggest keeping your expectations somewhat in check.  As someone mentioned once we integrate all the parts, the whole thing might be kinda wonky, etc.  My scanner will be evolving over time, and most likely won't always pick the best points.  And for heaven's sake, we're using forced animations to power the AI around.  Hmmm... What could possibly go wrong? :rofl:

 

Also johnnyboy is trying to figure out how to get multiple AI to operate inside a building simultaneously, but as you can imagine that will be quite a juggling act.  Hoping he can pull it off!

  • Like 6

Share this post


Link to post
Share on other sites

@madrussian's summary of our efforts in the previous post is spot on regarding potential of our combined efforts (sarogahyp's, the mad russkie's, and myself).  And he is correct in pointing out its potential shortcomings (i.e., AI not performing as hoped).  Wish us luck!

 

Also note that I think @madrussian's building node library may have other uses beyond my AI scripted path, and is worthwhile as a standalone project. 

 

Possible usages for Building Node Library:

  • Scripted AI navigates building (what I'm working on)
  • AI on the street scanning second story window positions for possible threats
  • AI calling out very specific threat positions in a building:  "Sniper on west side, 3rd floor balcony!"
  • more defensive/tactical positions for static ai placement (windows, balconies, roof edges, etc.)
  • where to place indoor room lights
  • aid placing of furniture
  • where to place a ladder for AI to access a window or balcony
  • what else?  I'm sure there's more I can't think of...
  • Like 7

Share this post


Link to post
Share on other sites
14 hours ago, johnnyboy said:

Possible usages for Building Node Library

 

Imagine being able to do these queries on a building:

Get all rooms with X access points

Get all balconies

Get rooms with no windows

Etc

 

and get a list of polygons defining the shape of the rooms and their correspond floor height all in modelspace. That's my new wet dream... Perfect for setting up dynamic but immersive objectives that take place inside buildings. Nerd-gasm... 

 

Now I know that might not be exactly what we get but holy crap this project is brimming with potential. 

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

Hi all, quick update.  Made a little progress, here's a quick video!  (~ 9min)

(For added fun, play this for soundtrack while watching...)

 


^ OK, that was fully automated and how it looks when everything goes right.  The system is using refined chokepoints now (which are working extremely well now across different building types), plus refined window points & refined entry points (both of which are extremely WIP on other buildings... but lol happen to work very well in this here pub).  In other words please don't be fooled, as at the moment not every building does anywhere near this well.

 

At the end I used Sarogahtyp's Simple Shortest Paths Dijkstra (for that last "rifle icons" bit).  Thanks again Sarogahtyp!


Here are the points from that last run generated for ye ole "Land_A_Pub_01" (in building model space), ready to go:

_nodesList = [[0,[5.50879,-5.24146,-5.77265]],[1,[-1.36621,-6.34155,-5.77265]],[2,[-2.46631,0.808594,-5.77265]],[3,[-0.816406,-4.11401,-5.77265]],[4,[-0.816406,0.781006,-1.78779]],[5,[6.3335,2.98096,-1.78779]],[6,[6.3335,1.38599,-1.78779]],[7,[0.53125,-6.06665,-1.78779]],[8,[-1.06372,-6.06665,-1.78779]],[9,[-2.21875,-5.51636,-1.78779]],[10,[-3.81372,-5.51636,-1.78779]],[11,[-2.21875,-5.51636,-5.77265]],[12,[-3.81372,-5.51636,-5.77265]],[13,[-1.06372,0.533447,-5.77265]],[14,[1.08105,0.533447,-5.77265]],[15,[0.283691,-1.1167,-5.77265]],[16,[0.283691,-3.01392,-5.77265]],[17,[4.68359,2.48608,-5.77265]],[18,[4.68359,4.08105,-5.77265]],[19,[1.93359,4.08105,-5.77265]],[20,[1.93359,2.6416,-5.77265]],[21,[0.833496,-3.61914,-5.77265]],[22,[0.833496,-4.96631,-5.77265]],[23,[0.833496,-4.96655,-5.77265]],[24,[0.283691,-6.31396,-5.77265]],[25,[0.833496,-5.76392,-1.78779]],[26,[0.833496,-4.16895,-1.78779]],[27,[6.60864,7.40845,-1.78779]],[28,[6.60864,-3.0415,-1.78779]],[29,[5.50879,-5.24146,-1.78779]],[30,[-7.14136,-6.34155,-1.78779]],[31,[-7.14136,0.808594,-1.78779]],[32,[-3.84131,-6.34155,-5.77265]],[33,[-7.14136,0.808594,-5.77265]],[34,[0.00878906,6.8584,-5.77265]],[35,[6.60864,4.1084,-5.77265]],[36,[6.60864,-0.291504,-5.77265]],[37,[6.60864,3.28345,-1.78779]],[38,[6.60864,1.0835,-1.78779]],[39,[6.60864,-1.11646,-1.78779]],[40,[3.5835,-6.34155,-1.78779]],[41,[1.38379,-6.34155,-1.78779]],[42,[-1.9165,-6.34155,-1.78779]],[43,[-5.21631,-6.34155,-1.78779]],[44,[-4.6665,0.808594,-1.78779]],[45,[-1.9165,0.808594,-1.78779]],[46,[-6.31641,-6.34155,-5.77265]],[47,[-4.6665,0.808594,-5.77265]],[48,[0.00878906,4.93335,-5.77265]],[49,[6.60864,6.5835,-5.77265]],[50,[0.00878906,4.93335,-1.78779]],[51,[0.00878906,7.13354,-1.78779]]];
_connectionsList = [[0,16],[0,17],[0,21],[1,3],[1,11],[2,11],[2,13],[3,4],[3,1],[3,11],[4,3],[4,45],[5,6],[5,37],[5,50],[6,5],[6,29],[6,38],[7,8],[7,25],[7,41],[8,7],[8,9],[8,42],[9,10],[9,8],[9,42],[9,45],[10,9],[10,30],[10,43],[10,44],[11,12],[11,1],[11,2],[11,3],[12,11],[12,32],[12,46],[13,14],[13,2],[14,13],[15,16],[16,15],[16,0],[16,21],[17,18],[17,0],[17,36],[18,17],[18,19],[18,35],[19,20],[19,18],[20,19],[21,22],[21,0],[21,16],[22,21],[22,23],[23,22],[25,26],[25,7],[25,29],[25,40],[25,41],[26,25],[28,29],[28,39],[28,40],[29,6],[29,25],[29,28],[29,38],[29,39],[29,40],[29,41],[30,10],[30,31],[30,43],[31,30],[31,44],[32,12],[32,46],[33,47],[34,35],[35,18],[35,34],[35,49],[36,17],[37,5],[37,50],[38,6],[38,29],[38,39],[39,28],[39,29],[39,38],[40,25],[40,28],[40,29],[40,41],[41,7],[41,25],[41,29],[41,40],[42,8],[42,9],[42,45],[43,10],[43,30],[44,10],[44,31],[45,4],[45,9],[45,42],[46,12],[46,32],[46,47],[47,33],[47,46],[49,35],[50,5],[50,37],[50,51],[51,50]];

Alright johnnyboy, send in some troops and let's see this bad boy in action. :shoot:

 

So I've been thinking a lot about the ramifications of our combined efforts lately.  I know I mentioned potential wonkyness etc along the way, but I must say we really do have the potential to fundamentally change the game here.  It's all about reliability.  If we can reliably get the AI in and out (and have them resume engine-pathing upon exit), the sky becomes the new limit and suddenly we can achieve things currently unimaginable.

 

OK that's it for now, back to secret lair. :hammer:

 

  • Like 6

Share this post


Link to post
Share on other sites

Very cool update vid and excellent choice of music again (I just got tickets to see Robert Plant in October!).  Been buried with real work, but hope to make progress on my end next week.  Thanks for the great effort.

  • Like 3

Share this post


Link to post
Share on other sites
4 hours ago, johnnyboy said:

Very cool update vid and excellent choice of music again (I just got tickets to see Robert Plant in October!).  Been buried with real work, but hope to make progress on my end next week.  Thanks for the great effort.

 

That's cool. I saw Plant with Page way back in 95, Plant could sure hold a note for a long time. I can't even hold my breath that long. ✌️

 

 

  • Like 1

Share this post


Link to post
Share on other sites

I would love to see how I could incorporate something like this into Vcom - that would be really cool.

  • Like 6

Share this post


Link to post
Share on other sites

Its against the rule to ask for updates but just letting you know those 'Matrix-ey lines going everywhere Node-y' videos give some people nerdgasms (not me of course) soo you might wanna keep em coming *blinkyeyeEmoji

 

 

  • Like 1
  • Haha 2
  • Confused 1

Share this post


Link to post
Share on other sites

Some additional tips on a CQB AI script I've been working on here and there; you can create invisible sphere objects and hide them, then have the AI "doFire" and "doWatch" those spheres to simulate the AI watching sectors in a building. Additionally, you'll want to utilize playAction more than playMove because playAction is actually global, whereas playMove needs to be remoteExecuted. It'll help make it MP compatible, basically. An example of making AI move forward is:
 

Bob playAction "WalkF"; //Bob will walk forward a bit. Executing it multiple times seems to stack the command to make him play it multiple times.
Bob playActionNow "Stop"; //Will force Bob to stop (Maybe to engage targets) no matter how many other playActions are queued -- clears queue

 

  • Like 1

Share this post


Link to post
Share on other sites

These are things BIS should (have) work(ed) on.

 

That vanilla AI don't use buildings at all is a sign of the PvE apocalypse for BIS as they move toward PvP "emergent gameplay".

 

Do you control unit rotation as well with setDir?

 

I relied on swarming AI to overwhelm the defenders, spawning extra bots just outside the door once players/defenders lose control of the doorway/etc. clumsy compared to this challenge you guys are working on

 

 

  • Like 2

Share this post


Link to post
Share on other sites
6 hours ago, phronk said:

Some additional tips on a CQB AI script I've been working on here and there; you can create invisible sphere objects and hide them, then have the AI "doFire" and "doWatch" those spheres to simulate the AI watching sectors in a building. Additionally, you'll want to utilize playAction more than playMove because playAction is actually global, whereas playMove needs to be remoteExecuted. It'll help make it MP compatible, basically. An example of making AI move forward is:
 


Bob playAction "WalkF"; //Bob will walk forward a bit. Executing it multiple times seems to stack the command to make him play it multiple times.
Bob playActionNow "Stop"; //Will force Bob to stop (Maybe to engage targets) no matter how many other playActions are queued -- clears queue

 

 

Local effect is more performance friendly than Global effect. If possible I would just run the code where group is local and keep the effect local to cut down on network traffic.

Share this post


Link to post
Share on other sites

I wouldn't advise using remoteExec a ton -- it doesn't always call in the correct order or precisely when you need it. Additionally, if you are hosting a mission on a server which uses this script/mod and the animations are executed via switchMove, the animations will only be visible on the server and the clients will see the units doing different animations or a looping animation. I heard addons don't have that issue when run on a server/all clients (Makes animations global?) but I've never created an addon to test it.

Share this post


Link to post
Share on other sites

In my addons, I remoteExec playMoveNow on the PC which own the unit and I remoteExec everywhere the switchMove "" which breaks the current move if needed.

Share this post


Link to post
Share on other sites

Hi all, I’ve been out of town for close to two weeks and ready to pick this back up.

 

Spoiler

If any of you find yourselves in St Louis, Missouri (in USA), do yourself a favor and check out the City Museum.  It’s quite a bit like like waking up in someone else’s dream.  It’s basically a limitless twisted & bizarre maze, with some of the strangest stairwells I ever seen.  (Think many ways up and down, all begging to be climbed... like something MC Escher dreamed up.)  There are multiple aircraft suspended in mid-air that you can climb up to and get inside.  You can get absolutely & totally lost in there (like a hamster in a giant experiment), and it’s very easy to accidentally get separated from your friends.  There are 10 story slides whose entry-points are side-by-side, but which end up on different building floors.  What lies beneath?  Very strange & dark caves, crooked, coiled, and twined, that keep going down and down.  Many passageways are very narrow & small and we found a secret one in particular that was like something out of a nightmare.  In pitch dark, you had to crawl ever downward with arms and shoulders smooshed in and I almost got stuck. (I have wide shoulders but otherwise normal build.)  This nightmare corridor was 20+ meters long, extremely narrow throughout, and it tapered even further at both ends.  (What sadistic artists came up with this stuff?)  The weirdest thing was you don’t even have to sign a waver to get in.  Apparently they built the place in 1997, which explains things somewhat.  Anyhow, it was fun and totally kick-ass, but not necessarily for the faint of heart!

 

OK, what’s next?  I’d like to validate what we've got already (from last update) by sending some actual AI through a working building, before moving on.  Btw - Should have minimal distractions for the next week or so (fingers crossed), so hoping we can make some decent progress!

 

@fn_Quiksilver

That's pretty awesome!  Are you using forced animations, or sending em in the old fashioned way?

 

@johnnyboy (and others who have experimented with playMove, playAction, and related commands):

 

What arcane sorcery are you using to get AI to actually move once inside these buildings?

 

When I place an AI inside the building (either by ordering AI subordinate inside or by buildingPos & setPos), and then call playMove or playAction, he simply does this:

 

 

Then I tried BYOF method (“bring your own floor”), hoping to eventually try invisible portable floors... but this didn’t help:

 

Spoiler

Scan-Buildings-19.png

 

I recall having some success moving AIs around inside buildings a couple of years back.  Seems I must have been setting unit position in a loop, or attaching AI to building (via attachTo) in a loop, etc to move them.  (That would also explain why I recall them “moving through walls”, “flying through the air” a bit, etc.)
 

^ Ran some quick experiments like this today, but the result was somewhat jerky, and not smooth like in your videos johnnyboy.)

 

Anyhow, any hints would be greatly appreciated and will help me validate this building scanner and proceed. :smile_o:

 

On 5/19/2019 at 5:54 AM, fn_Quiksilver said:

Do you control unit rotation as well with setDir?

^ I have this same question.

 

@froggy

Spoiler

Everytime someone nerd-gasms, several AI in vector-node-land forge ahead finding new path segments through new and existing Armaverse buildings.  It’s totally natural and nothing anyone should be ashamed of. :rofl:

 

@everyone

I wonder what’s up with this big "Please go inside immediately, close all doors and windows, and stay tuned for the reveal..." announcement tomorrow?  If it’s aliens then we definitely need to advance this concept.  You know... so the AI aliens can come inside to abduct and/or kill us!

  • Like 2

Share this post


Link to post
Share on other sites

"Animated Pathing", as I like to call it, seems to have issues indoors in certain areas. A hacky workaround is to either setVelocity of unit or unit setPos(unit modelToWorld[0,1,0]).

 

Rotation of units via setDir looks snappy, but alternatively can be done to disable the unit's target/autoTarget AI briefly and make him doWatch/doFire an invisible object placed in the offset of unit you want him to aim at, then re-enable the AI target features. Honestly, there's a lot of creative ways to go about it.

Share this post


Link to post
Share on other sites

 

48 minutes ago, phronk said:

"Animated Pathing", as I like to call it, seems to have issues indoors in certain areas. A hacky workaround is to either setVelocity of unit or unit setPos(unit modelToWorld[0,1,0]).

 

Sounds like you are saying playAction will sometimes propel an AI forward inside a building?  Is this correct?  Because unfortunately every time I try it I get the AI unit running in place briefly and getting absolutely nowhere (like in my video).

 

I am able to propel AIs inside buildings via setPos and/or attachTo... both of which looks crappy.  Based on brief experiments, setVelocity seems to hold more promise than either of those.

 

Anyway I'd rather not reinvent the wheel here.  Really hoping there is a way to make playAction work, as it seems the most elegant.

 

Share this post


Link to post
Share on other sites
7 hours ago, madrussian said:

Hi all, I’ve been out of town for close to two weeks and ready to pick this back up.

Hope you had a great vacation man.  I'm currently visiting Moab Utah (my favorite place). 

 

7 hours ago, madrussian said:

What arcane sorcery are you using to get AI to actually move once inside these buildings?

I'm using playmove primarily, plus some playAction per phronk's advice.  First disableai Anim.  Then playmove tactical forward anim and wait until unit reaches destination, then reenableai anim.  I should release a beta version of my scripts within a week I hope.

7 hours ago, madrussian said:
On 5/19/2019 at 2:54 AM, fn_Quiksilver said:

Do you control unit rotation as well with setDir?

^ I have this same question.

 

I'm using a combination of setFormDir and my own rotate script.  For multiple units, I have them all join grpnull while running through movepoints (then rejoin original group later when done).  When each unit is in his own group, setFormDir is great for "naturally" facing the unit in the direction you want him to go (the ai wants to face this direction).  Before moving a unit to the next movepoint in the movepoint array I stop the unit and run the script below to rotate him smoothly toward next movepoint position. It looks pretty smooth.  This guarantees he is pointing towards next movepoint prior to moving.  setDir is too immediate and gamey, so using this script instead.  I still need to pretty this script up...  After calling this, I waituntil unit getVariable "busy" is false, and unit is now pointing towards next pos.

Spoiler

// turnToPos.sqf
// Example Call:   [dude1, _nextPos] call JBOY_turnToPos;
params["_unit","_targetPos"];

_unit setVariable ["busy", true,true];

_unit setVelocity [0,0,0];
_unit forceSpeed 0;
//_unit setBehaviour "CARELESS";
// *****************************************************************
// Disable AI that interferes with forced animation moves. 
// *****************************************************************

{
	_unit disableAI _x;
} forEach 
[
	//"PATH",
	//"TARGET",// - stop the unit to watch the assigned target / group commander may not assign targets
	"AUTOTARGET",// - prevent the unit from assigning a target independently and watching unknown objects / no automatic target selection
	"MOVE",// - disable the AI's movement / do not move
	"ANIM",// - disable ability of AI to change animation. Available only since ArmA: Cold War Assault (OFP 1.99).
	//"TEAMSWITCH",// - AI disabled because of Team Switch
	//"FSM",// - disable the execution of AI behavior scripts. Available only since Operation Arrowhead v1.60.
	"WEAPONAIM",// - no weapon aiming
	//"AIMINGERROR",// - prevents AI's aiming from being distracted by its shooting, moving, turning, reloading, hit, injury, fatigue, suppression or concealed/lost target Available only since Arma 3 v1.42.
	//"SUPPRESSION",// - prevents AI from being suppressed Available only since Arma 3 v1.42.
	"CHECKVISIBLE"// - disables visibility raycasts Available only since Arma 3 v1.54.
	//"COVER"// - disables usage of cover positions by the AI Available only since Arma 3 v1.56.
	//"AUTOCOMBAT",// - disables autonomous switching to COMBAT when in danger Available only since Arma 3 v1.56.
	//"MINEDETECTION"// - disable Ai mine detection.
];

// *****************************************************************
//
// *****************************************************************
_dirTo = [_unit, _targetPos] call BIS_fnc_dirTo;
_degreesToRotate = _unit getRelDir _targetPos;
_rotateDegrees = 5;
if (_degreesToRotate > 180) then
{
	//_degreesToRotate = (360 - _degreesToRotate ) * -1;
	_rotateDegrees = _rotateDegrees * -1;
};
diag_log ["start turning",_unit];
// *****************************************************************
//
// *****************************************************************
_EH_ID = format ["%1_EH",_unit getVariable "JBOY_memberID"];
[_EH_ID, "onEachFrame", 
{	
	params["_unit","_dirTo", "_rotateDegrees", "_targetPos","_EH_ID" ];
	if ([ position _unit, getDir _unit, 10, _targetPos ] call BIS_fnc_inAngleSector) then
	{
		//_unit enableAI "ANIM";
		
 		{
			_unit enableAI _x;
		} forEach 
		[
	//"PATH",
	//"TARGET",// - stop the unit to watch the assigned target / group commander may not assign targets
	"AUTOTARGET",// - prevent the unit from assigning a target independently and watching unknown objects / no automatic target selection
	"MOVE",// - disable the AI's movement / do not move
	"ANIM",// - disable ability of AI to change animation. Available only since ArmA: Cold War Assault (OFP 1.99).
	//"TEAMSWITCH",// - AI disabled because of Team Switch
	//"FSM",// - disable the execution of AI behavior scripts. Available only since Operation Arrowhead v1.60.
	"WEAPONAIM",// - no weapon aiming
	//"AIMINGERROR",// - prevents AI's aiming from being distracted by its shooting, moving, turning, reloading, hit, injury, fatigue, suppression or concealed/lost target Available only since Arma 3 v1.42.
	//"SUPPRESSION",// - prevents AI from being suppressed Available only since Arma 3 v1.42.
	"CHECKVISIBLE"// - disables visibility raycasts Available only since Arma 3 v1.54.
	//"COVER",// - disables usage of cover positions by the AI Available only since Arma 3 v1.56.
	//"AUTOCOMBAT",// - disables autonomous switching to COMBAT when in danger Available only since Arma 3 v1.56.
	//"MINEDETECTION"// - disable Ai mine detection.
		];
 		
		_unit setFormDir getDir _unit;
		_unit setVariable ["busy", false,true];
diag_log ["end turning",_unit];
//if (_unit == dude1) then { hintc str format["_unit=%1, EH=%2",_unit,_EH_ID];};
		[_EH_ID, "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
	} else
	{
		_unit setdir ((getdir _unit) + _rotateDegrees);
	};
}, [_unit,_dirTo, _rotateDegrees, _targetPos, _EH_ID]] call BIS_fnc_addStackedEventHandler;

 

 

I haven't given status in awhile but have put alot of hours in struggling with getting a stack of 4 units to move through a building.  Its been super hard...tons of experimentation...but I think I finally will have something to show in the next few days.  It won't be perfect, but it will be interesting.  A single unit works really well as I have already demonstrated.  Stay tuned!  And thanks for all the hard work @madrussian!  You are a good man.

 

Regarding your generated positions, for my scripts to work, we will need to calculate a path first (series of positions for a particular buiiding), then I will read that path array and and transform it into a format my script needs.  We can work out the details once i release my script.  But one thing I need for sure is stair positions flagged as stairs somehow.  That's critical as I need AI to move differently through stairs than non-stairs (to keep them from getting stuck or clipping).

  • Like 3

Share this post


Link to post
Share on other sites
6 hours ago, madrussian said:
  Reveal hidden contents

If any of you find yourselves in St Louis, Missouri (in USA), do yourself a favor and check out the City Museum.  It’s quite a bit like like waking up in someone else’s dream.  It’s basically a limitless twisted & bizarre maze, with some of the strangest stairwells I ever seen.  (Think many ways up and down, all begging to be climbed... like something MC Escher dreamed up.)  There are multiple aircraft suspended in mid-air that you can climb up to and get inside.  You can get absolutely & totally lost in there (like a hamster in a giant experiment), and it’s very easy to accidentally get separated from your friends.  There are 10 story slides whose entry-points are side-by-side, but which end up on different building floors.  What lies beneath?  Very strange & dark caves, crooked, coiled, and twined, that keep going down and down.  Many passageways are very narrow & small and we found a secret one in particular that was like something out of a nightmare.  In pitch dark, you had to crawl ever downward with arms and shoulders smooshed in and I almost got stuck. (I have wide shoulders but otherwise normal build.)  This nightmare corridor was 20+ meters long, extremely narrow throughout, and it tapered even further at both ends.  (What sadistic artists came up with this stuff?)  The weirdest thing was you don’t even have to sign a waver to get in.  Apparently they built the place in 1997, which explains things somewhat.  Anyhow, it was fun and totally kick-ass, but not necessarily for the faint of heart!

 

 

 

 

 

  Reveal hidden contents

Everytime someone nerd-gasms, several AI in vector-node-land forge ahead finding new path segments through new and existing Armaverse buildings.  It’s totally natural and nothing anyone should be ashamed of. :rofl:

 

@everyone

I wonder what’s up with this big "Please go inside immediately, close all doors and windows, and stay tuned for the reveal..." announcement tomorrow?  If it’s aliens then we definitely need to advance this concept.  You know... so the AI aliens can come inside to abduct and/or kill us!

 

31nubi.jpgvia Imgflip Meme Generator

 

 

@JohnnyB: Enjoy Moab -Biking or Hiking?

  • Haha 2
  • Confused 1

Share this post


Link to post
Share on other sites

@johnnyboy

Awesome and thanks, all of that makes really good sense.

 

1 hour ago, johnnyboy said:

I'm using playmove primarily, plus some playAction per phronk's advice.  First disableai Anim.  Then playmove tactical forward anim and wait until unit reaches destination, then reenableai anim.

Wow, disabling "ANIM" really got my AI moving.  How delightfully counter-intuitive!  You are quite a master at this.

 

Mostly, I just wanted to make sure I'm giving the AI enough clearance by trying to send them through to see if they stick (and if so how badly).  To see if I need to make their path detection wider, etc.  But maybe I'll just skip that part for now and go full bore ahead on point detection/processing.  We can always tweak stuff like that later.  (Curious though, overall how much sticking are you seeing in your experiments?)

 

1 hour ago, johnnyboy said:

I haven't given status in awhile but have put alot of hours in struggling with getting a stack of 4 units to move through a building.  Its been super hard...tons of experimentation...but I think I finally will have something to show in the next few days.  It won't be perfect, but it will be interesting.  A single unit works really well as I have already demonstrated.  Stay tuned!  And thanks for all the hard work @madrussian!  You are a good man.

 

I can only imagine, 4 units at once sounds quite intricate (and difficult) and I can't wait to see it!  And you are quite welcome. :wine:

 

1 hour ago, johnnyboy said:

Regarding your generated positions, for my scripts to work, we will need to calculate a path first (series of positions for a particular buiiding), then I will read that path array and and transform it into a format my script needs.  We can work out the details once i release my script.  But one thing I need for sure is stair positions flagged as stairs somehow.  That's critical as I need AI to move differently through stairs than non-stairs (to keep them from getting stuck or clipping).

Sounds good.  I can definitely break it down by type of point: stairs top/bottom, window points, actual door standoff points, etc.  <- These are "hard" points are won't ever change.  Having a 100% predefined path my be a bit of a challenge though, due to the way I have to detect entry points, for one thing.

 

Consider the base of this castle:  (Please ignore the doubled stairs for now, which I need to fix...)

Scan-Buildings-20.png

 

This building is designed to be buried to one degree or another, and this will vary from instance to instance based on the shape of the terrain and how the map creators oriented & buried it.  My code will currently select entry points all along the base (not pictured at the moment), but sometimes accordingly some of these entry points will be buried.  So it seems we'll have to determine some points on-the-fly.  But I'll provide quick/simple functions for that.  (Also something quick to consider - So far in my experiments SSSP is super-fast with these small numbers of points.)  Anyhow, just something to have in the back of our minds.  We'll make it all as pre-defined as humanly possible.

 

1 hour ago, johnnyboy said:

I'm currently visiting Moab Utah (my favorite place).

I'm jealous, might just head out west this summer.  Have a great time!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×