Jump to content
Sign in to follow this  
Rydygier

ARTEMIS - Hunting Instinct AI mod

Recommended Posts

ARTEMIS - Hunting Instinct

 

1. Description
ARTEMIS mod is an AI algorithm that simulates animal-like hunting behaviour of controlled units (Hunters) against chosen units (Prey). It's meant as a tool for mission makers, while easiness of Artemis setup makes practically everyone familiarized with editor's basics potential mission makers able to set hunter-prey missions fast and smooth.
This code does some heavy calculations (mainly numerous LOS checks every second). Should be more efficient than
1.0
, still too many hunters at once may cause hunters' reactions delays/sluggishness. How many is OK? Not sure & depends. Let's say "one or few to several". Number of prey units isn't as crucial.
ARTEMIS is designated as opponent for player, but should work well also against AI.
Hunter has to his disposal two customizable senses: sight and smell.
Sight is specified by two parameters: light sensitivity and movement sensitivity. It decides, how easily Hunter will spot the Prey according on daytime, weather, size, speed, background (sky or not, surrounding terrain) and knowledge factor (memory).
Smell helps to follow not visible Prey by its trail. Each Prey will leave "footprints", that Hunter can scent. Old footprints will be erased, also rain gives small chance for removing some parts of the trail. Smell (range) is strongly affected by wind (direction and strength).
If there is no Prey nor trail known, Hunter will loiter randomly starting from last known position of last prey.
If Hunter see the Prey, his behaviour depends on situation. His goal is surprise attack, prefferably from behind. Will charge anyway, if close, but otherwise will approach, fast, or stealty, only, when flanking the Prey (out of Prey's FOV). If catched in the FOV depends on situation can hide low or run out of LOS, then try to outflank keeping out of sight.
Is most dangerous at night, in the dense forest when visiblity is poor.
Hunter uses only melee attacks.
 
2. Usage
ARTEMIS is designed for single player. Behaviour in MP environment unknown (code will/should be run server side only, hunters should be server side too). 

[indent][b]Addon version[/b][/indent]


- play with addon;
- place on the map Artemis (Hunter) module;
- optionally customize module settings;
- synchronize with it all units, that should act like animal hunters/predators;
- place on the map Artemis (Prey) module;
- optionally customize module settings;
- synchronize with it all units, that should be hunted down by hunters.

Alternatively may be used method of pointing hunters and prey for script version. Such way defined arrays of hunters and prey will overwrite lists based on synchronized units. 



[indent][b]Script version[/b][/indent]



- paste content of the Script Version folder into mission folder; 
- initialize in init.sqf or init field in editor via: 



[indent][i]RYD_ART_Hunters = [(here list of hunters)];
RYD_ART_Prey = [(here list of prey units)];

nul = [] execVM "Artemis\ARTInit.sqf";[/i][/indent]






[indent][b]Optional customization[/b][/indent]



Customization is possible via defining listed global variables (as examples used default values):

[b]RYD_ART_Hunters = [];[/b] (Array holding hunter units. Changes on the fly will be effective. Note: hunters excluded that way wil proceed with their last routine)
[b]RYD_ART_Prey = [player];[/b] (Array holding prey units. Changes on the fly will be effective.)
[b]RYD_ART_Pause = false;[/b] (pausing switch. As long is true - hunters will immediately stop all Artemis activity, prey will stop to leave the trail)
[b]RYD_ART_MainSwitch = true;[/b] (when set to false, whole code exits permanently, controled units immediately stop all activity)
[b][i]hunter_Unit[/i] setVariable ["Ryd_ART_Excluded",true];[/b] - setting this variable for given [i]hunter unit[/i] will temporarily exclude it from Artemis control. Unit will stop current activity immediately.

Below settings for script version only. For addon version use module settings instead. 

[b]RYD_ART_Smell = 3;[/b] (positive number - smell sensitivity of the hunters. Used for tracking prey)
[b]RYD_ART_Sight = [1.5,1.5];[/b] (array of positive numbers. Eyesight sensitivity for the hunters (light factor, movement factor). Used for spotting prey)
[b]RYD_ART_Loiter = 200;[/b] (non-negative number. How far around current position hunter should wander randomly when lost the trail. Unlimited if 0)
[b]RYD_ART_Strike = 1;[/b] (number. Multiplier of damage dealt by Hunter each basic strike)
[b]RYD_ART_Placement = [];[/b] (Min/max random placement radius for each hunter from random hunted. Leave empty array to disable random placement)
[b]RYD_ART_TrailMaxAge = 3600;[/b] (maximal lifetime of each prey's footstep in seconds)
[b]RYD_ART_Dbg = false;[/b] (boolean. Debug mode switch. In debug mode postions of all hunters and each prey will be marked on the map. For the hunters is also shown current routine and max knowledge about it amongst all prey units))



[indent][b]Other notes[/b][/indent]



- for striking sounds and animations hunter units must be used [b]"players only"[/b] raptors from Jurrasic Arma - Raptor Pack by McRuppert ([url="http://www.armaholic.com/page.php?id=27163"]http://www.armaholic.com/page.php?id=27163[/url]);
- if in addition to above raptors should use from time to time jump atack, somewhere on the map must be present at mission init one raptor [b]"AI only"[/b] to register jump attack function;
- included demo mission is for addon version and requires Jurrasic Arma - Raptor Pack addon by McRuppert & Bad Benson. In the init.sqf debug mode may be enabled to follow hunters actions on the map. 
 
3. Changelog
 
v1.22
  • Reorganized addon version: modules configured to A3 standard;
  • Most settings along with additional ways of synchronization for addon version moved into module options.
v1.21
  • Added new routine for fleeing when hit (reaction on accurate fire);
v1.2
  • fixed loitering routine;
  • a hunter with pending waypoint will proceed towards it instead of idle loitering, when no prey/trail is known;
  • added new ways of advanced control (pausing/exiting whole script, editing hunters and prey lists on the fly, more. For details see: Usage section);
  • various code fixes and tweaks.
v1.11
  • code fixes;
  • improved hunter's behaviour (reduced risk of "standing on plain sight" situation).
v1.1
  • new form - addon (editor modules);
  • now many predators may hunt down many prey units;
  • limited to SQF version;
  • new way of customization;
  • compatibility with Jurrasic Arma's raptors attacks;
  • deep code modernization for, hopefully, better performance and efficiency.
 
4. Known issues and notes
- if hunter is in "hidden low" mode under FOV of completely static AI unit, logically attack may never come, because hunter will patiently wait, till he can move out of prey's FOV. To avoid such stalemates make prey moving;
- if used anything else than McRuppert's raptors, attacks have no sounds nor animations;
- seems, raptor units from Raptor Pack with assigned waypoints tend to stuck from time to time, vanilla A3 units not affected;
- this version is only slightly tested. I'm always grateful for any feedback and bug reports.
 
5. Recommendations
 
by McRuppert & Bad Benson (a must have for Artemis users, fantastic mod introducing predator units allowing Artemis to show its full potential.
 
by Malakdecaen (kakarot) & Yourry - at the moment it is still Alpha, but already it's very Jurrasic. Yep, another good looking raptor inside.
 
by me (a humble SP mission combining few excellent mods and Artemis into immersive experience)
 

Enjoy :)

 

Mod is released under APL-SA license. I'll be grateful for notification about each such usage.

Share this post


Link to post
Share on other sites

New mod 1.1 available at withSIX. Download now by clicking:

@ryd_artemis.png

@Rydygier;

Soon you will be able to manage the promo pages of your content on our web platform and publish new content yourself.

To do so, please hit 'this is me' button on the page while logged in and you will get connected to your work.

For now you can send new content or releases our way through withsix.wetransfer.com or add your notification at getsatisfaction

Share this post


Link to post
Share on other sites

Thanks for informing us of the release :cool:

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Foxhound

Share this post


Link to post
Share on other sites

Very interesting ideas. Look forward to giving this a try this evening

Share this post


Link to post
Share on other sites

Thanks. Yes, this one squashed. Rather harmless. Found also the second, more serious, flooding RPT, but rarely occuring (thus not spotted earlier). Fixed too. Got one more idea to improve hunter's behaviour (avoiding "hiding" on plain sight, when hunter thinks, he's hidden due to low knowledge factor, while I can see him with no problems - happens especially in the fog, that reduces knowledge more than real sight range), when implemented, new version will be released. :)

