Jump to content
Greenfist

[SCRIPT] AI Detection test tool

Recommended Posts

Here's a small script I initially made almost a year ago for a discussion regarding AI's detection skills and their alleged "x-ray vision".
The topic became current again recently along with the release of the new jungly Tanoa map. And the script was even indirectly featured in the SITREP yesterday when BI highlighted a user made video utilising it. (The tweet with the huge red arrow. :D)
 
So I decided to update it a bit and start an actual thread. Maybe it'll help to shed some light on AI's sense mechanics.
 
How does it work?
Extract the mission to your editor made missions folder, load it, and click preview.
There's you and an enemy AI unit on the map. You try to get his attention while observing a couple of visual indicators and vital numbers about his spotting and target tracking.
Can he see through bushes? Can you hide in tall grass? Can you flank and surprise him? How does the gear and AI skills affect all this? etc.
 
Features:
Some technical data in the corner of the screen. You can place down as many units as you want, all of them will have the detection symbols, but only one's numbers a shown.
The enemy is marked with a colored circle which tells his state:

â—‹ White =           AI knows nothing about the target.
â— Blue =             AI has seen or heard the target, but doesn't know if it's hostile or friendly.
â— Yellow =          AI knows the target's side, but haven't seen it. This happens when a teammate has reported the target, or it has shot at the enemy.
â— Green =         The target has been spotted but not currently visible.
â— Red =             The AI currently sees or hears the target. I.e. knows its exact position.

 
Big arrow floating around you indicating where the AI thinks you are. (in case he doesn't have a LOS to you.)
Zeus module for controlling the units.
Menu actions:

Face target: Turns enemy units towards the target.
Reset units: all units forget about eachother and turn away from their enemies.
Camera: Starts the splendid cam right next to enemy's eyes.

Enemy/target gear.
Move AI: fly the AI guy around like a kite. Checking how they see through objects - is that treetop see-through?
Set enemy stance and behaviour.

+ a few more handy actions

 
To move this script to another map: (The default is Tanoa)
Copy the init.sqf and functions.sqf to your mission folder.
(Note: place and configure a zeus module named 'zeus1' to avoid an error message at mission start. Although the script will create the module anyway.)
 
The monitored AI unit should be named 'enemy1'. If it doesn't exist, the script will select the closest enemy or spawn a generic one in front of you.
The target should be named 'target1'. If it doesn't exist, you'll be the target.
    
Downloads: On Tanoa or On Altis (Dropbox)
 
Latest version: v1.20 July 20 2016
 - Replaced the enemy camera with the splendid cam, which opens right next to the enemy

 - Added 'Freeze units' action
 - You can teamswitch to the enemy. A good way to check if what you see matches the AI vision.

 - some minor tweaks
 
A short vid of it in action: (older v1.09)


Note: this isn't any highly polished framework, just small toy/tool snippet for messing around with the AI in the editor.
I don't think I'll develop this very actively but if you have any good suggestions or bug reports, please share them, and I'll see what I can do.
  • Like 19

Share this post


Link to post
Share on other sites

Super cool!  

 

Have you noticed any differences after today's detection changes? Ya know, in the two hours it's been live? :P

Oh, I missed those changes completely. Thanks for the heads up!

 

One interesting fact about flashlights, by the way. The AI doesn't react if you shine a light at him, but if you light up your teammate, he will have a bad day. :icon_twisted:

Share this post


Link to post
Share on other sites

Very nice stuff!

 

Any plans for more individual AI stats like: shots taken / shots hit, real accuracy %, and so on? Keep them great features coming, you're onto something :)

 

Many of us love debugging AI and seeing them react in different ways all the time. Part of the magic of Arma, IMO, is its most dynamic and advance AI in games industry. 

Share this post


Link to post
Share on other sites

Very nice stuff!

 

Any plans for more individual AI stats like: shots taken / shots hit, real accuracy %, and so on? Keep them great features coming, you're onto something :)

 

Many of us love debugging AI and seeing them react in different ways all the time. Part of the magic of Arma, IMO, is its most dynamic and advance AI in games industry. 

 

Frankly, I don't have any plans at the moment. I thought of this as just a one-off snippet. :)

But I'm open for suggestions of course.

 

Although accuracy doesn't really fall into the category of AI detection, I'll see if I can add it without making the UI too confusing.

Share this post


Link to post
Share on other sites

 And the script was even indirectly featured in the SITREP yesterday when BI highlighted a user made video utilising it. (The tweet with the huge red arrow. :D)

 

I missed that tweet... that was my vid ;)

 

