Jump to content
Sign in to follow this  
PiZZADOX

Headless AI Module

Recommended Posts

https://www.youtube.com/watch?v=9EBMmkarSqw

 

What is the Headless Module?

 

This module provides functionality for the local spawning of AI on the headless client which allows for greater AI capabilities in numbers, faster reaction times, and the ability for custom local scripts. This method does not use the setowner command method of the ACEX headless module which works by transferring units on a loop to the headless client, which can often result in a loss of unit information, the destruction of groups, and a performance decrease on the server if new AI have been spawned in. With local AI spawning on the headless client there is no need for variable broadcasting or setowner commands running on a loop.

 

The performance and space that exists when the AI are fully local to the HC is quite large, which allows for some more intensive AI scripts to be run. I have added some custom functionality to the AI such as reinforcement handling, fired eventhandlers for weapon sound detection, and bunker behavior for the AI enabling them to be much more effective in suppressing at range.

 

https://github.com/PiZZAD0X/Olsen-Framework-Arma-3/wiki

 

Expect updates to the behavior functions including new behavior modes/ features, most notably specific vehicle behaviors and static HMG improvements. 

Share this post


Link to post

Thanks for putting this together Pizzadox. The examples and github makes it super easy to understand how to set it up. So is there ever a reason to use the old acex_headless_module over your HeadlessClient_f implementation (like small missions, static defenses, or vehicles)? Also, love the added behaviors idea like patrolling and reinforcing each other and how you implemented them for easy mission making. If you give a unit multiple guard movements, will that combine into one overall patrol area for them? With the behavior changes, it basically means I should always use your headless client whenever AI are present.

 

It would also be nice if we could test our missions with headless client on the server, because right now I have to kind of imagine what the AI will do.

Edited by Leonidas

Share this post


Link to post

All of the AI scripts and FSMs will run in a singleplayer test, they will check if you are running in a singleplayer test and spawn appropriately, they will just be slower than running on a dedicated server with headless client. You can test the mission with a headless client on SRV3, which I strongly recommend for the sake of gameplay and performance. You might be able to cross an open field in singleplayer without effective contact but be mowed down on the same mission in the same situation on a dedicated with headless.

 

For now I would recommend that you use the NOAI variable on vehicles and static HMG. All of the AI changes I have made so far have been aimed at dismounted infantry movements/behaviors. I would avoid using ACEX headless module since it has a bad habit of trying to transfer AI even when spawned on the HC locally (owner/setowner commands are simply inconsistent commands that often bug out in the postinit phase) Having to go through and blacklist headless for each of the spawned units seems tedious and not worth the cost - vehicle and static HMG performance whether on the server or on headless is poor anyways, we need custom AI scripts to improve performance beyond BI behavior.

 

I have not implemented combined patrol areas, but I could look at making an area marker based patrol behavior to compliment the basic patrols. For specific areas you want a unit to patrol, place a marker down and set a unit variable to AreaPatrol,"markername" or something like that, akin to UPS from ArmA 2.

Share this post


Link to post

I had something weird where it didn't seem to be copying even though I had the function compiled but I suppose the easiest way to see if it works is trying to paste the export unit data after executing ["Groups",1] call HC_fnc_ExportSQF;. If you have a problem with the recompile function thing, just keep enabling it, saving and trying, disabling, saving and trying, until it works.

 

Also, if server 3 is the only place to test this. I guess I'll just have to guesstimate for the WW2 units. And if someone reads this, please reset Server 3. I froze it with a no player mission.

Edited by Leonidas

Share this post


Link to post

https://www.youtube.com/watch?v=9EBMmkarSqw

 

What is the Headless Module?

 

This module provides functionality for the local spawning of AI on the headless client which allows for greater AI capabilities in numbers, faster reaction times, and the ability for custom local scripts. This method does not use the setowner command method of the ACEX headless module which works by transferring units on a loop to the headless client, which can often result in a loss of unit information, the destruction of groups, and a performance decrease on the server if new AI have been spawned in. With local AI spawning on the headless client there is no need for variable broadcasting or setowner commands running on a loop.

 

The performance and space that exists when the AI are fully local to the HC is quite large, which allows for some more intensive AI scripts to be run. I have added some custom functionality to the AI such as reinforcement handling, fired eventhandlers for weapon sound detection, and bunker behavior for the AI enabling them to be much more effective in suppressing at range.

 

