ArmA AI need some ICE...

This commit is contained in:
eraser1 2016-05-22 00:05:16 -05:00
parent 1244550ded
commit 725487340e
8 changed files with 99 additions and 9 deletions

View File

@ -4,7 +4,7 @@ class CfgPatches
{ {
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
a3_DMS_version = "May 16, 2016 (TESTv2)"; a3_DMS_version = "May 22, 2016 (TEST)";
requiredVersion = 1.36; requiredVersion = 1.36;
requiredAddons[] = {"exile_client","exile_server_config"}; requiredAddons[] = {"exile_client","exile_server_config"};
}; };

View File

@ -337,6 +337,13 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_ai_offload_Only_DMS_AI = false; // Do you use other mission systems on your server but still want to offload AI? You should probably enable this then, unless you have tested it for compatibility. DMS_ai_offload_Only_DMS_AI = false; // Do you use other mission systems on your server but still want to offload AI? You should probably enable this then, unless you have tested it for compatibility.
DMS_ai_offload_notifyClient = false; // Notify the client when AI has been offloaded to the client. DMS_ai_offload_notifyClient = false; // Notify the client when AI has been offloaded to the client.
DMS_ai_allowFreezing = true; // Whether or not to "freeze" AI that are a certain distance away from players (and therefore inactive).
DMS_ai_freeze_Only_DMS_AI = false; // Whether or not to "freeze" AI that are not spawned by DMS.
DMS_ai_freezingDistance = 3500; // If there are no players within this distance of the leader of an AI group, then the AI group will be "frozen".
DMS_ai_unfreezingDistance = 3500; // If there are players within this distance of the leader of an AI group, then the AI group will be "un-frozen".
DMS_ai_offloadOnUnfreeze = true; // Whether or not to offload AI to clients once they have been "un-frozen". NOTE: This config will be ignored if "DMS_ai_offload_to_client" is set to false.
DMS_ai_freezeCheckingDelay = 30; // How often (in seconds) DMS will check whether to freeze/un-freeze AI.
DMS_ai_share_info = true; // Share info about killer DMS_ai_share_info = true; // Share info about killer
DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI

View File

@ -93,6 +93,11 @@ if ((isClass (configFile >> "CfgPatches" >> "Ryanzombies")) && {!DMS_ai_offload_
DMS_ai_offload_Only_DMS_AI = true; DMS_ai_offload_Only_DMS_AI = true;
}; };
if !(DMS_ai_offload_to_client) then
{
DMS_ai_offloadOnUnfreeze = false;
};
DMS_A3_AllMarkerColors = []; DMS_A3_AllMarkerColors = [];
@ -232,6 +237,8 @@ if (DMS_StaticMission) then
// Add heli paratroopers monitor to the thread system. // Add heli paratroopers monitor to the thread system.
[5, DMS_fnc_HeliParatroopers_Monitor, [], true] call ExileServer_system_thread_addTask; [5, DMS_fnc_HeliParatroopers_Monitor, [], true] call ExileServer_system_thread_addTask;
// Add "freeze" monitor to the thread system.
[DMS_ai_freezeCheckingDelay, DMS_fnc_FreezeManager, [], true] call ExileServer_system_thread_addTask;

View File

@ -56,6 +56,7 @@ DMS_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1;
DMS_HelisToClean = []; DMS_HelisToClean = [];
DMS_HeliParatrooper_Arr = []; DMS_HeliParatrooper_Arr = [];
DMS_FrozenAIGroups = [];
// Initialize mission variables... // Initialize mission variables...

View File