thanks again for the tool Greenfist... extremely useful!

Share this post


Link to post
Share on other sites

I missed that tweet... that was my vid ;)

 

thanks again for the tool Greenfist... extremely useful!

Should have known it was you. :D Good job, mate!

 

The script/mission/tool/toy updated:

v1.11

Most actions moved from the scroll menu to a GUI menu.

Added settings for spotDistance, spotTime, and general skills to be adjusted on the fly.

Added an action to change enemy gear mid-mission.

Added actions for setting behaviour and stance. (you could set these in Zeus too, but the menu is quicker IMO)

Added info for target's relative direction to enemy's eyes. (their fov is 120°, by the way)

Added Altis version. (identical to Tanoa)

 

4TfVnrp.jpg

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

I added this to your textbox:

 

getSuppression enemy1

 

And put the variable it into the box. I felt like it fits. This is the new chunk of code:

	_text = format["<t size='0.9'>
			%9Distance:%11 %10%1m%11<br/>
			%9Relative dir:%11 %10%12%11<br/>
			%9knowsAbout:%11 %10%2/4%11<br/>
			%9Pos. error coef:%11 %10%3%11<br/>
			%9spotDistance:%11 %10%4%11<br/>
			%9spotTime:%11 %10%5%11<br/>
			%9Behaviour:%11 %10%7%11<br/>
			%9Visibility:%11 %10%8%11<br/>
			%9Suppression:%11 %10%13%11<br/>",
				_dist,
				_ka,
				if (_poserror>999) then {"-"} else {_poserror},
				spotDistance,
				spotTime,
				_groupKnows, //%9Group knows:%11 %10%6%11<br/>
				behaviour enemy1,
				_visibility,
				"<t align='left'>", //9
				"<t align='right'>", //10
				"</t>", //11
				abs round _dirDiff, //12
				getSuppression enemy1 //13
			];

Share this post


Link to post
Share on other sites

 

I added this to your textbox:

 

getSuppression enemy1

That raises a question - does suppression affect their detection capabilities?

On the other hand, would it even matter? Since they most likely already know of the most important enemy at that point, i.e. the one who's shooting at them.

Share this post


Link to post
Share on other sites

That raises a question - does suppression affect their detection capabilities?

On the other hand, would it even matter? Since they most likely already know of the most important enemy at that point, i.e. the one who's shooting at them.

I think of it like this: when I can think of it, someone else is thinking of it. And if I can find it useful,someone else probably will too. Anyway,this was not a FR, i just wanted to share and add again that I love that script.

The "enemy camera" shows a rectangle, what does that rectangle stand for? And how would I make the ai "chase" me? It seems that it is not allowed to move at all, only shoot. Correct me if I'm wrong. :)

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

I think of it like this: when I can think of it, someone else is thinking of it. And if I can find it useful,someone else probably will too. Anyway,this was not a FR, i just wanted to share and add again that I love that script.

The "enemy camera" shows a rectangle, what does that rectangle stand for? And how would I make the ai "chase" me? It seems that it is not allowed to move at all, only shoot. Correct me if I'm wrong. :)

Thanks!

The background in the enemy cam was originally meant to make the target stand out more so you could see which parts are exposed and the color tells if it's actually visible, but now with the zoomed in view it's pretty clear anyway. 

 

You could place some waypoints for the AI in the editor or use Zeus. Maybe seek'n'destroy WP?

  • Like 1

Share this post


Link to post
Share on other sites

The background in the enemy cam was originally meant to make the target stand out more so you could see which parts are exposed and the color tells if it's actually visible, but now with the zoomed in view it's pretty clear anyway. 

 

You could place some waypoints for the AI in the editor or use Zeus. Maybe seek'n'destroy WP?

Thanks man, I will try a WP. I would like to be "inside AI's head" while it's searching for me.

 

This script is soooo useful. No more guesswork if AI sees you or not etc. Can't say it enough. Thank you very much! :)

Share this post


Link to post
Share on other sites

Thanks man, I will try a WP. I would like to be "inside AI's head" while it's searching for me.

 