---------- Post added at 11:28 ---------- Previous post was at 10:36 ----------

1.11 released. Changelog:

- code fixes;

- improved hunter's behaviour (reduced risk of "standing on plain sight" situation).

BTW, about demo mission, It's amazing, how surrealistic atmosphere one can achieve by setting certain weather and daytime. Such "unhealthy" climate reminds me one of these movies about Dracula (Coppola's version, I think).

(Note: 1.11 reuploaded 11:47)

Edited by Rydygier

Share this post


Link to post
Share on other sites

Thanks for informing us of the updated release :cool:

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

hah, sounds really cool for those dinosaur mods, or even the eods dog mods ?

SJ

Share this post


Link to post
Share on other sites

This piece of code is a revelation and i thank you for polishing it up and releasing it for Arma 3.

Share this post


Link to post
Share on other sites

Thanks guys, great to hear, it works. :)

Just now spotted, so Reign of Jurassic is also released, so I plan to see, what can be done to adjust Artemis also for this one source of deadly raptors. :)

EDIT: Seems, with RoJ I better wait for something less Alpha (they say, update is coming soon).

Edited by Rydygier

Share this post


Link to post
Share on other sites

So, instead of testing, tried to play and beat them (after all I know, how Artemis works, I designed it, so I have advantage, isn't?). And...

Bloody hell, they kick my ** badly.
Edited by Rydygier

Share this post


Link to post
Share on other sites

Rydygier, i have been using this mod with the raptors since they were released.. and i have only won 1-2 battles with a raptor. out of many runs of a mission i made..... most of the time they come out of no where , from behind and i dont even know it... other times i see them and just cant hit their hit box... other times i over react and shot around them... I mostly scream like a girl and laugh immediately after, its great fun... Thanks for your work. Using this with @loSounds2 was even better.... just soo funny and scary at the same time!!!!!!

Share this post


Link to post
Share on other sites

:D Great to hear. Before raptors this script was mostly "academic" project, and only now idea behind it may be tested. And seems, it works!

Share this post


Link to post
Share on other sites

Just wondering if this mod could be used somehow for guerilla fighters chaising down troops after beeing attacked by an IED? Or even beeing implemented as some kind of "watchguard" in an MP mission, like "civ casualties limit by player x reached, hunt him and kill him"? Is it possible to sync those modules to AI spawned during a mission or even to players/JIP?

Share this post


Link to post
Share on other sites

Spawning&syncing modules during a mission should be possible, but recommended is in any case to do it only once. But note, it's animal-like AI. Applying it to humans is possible, but:

1) They'll act like smart animals lead by instincts, not like thinking humans, while humans are too slow to do it effectively;