@ -262,7 +262,6 @@
["Land_HBarrier_5_F",[23495.8,18860.2,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false], ["Land_HBarrier_5_F",[23495.8,18860.2,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false],
["Land_HBarrier_5_F",[23495.7,18855.7,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false], ["Land_HBarrier_5_F",[23495.7,18855.7,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false],
["Land_Wreck_Hunter_F",[23338,18860.7,0],181.364,[[-0.0238044,-0.999717,0],[-0,0,1]],false], ["Land_Wreck_Hunter_F",[23338,18860.7,0],181.364,[[-0.0238044,-0.999717,0],[-0,0,1]],false],
["Land_Wreck_Heli_Attack_01_F",[23279,18478,0],150.909,[[0.486198,-0.873849,0],[0,-0,1]],false],
["Land_CncBarrier_stripes_F",[23228.8,18448,0],343.182,[[-0.289332,0.957229,0],[0,0,1]],false], ["Land_CncBarrier_stripes_F",[23228.8,18448,0],343.182,[[-0.289332,0.957229,0],[0,0,1]],false],
["Land_Wreck_HMMWV_F",[23229.5,18446.4,0],214.091,[[-0.560509,-0.828148,0],[-0,0,1]],false], ["Land_Wreck_HMMWV_F",[23229.5,18446.4,0],214.091,[[-0.560509,-0.828148,0],[-0,0,1]],false],
["Land_Cargo_House_V2_ruins_F",[23280.9,18484.3,0],206.984,[[-0.477745,-0.861692,0.171015],[-0.0955405,0.244475,0.964937]],false], ["Land_Cargo_House_V2_ruins_F",[23280.9,18484.3,0],206.984,[[-0.477745,-0.861692,0.171015],[-0.0955405,0.244475,0.964937]],false],
@ -691,4 +690,4 @@
["Land_HBarrierBig_F",[23202.9,18486.2,0],89.8719,[[0.999997,0.00223477,0],[0,0,1]],false], ["Land_HBarrierBig_F",[23202.9,18486.2,0],89.8719,[[0.999997,0.00223477,0],[0,0,1]],false],
["Land_HBarrierBig_F",[23206.1,18481.3,0],2.90385,[[0.0506604,0.998716,0],[0,0,1]],false], ["Land_HBarrierBig_F",[23206.1,18481.3,0],2.90385,[[0.0506604,0.998716,0],[0,0,1]],false],
["Land_HBarrierBig_F",[23209.4,18481.2,0],180.43,[[-0.00751282,-0.999972,0],[-0,0,1]],false] ["Land_HBarrierBig_F",[23209.4,18481.2,0],180.43,[[-0.00751282,-0.999972,0],[-0,0,1]],false]
]; ];

View File

@ -8,7 +8,7 @@
if (!DMS_ai_offload_to_client) exitWith {}; if (!DMS_ai_offload_to_client) exitWith {};
{ {
if (((count (units _x))>1) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then if (((count (units _x))>1) && {!(_x getVariable ["DMS_LockLocality",false])} && {!(DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then
{ {
private _leader = leader _x; private _leader = leader _x;
private _group = _x; private _group = _x;

View File

@ -0,0 +1,67 @@
/*
DMS_fnc_FreezeManager
Created by eraser1
Determines which AI groups (if any) to "freeze" in order to improve server performance, and will "un-freeze" frozen AI when a player is nearby.
This function will also offload AI after "un-freezing" if configured to do so.
NOTE: If you want this function to ignore a specific group, then you can set the variable "DMS_AllowFreezing" on the group to false.
eg: _group setVariable ["DMS_AllowFreezing",false]
*/
if !(DMS_ai_allowFreezing) exitWith {};
private _recentlyUnfrozen = [];
{
if (isNull _x) then
{
diag_log format["DMS ERROR :: Null Group found in DMS_FrozenAIGroups! Index: %1",_forEachIndex];
DMS_FrozenAIGroups deleteAt _forEachIndex;
}
else
{
private _leader = leader _x;
if ([_leader,DMS_ai_unfreezingDistance] call DMS_fnc_IsPlayerNearby) then
{
{_x enableSimulationGlobal true} forEach (units _x);
_recentlyUnfrozen pushBack _x;
if (DMS_ai_offloadOnUnfreeze) then
{
[_group, _leader] call DMS_fnc_SetAILocality;
};
if (DMS_DEBUG) then
{
format["FreezeManager :: Un-froze AI Group: %1",_x] call DMS_fnc_DebugLog;
};
DMS_FrozenAIGroups deleteAt _forEachIndex;
};
};
} forEach DMS_FrozenAIGroups;
{
if (((count (units _x))>1) && {_x getVariable ["DMS_AllowFreezing",true]} && {!(DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then
{
private _leader = leader _x;
private _group = _x;
if ((!isNull _leader) && {alive _leader} && {!(isPlayer _leader)} && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then
{
{_x enableSimulationGlobal false} forEach (units _group);
DMS_FrozenAIGroups pushBack _group;
// So that we don't check this group for freezing later on.
_group setVariable ["DMS_AllowFreezing",false];
};
};
} forEach allGroups;
// NOW we allow them to be frozen again, so we avoid checking for nearby players TWICE on a group(s) that has just been un-frozen.
{
_x setVariable ["DMS_AllowFreezing", true];
} forEach _recentlyUnfrozen;

View File

@ -127,11 +127,6 @@ ___
___ ___
# Roadmap: # Roadmap:
#### Continuous Optimization + Improvements.
* ~~Implement the ability to "freeze" and "unfreeze" AI when there are no players nearby to improve performance. This will be under testing with a few selected server owners/community members. If you would like to participate in testing, please send a PM to [eraser1 on Exile Forums](http://www.exilemod.com/profile/96-eraser1/).~~ _This feature is slated for a future date_
#### AI Heli Paratroopers/air support.
#### Convoy Mission: #### Convoy Mission:
* Regularly update marker position. * Regularly update marker position.
* Implement function(s) for AI pathing. * Implement function(s) for AI pathing.
@ -146,6 +141,7 @@ ___
* Spawning in a trader on mission completion ([Trillseeker82](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=43932)). This might be done after the next Exile update due to the trader system overhaul :) * Spawning in a trader on mission completion ([Trillseeker82](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=43932)). This might be done after the next Exile update due to the trader system overhaul :)
#### Full Headless Client Support. #### Full Headless Client Support.
* AI will still be offloaded to clients (ideally); strictly DMS functions will be handled by the HC.
@ -154,6 +150,18 @@ ___
# Changelog: # Changelog:
### Test Branch: ### Test Branch:
#### May 22, 2016 (12:00 AM CST-America):
* **NEW CONFIG VALUES:**
DMS_ai_allowFreezing
DMS_ai_freeze_Only_DMS_AI
DMS_ai_freezingDistance
DMS_ai_unfreezingDistance
DMS_ai_offloadOnUnfreeze
DMS_ai_freezeCheckingDelay
* Removed a "Land_Wreck_Heli_Attack_01_F" from saltflats (it creates server threads)
* Adjusted logic in "AILocalityManager": the variable "DMS_LockLocality" on a group should now be considered even if "DMS_ai_offload_Only_DMS_AI" is set to false.
* You can now "freeze"/"un-freeze" AI! This has been a long-awaited feature for DMS. Using it should grant major performance benefits when you have lots of AI around the map that are inactive.
#### May 16, 2016 (11:00 AM CST-America): #### May 16, 2016 (11:00 AM CST-America):
* Fixed an error in fn_SpawnAIGroup (and MultiPos variant) * Fixed an error in fn_SpawnAIGroup (and MultiPos variant)
@ -196,6 +204,7 @@ ___
### Main Branch
#### April 27, 2016 (6:45 PM CST-America): #### April 27, 2016 (6:45 PM CST-America):
* **NEW CONFIG VALUES** * **NEW CONFIG VALUES**