Jump to content

Recommended Posts

As part of the Mission Template Stand Alone GAIA - Make missions FAST by using MCC GAIA engine tread and this post: https://forums.bistudio.com/forums/topic/172933-mission-template-stand-alone-gaia-make-missions-fast-by-using-mcc-gaia-engine/?do=findComment&comment=3242519

 

Edit:

I lost the original mission and when I went to re-create it I deciced the description needed an update.  This is the result:

 

I said I would post the current interface I use for running the GAIA system and adding groups to GAIA.  I'm releasing it as a quick simple mission you can open in Eden to have a look at.

 

https://1drv.ms/u/s!AnX2_vGoXf5F9gzTinvXW7GUQB2o

 

Unpack the zip file to the where your Eden missions are stored.  Usually one of:

C:\Users\win-username\Documents\Arma 3 - Other Profiles\arma-profile-name\missions

C:\Users\win-username\Documents\Arma 3 - Other Profiles\arma-profile-name\mpmissions

 

Then open it in the Eden editor.  The mission does not need any mods but note it does not like running with MCC.

 

The mission only has OPFOR units and a single civilian (and helicopter) you can use to observe the behaviour of the GAIA controlled units.  Note in particular the placed static HMG and static AT that the squad nearby will occupy as they are give the STRI_GAIA_FORTIFY command.

 

Adding to a Current/New Mission

 

Start by creating a mission in the editor and saving it.

 

Now copy the gaia, Mission and Stri folders from the template mission's root directory (gaia_stri_temp.Stratis).

 