This script is soooo useful. No more guesswork if AI sees you or not etc. Can't say it enough. Thank you very much! :)

You're welcome. I'm glad someone finds a good use for it. :)

 

And I think you can get in their head with the spectator: press esc -> spectate.

Share this post


Link to post
Share on other sites

Helped me understand why we were getting shot through certain buildings on Helvantis terrain. Very handy tool!

  • Like 1

Share this post


Link to post
Share on other sites

Extremely late reply, idk how i missed this i did have it bookmarked so apparently didn't comment on it back in the day, anyways

been messing with this, and only thing i can think of that would make this tool more complete is adding an audio codef where instead of spotting or visual alone,

the AI can detect you based on your sound too.

 

Been finding out that certain vegetation prevents the AI from seeing you at all, also smoke blocks their view, this is pretty cool considering how far we've come in the series!

Share this post


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

Extremely late reply, idk how i missed this i did have it bookmarked so apparently didn't comment on it back in the day, anyways

been messing with this, and only thing i can think of that would make this tool more complete is adding an audio codef where instead of spotting or visual alone,

the AI can detect you based on your sound too.

 

Been finding out that certain vegetation prevents the AI from seeing you at all, also smoke blocks their view, this is pretty cool considering how far we've come in the series!

By adding audio you mean adding an option to make AI blind to test the aural aspect separately?

 

I'm not sure how functional this script is today, by the way. Apparently it works to some extent but if I recall correctly, at least the target's side indication was somehow messed up a few years back.

Share this post


Link to post
Share on other sites

I was messing with it earlier and seems to work fine.

Adding audio to whats already there, the idea came from what Bunc is doing here https://forums.bohemia.net/forums/topic/223202-release-dynamiccamo-script/

he has a camcoef and audiblecoef for AI detection where camou is based on what the player is wearing, position, weather, even audio.

 

  • Like 1

Share this post


Link to post
Share on other sites

I'm planning to try this script as a fuller test  for my DynamicCamo and Gunter is right, ideally I would want to have it also report on audible. I haven't had a chance to do this yet. I need to see what permissions the author has given re use to see if I can simply add audio into his existing script as an enhancement or if I need to run something distinct alongside. 

Share this post


Link to post
Share on other sites
19 hours ago, The Real Bunc said:

I'm planning to try this script as a fuller test  for my DynamicCamo and Gunter is right, ideally I would want to have it also report on audible. I haven't had a chance to do this yet. I need to see what permissions the author has given re use to see if I can simply add audio into his existing script as an enhancement or if I need to run something distinct alongside. 

I'm not really sure I follow. Report on audible how? Like indicate if the target is detected by sound or what is its noise level? I don't think either of them are directly available with scripting, right? One could guess and simulate how the engine does it but wouldn't be accurate unless we know exactly how the game handles it.

Adding adjustable setUnitTrait values to the script is very possible though. I might do that.

 

I haven't specified any license on this script but you're allowed to freely modify, incorporate in your mod and redistribute it non-commercially as long as you mention me as the original author.

Share this post


Link to post
Share on other sites

Thanks for the reply. I should have been a bit more precise, it would probably be as simple as having your test simply incorporate not only the detectors "knows about" but also the detectees camCoef and audibCoef calculated by my script. That way I can both see the changing values of CamCoef and audibleCoef that my DynamicCamo script is producing and see how and when knows about changes for the detecting ai. This will assist me in tuning my script. 

Many thanks for the info re usage Greenfist. I'll give credit and a link back of course.

  • Like 1

Share this post


Link to post
Share on other sites

I think I will add the audible and camo coefs as adjustable values. And add them in a way that the script won't forcibly change them without user's input, so you can also use it to debug your own script.

 

I don't know when exactly I'll have the time for that though. You might want to do it yourself in the meantime.

  • Like 3

Share this post


Link to post
Share on other sites

I find this script as a very useful one. Thank you for sharing this experience! I have read everything and I will definitely do some testing after all. This current link with the script was given to me as an answer to a thread of mine, another topic I have created. And I hope it could help me to find a solution to my issue, so I would like to add a LINK where you can read more about what I need to achieve. It would be like "sight cone" or a visual leveled indicator of increasing danger while the player is being spotted by enemy AIs. You can read more in my post and I will be very grateful and thankful for any kind of help, responses, support and assistance provided by you. Thank you in advance! Cheers! 🙂

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

×