https://github.com/PiZZAD0X/Olsen-Framework-Arma-3/wiki

 

Expect updates to the behavior functions including new behavior modes/ features, most notably specific vehicle behaviors and static HMG improvements. 

 

The thing is how much performance you gain by not using acex-loops?  :wacko:   A little? 10Fps? Quite a lot?

 

Also, can this work with editor placed units? 

Share this post


Link to post

The thing is how much performance you gain by not using acex-loops?  :wacko:   A little? 10Fps? Quite a lot?

 

Also, can this work with editor placed units? 

 

No, the point of the module is to export the editor placed units to an SQF array with the data and spawn the units either before mission start or live spawning them in. And yes, a large culprit of bad server fps from AI was because it was running the loop and using the setowner commands. I have a test mission on Utes in which you can live spawn in some more AI with the debug command ["Enemy_1"] call spawnonHC. Get it up to ~250 AI and get them all in combat with you and you can see the performance difference. The lowest I went to was 38 fps on the headless client, 43 fps on the server. The same test with the ACEX module simply crashes the server.

Share this post


Link to post

No, the point of the module is to export the editor placed units to an SQF array with the data and spawn the units either before mission start or live spawning them in. And yes, a large culprit of bad server fps from AI was because it was running the loop and using the setowner commands. I have a test mission on Utes in which you can live spawn in some more AI with the debug command ["Enemy_1"] call spawnonHC. Get it up to ~250 AI and get them all in combat with you and you can see the performance difference. The lowest I went to was 38 fps on the headless client, 43 fps on the server. The same test with the ACEX module simply crashes the server.

 

Very interesting indeed, can this balance the units through multiple HC clients? 

Share this post


Link to post

As of now I just built it for one headless as that's what the UO servers are set to, and adding units to another headless client has the requirement of sharing some variables about the units between them for the AI scripts to work. I am currently experimenting with some different ways to compile an efficient array of group data from the AI for use with an emulated commander logic and balancing the behavior and aggressiveness of the AI to make the mission more than one large firefight. If I can get my array change update more efficient, then sharing that between multiple HC shouldn't be a problem anymore and multiple HC would give us even more room for AI scripts.

Share this post


Link to post

I am having an issue where when I am executing the ["Groups",1] call HC_fnc_ExportSQF; while having selected a group nothing gets copied to my clipboard to post into the AI array. I have followed the guide on your github and reloaded the mission numerous times, and have made sure that the module is enabled. Any ideas?

 

Share this post


Link to post

I am having an issue where when I am executing the ["Groups",1] call HC_fnc_ExportSQF; while having selected a group nothing gets copied to my clipboard to post into the AI array. I have followed the guide on your github and reloaded the mission numerous times, and have made sure that the module is enabled. Any ideas?

 