2) Whole behavior is based on assumption, hunter will attack hunted only in melee. Any kind of distant attack available for the hunter makes whole behavior irrational.

So I would not recommend using Artemis in such scenarios. Also because of:

3) Its pretty heavy scripting due to numerous, constant LOS checks if prey is tracked, while for described use is enough much simplier solutions like looped _unit doMove (position player).

Share this post


Link to post
Share on other sites

Had a chance to check this out yesterday with McRuppert's Raptors - very fun!!

Similar question to audiocustoms - I am trying to figure out if it's possible to spawn in Raptors (using DAC) and either a) sync them to the Hunter module using synchronizedObjectsAdd or b) in the script version adding spawned Raptors to the RYD_ART_Hunters array. I'd like to avoid having to place editor Raptors and DAC includes a feature to run code on every unit spawned by DAC.

I tried with the mod version - added an AI raptor not synced, added a player-only raptor synced, turned debug on. The single raptor marker appeared but the raptors spawned in via DAC did not have a debug marker... and it was hard to tell but I don't think the Artemis AI was applied to them.

Hopefully what I'm asking makes sense.. my coding skills are very minimal :p

Share this post


Link to post
Share on other sites

Current version lacks some flexibility (like adding hunters after code run), I used to provide. But as I just today found, so loitering mode is not working, as supposed, I should soon release new version anyway, with things like you asked too and more (if possible, eg pausing the script or exiting on demand). For the moment hunters array is read only once, about second after spawning the hunters module, similar for preys, so if one want to spawn all this in the middle of the game, for 1.11 has to spawn all elements at once (hunters module, hunters (syncing, prey module, preys (syncing))) and it's possible only once, because code will not exit unless all hunters are removed or dead.

Share this post


Link to post
Share on other sites

^ ok thanks for your response I'll wait for the next version.... being able to add spawned Hunters would be awesome!

Another question - DAC assigns waypoints to each group (I am spawning in groups with only 1 unit) - would that interfere at all with the AI routines from Artemis? Or would the hunter follow the waypoint until contact with an enemy or other event at which time Artemis AI kicks in?

Share this post


Link to post
Share on other sites

Artemis currently pays no attention on unit's waypoints. And gives some loitering routine, when no prey is spot/trail scent. That will interfere with waypoints. However, should be possible for next version to change that, so Artemis will wait with loitering until hunter has no waypoints to follow (so as long hunter has any not completed waypoint, will not get any idle loiter order, but will temporarily break following waypoint as soon spot the prey or scent the trail until in idle mode again).

Just in case: each hunter should have separate group to avoid interferences with internal group orders.

Share this post


Link to post
Share on other sites
Just in case: each hunter should have separate group to avoid interferences with internal group orders.

Yes I figured that out quickly! Besides, in groups, the raptors will shout orders and call out contacts.. in english :p

Share this post


Link to post
Share on other sites

1.2 released. Changelog:

- Fixed loitering routine;

- a hunter with pending waypoint will proceed towards it instead of idle loitering, when no prey/trail is known;

- added new ways of advanced control (pausing/exiting whole script, editing hunters and prey lists on the fly, more. For details see: Usage section);

- various code fixes and tweaks.

Note, for raptors of Raptor Pack with assigned waypoints saw some permanent stucking in certain situations. Reason unknown. Maybe have something common with pathfinding along the roads, but that's only guess. In general: assigning raptors under Artemis control not recommended as long it has waypoint to go. Common units seems unaffected by this, thus IMO reason lies on the raptors' side.

Due to numerous tweaks, new bugs may be generated, so I'll be even more grateful for any bug reports.

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
Sign in to follow this  

×