Then you need to add the following to the description.ext file (if you don't have one then you can copy the file from the example mission and skip the next bit).

Then add the following line to the file inside the CfgFunctions class declaration:

   // Mission scripts.
   #include "Mission\miss_functions.hpp"

   // Library scripts.
   #include "Stri\stri_functions.hpp"

If you don't have a CfgFunctions in your file you will need to add:

class CfgFunctions {

   // Mission scripts.
   #include "Mission\miss_functions.hpp"

   // Library scripts.
   #include "Stri\stri_functions.hpp"

};

Then you need to create an init.sqf or edit your current one:

Add the following line near the start of the file.

#include "Mission\Gaia\gaia_gaia.hpp"

Now we want to initialise the GAIA system but we only want this to run on the server (or dedicated server) so add the following:

if ( isServer ) then {

   // Initialise GAIA system.
   [] call miss_fnc_gaia_init;

}; // if ( isServer ).

Finally any units you want to be controlled by GAIA will need to be added using the miss_fnc_gaia_addGroupToGaia function.  These can be groups created in the editor or spawned using your own code.  Again you probably only want this code to run the code on the server server so use something like this:
 

// Only run code on server.
if ( isServer ) then {
   // Create groups command array.

   _gaiaGroups = [
      [ ALPHA_1_1, "0", STRI_GAIA_FORTIFY, STRI_GAIA_DISABLE_CACHING ],
         // Squad defending Agia Marina, North side by radio tower.
      [ ALPHA_1_2, "1", STRI_GAIA_DEFEND, STRI_GAIA_DISABLE_CACHING ],
         // Recon squad will patrol town, starting in the military range in the
         // South East of Agia Marina.
      [ ALPHA_1_3, "1", STRI_GAIA_DEFEND, STRI_GAIA_DISABLE_CACHING ],
         // Recon squad will patrol town, starting by the breakwater on the
         // North West side of Agia Marina.
      [ ALPHA_1_4, "2", STRI_GAIA_PATROL, STRI_GAIA_DISABLE_CACHING ]
         // IFV squad patroling the areal around Agai Marina.
   ];

   // Add placed untis to GAIA system.
   {
      _group = _x;

      // Add the group to the GAIA system.
      _group call miss_fnc_gaia_addGroupToGaia;

   } forEach _gaiaGroups;

}; // if ( isServer ).

Note: In the above example we are adding groups created in the editor.  To set the group variable name you have to set the properties of the group by right clicking the Alpha 1-1 tag above the list of units in the group and selecting Attributes... and setting the Variable Name field.

#include "Mission\Gaia\gaia_gaia.hpp"

#define STRI_GAIA_ENABLE_CACHING  true
#define STRI_GAIA_DISABLE_CACHING false

// Initialise the GAIA system.
[] call miss_fnc_gaia_init;

// Add the AI to GAIA.
{
   [_x, "0", STRI_GAIA_FORTIFY, true ] call miss_fnc_gaia_addGroupToGaia;
} forEach [ ENEMY_1 ];

// Report that the 
systemChat "Game init.sqf complete";

The interface is just 3 functions:

 

miss_fnc_gaia_init - This does the GAIA initialisation, a background task to run GAIA.  Call this before trying to add groups to GAIA.

e.g:

// Initialise GAIA system.
[] call miss_fnc_gaia_init;

 

miss_fnc_gaia_addGroupToGaia - This does what is says on the tin.  It adds a group to GAIA, allowing a full set of controls. i.e. You can set the marker, the command and weather caching of the group is to be used.

It has up to 4 parameter that are passed to it:

  1. The group you want to add to GAIA.
  2. The marker that specifies the area where the command will be applied.
  3. The command.  For this you should use either STRI_GAIA_FORTIFY (GAIA's "FORTIFY"),  STRI_GAIA_DEFEND (GAIA's "NOFOLLOW")or STRI_GAIA_PATROL (GAIA's "MOVE").
  4. Whether caching is enabled.  This parameter is optional and can be set to STRI_GAIA_ENABLE_CACHING, STRI_GAIA_DISABLE_CACHING.  If the parameter is not passed then STRI_GAIA_ENABLE_CACHING is assumed.

e.g.

Typically:

[ ALPHA_1_2, "1", STRI_GAIA_DEFEND, STRI_GAIA_DISABLE_CACHING ] call miss_fnc_gaia_addGroupToGaia;
[ _patrolGroup "2", STRI_GAIA_PATROL, STRI_GAIA_DISABLE_CACHING ] call miss_fnc_gaia_addGroupToGaia;

Both the following will result in GAIA caching being disabled:

[ ALPHA_1_1, "0", STRI_GAIA_FORTIFY, STRI_GAIA_ENABLE_CACHING ] call miss_fnc_gaia_addGroupToGaia;
[ _fortifyGroup, "0", STRI_GAIA_FORTIFY ] call miss_fnc_gaia_addGroupToGaia;

 

miss_fnc_gaia_nextMarker - This is meant to be used as part of a automatic placement system and will generate a new marker name for the next GAIA marker zone.

e.g.

_nextGaiaMrk = [] call miss_fnc_gaia_nextMarker;

This makes it easier to create markers in a script and give them a name.

Good luck!  S

 

  • Like 1

Share this post


Link to post
Share on other sites

I'm going to reply to my own topic because this more of a side note than anything directly to do with my 2 functions.

 

miss_fnc_gaia_addGroupToGaia Accepts 4 parameters:

  1. Group: The group you want to add to GAIA.
  2. String: The GAIA zone ("0", "1",... "n").
  3. Integer: Command.  This is an integer number for which the only valid values are 0, 1 or 2.  To make it easier to understand when you are looking at the code I '#define#': STRI_GAIA_FORTIFY is 0; STRI_GAIA_DEFEND is 1; STRI_GAIA_PATROL is 2 and these correspond to the GAIA commands: "FORTIFY", "NOFOLLOW" and "MOVE".  Sorry about that I just could not overcome the software engineering pedant/arrogance in me - I'm convinced it is a better way of doing things.
  4. Boolean: (Optional; default: true) Flag to tell us weather or not to use GAIA caching.  true - Caching enabled; false- Caching disabled.

This means that you can write a piece of code like:

// Setup enemy AI.
_enemyGroups = [
   [ ENEMY_AA_1, "5", STRI_GAIA_FORTIFY, true],
   [ ENEMY_AA_2, "6", STRI_GAIA_FORTIFY, true],
   [ ENEMY_LEADER, "1", STRI_GAIA_FORTIFY, true],
   [ ENEMY_DEFEND_1, "2", STRI_GAIA_FORTIFY, true],
   [ ENEMY_PATROL_1, "0", STRI_GAIA_PATROL, true],
   [ ENEMY_AT, "4", STRI_GAIA_FORTIFY, true],
   [ ENEMY_PATROL_2, "0", STRI_GAIA_PATROL, true]
];

// Loop through '_enemyGroups' array:
{
   _x call miss_fnc_gaia_addGroupToGaia;
} forEach _enemyGroups;

This is fine but when I started testing this mission I started to see error messages appear in the bottom left of my screen telling me a group variable was undefined (though nothing appears in the report file).  After much work convincing myself that I had not spelt the name of a group wrong in Eden; scipt or there was some fundamental flaw in my code.  I turns out that when there are too many groups being defined GAIA will display this error.  The cure is to put a short delay.  It got down to 0.01 second. i.e.

// Loop through '_enemyGroups' array:
{
   _x call miss_fnc_gaia_addGroupToGaia;
   sleep 0.01;
} forEach _enemyGroups;

This will be a nice solution if this is the only way you are going to add groups is using the above style code but I want to allow groups to be added to GAIA by adding them in init field or a group or unit.  So I guess that putting the delay at the end of the miss_fnc_gaia_addGroupToGaia is clunky but not likely to run when the server is under a lot of load.  So yes I'll be updating my example mission... ...sometime.  S

Share this post


Link to post
Share on other sites

Hi strider42,

 

The link to the interface no longer seems to contain the files you are referring to here. Any chance of still getting a hold of them? Thanks.

Share this post


Link to post
Share on other sites

I've still got the mission that strider42 created. It is still very impressive. Have also asked spirit6 to see if he's still working on GAIA. 

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

×