You have to double, triple check that { private _fnc.... blah blah shows up under HC_fnc_ExportSQF when you put it in the watch box to signify that his export function has initialized correctly. You may have to load/reload the mission a few times AND check/uncheck the recompile function between reloads(<---- The wiki doesn't mention the second part). At least for me the recompile function apparently bugs out sometimes. Once the function is found though, it works flawlessly. It confused me a bit at first as well as it isn't as consistent to initialize his functions as the wiki makes it appear. 

 

If it's empty when you paste your output into a readme or whatever after executing ["Groups",1] call HC_fnc_ExportSQF; AND you're sure you selected the entire group you want (each unit and movements) AND you've de-binarized it so it doesn't try to read that gibberish, then you definitely need to ensure his function compiled correctly. Also, don't forget like I did to add his headless client module and to give it some specific variable name so that it can be called upon or the HC won't load in the mission.

Edited by Leonidas

Share this post


Link to post

As a side note, I also was wondering what's the most efficient way to maintain client side FPS. Right now, my mission has ~200 AI. This is great and I believe the SRV4 FPS is good with HC but my client FPS dips greatly if I'm within range of the AI even if I can't see them. For example, if my view distance is set to 3000 I have a huge dip but if I remove the some AI from the mission OR I reduce my view distance OR I move out of range, it goes back up. Can I make the AI static if they aren't directly visible to the client or something? I guess dynamic simulation is the only way to maintain performance such that I can get the large view distance and many AI with reasonable frames even with the performance benefits of headless client?

Edited by Leonidas

Share this post


Link to post

Ok, I was able to find another version of the module for which the export function worked, and I have exported the AI into the array and modified their settings. I have placed down the Headless Client virtual entity, but now none of my AI seem to spawn, both on server 3 and in single player editor.

Edited by Gkenny

Share this post


Link to post

Did the HC load into the HC position on the slot screen? I was unaware that there were multiple versions. 

You setup the AiArrays.sqf and then identified those squads to load in the settings.sqf?

Like add the unit...
 

Inf1 = [[],[
[WEST, ["", "", "Alpha 3-1", 0], ["YELLOW", "AWARE", "WEDGE", "NORMAL", false, false], [
["LIB_GER_scout_sniper", ["", ""], [[14487.2,8890.71,46.6241], [[-0.885421,0.46479,0], [0,0,1]], 0], [0.5, 0, 1, "SERGEANT", "Up"], [false, true, false, true, true, false], ["Bertolt Broder", "WhiteHead_02", "", "", 0.99, ""], [1, "true"], []]
,["LIB_GER_scout_sniper", ["", ""], [[14487,8890.57,51.1051], [[-0.981318,-0.192394,0], [0,0,1]], 0], [0.4, 0, 1, "PRIVATE", "Up"], [false, true, false, true, true, false], ["Bertolt Schnatz", "WhiteHead_15", "", "", 1.02932, ""], [1, "true"], []]
],[
]]
]
];

And load the unit...
 

_InitialSpawn = ["Inf1","Inf2","Inf3","Inf4","Inf5","Inf6","Inf7","Inf8","Inf9","Inf10","Inf11","Inf12","Inf13","Inf14","Inf15","Inf16","Inf17","Inf18"];

Also, headless client doesn't work in single player. It needs a variable name that the server HC will slot into during the mission slotting. Remember that you need to DELETE the AI or they will duplicate (but save a copy of the mission with them).
Edited by Leonidas

Share this post


Link to post

I figured it out, I was calling both array names in one string instead of two seperate strings. oops. Seems to work now.

Edited by Gkenny

Share this post


Link to post

I figured it out, I was calling both array names in one string instead of two seperate strings. oops. Seems to work now.

Yep. So where did you find another module? Did you get your own custom export function? Is it more reliable?

Share this post


Link to post

No for some reason the module I downloaded from the github link just did not work with exporting the AI to the array, so i ripped the module from Dalltra's CO14 Seahawk Down which works and used that.

Share this post


Link to post

The module will spawn in the initial arrays and any arrays called with HC_fnc_spawnonHC if it is in singleplayer. It spawns them on the client's computer (just for testing, has no effect in multiplayer)

If you are still not getting the function defined after checking recompile functions and reloading the mission try previewing the mission and returning to the editor. 3DEN is just really bad at doing the recompiling function. If I turn this module into an addon, we can not only move the large scripts from the missions to addon functions for space but we can also add custom buttons in 3DEN under tools, something like "Export Selected AI to Clipboard" without having the mission maker deal with the debug console.

I'm working on redoing the AI scripts from the ground up instead of using a VCOM base so that's where my attention is right now.

Share this post


Link to post

The module will spawn in the initial arrays and any arrays called with HC_fnc_spawnonHC if it is in singleplayer. It spawns them on the client's computer (just for testing, has no effect in multiplayer)

 

If you are still not getting the function defined after checking recompile functions and reloading the mission try previewing the mission and returning to the editor. 3DEN is just really bad at doing the recompiling function. If I turn this module into an addon, we can not only move the large scripts from the missions to addon functions for space but we can also add custom buttons in 3DEN under tools, something like "Export Selected AI to Clipboard" without having the mission maker deal with the debug console.

 

I'm working on redoing the AI scripts from the ground up instead of using a VCOM base so that's where my attention is right now.

 

Cool. Let me know if you need any help testing or whatever.

Share this post


Link to post

Ok something else I have found, when testing in the test server, these yellow orbs appeared around the AI: https://imgur.com/a/A4XeQNq. Anyone know what may be causing this?

That's awesome. Never seen that before. Is it only when you're in the spectator script?

Share this post


Link to post

That's awesome. Never seen that before. Is it only when you're in the spectator script?

Nah it was visible as both a player and in spectator.

Share this post


Link to post

That's what you get for ripping a random version from someone's mission! :smile:

 

Also you are evil for placing bunker AI in those buildings

Edited by PiZZADOX

Share this post


Link to post

1. How would I do probability based spawning of ai groups?

2. How would I do trigger activated waypoints for ai?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...