mwpowellhtx / KP-Liberation

The work on GreuhZbugs Liberation Mission for Arma 3 continues...
GNU General Public License v3.0
7 stars 1 forks source link

[Enemy] [0001] Review and revise the enemy strength etc #78

Open mwpowellhtx opened 3 years ago

mwpowellhtx commented 3 years ago

Basic Information

Mission version: 0.98.dev-s13 Map used: Altis

Short Issue Description

Much of this module is probably direct or indirect transliteration from the legacy code.

Probably other items to consider as well, but these are the few that come to mind on first inspection.

mwpowellhtx commented 3 years ago

Postponed for the time being, however, we may look into some of this approaching HUD reports.

mwpowellhtx commented 3 years ago

Made an effort to minize the impact on this module, but was unavoidable to effect proper maximum parameters, and scaling, etc.

For instance, this is a glimpse of what the FSM editor generates, and this is just the start of one of the states...

/*%FSM<STATE "start">*/
class start
{
    name = "start";
    itemno = 0;
    init = /*%FSM<STATEINIT""">*/"params [" \n
        "    [""_state"", ""unaware"", [""""]]" \n
        "];" \n
        "" \n
        "private _time = diag_tickTime;" \n
        "private _patrolTime = diag_tickTime;"/*%FSM</STATEINIT""">*/;
    precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
    class Links
    {
        /*%FSM<LINK "start_reinforcin">*/
        class start_reinforcin
        {
                itemno = 5;
                priority = 1.000000;
                to="reinforcing";
                precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
                condition=/*%FSM<CONDITION""">*/"isServer" \n
                    "&&" \n
                    "{_state == ""reinforcing""}"/*%FSM</CONDITION""">*/;
                action=/*%FSM<ACTION""">*/"if (KPLIB_param_enemyDebug) then {[""Started reinforcing"", ""ENEMY FSM""] call KPLIB_fnc_common_log;};"/*%FSM</ACTION""">*/;
        };
mwpowellhtx commented 3 years ago

The key here is a KPLIB_preset_enemy_thresholdMap, which we use to inform awareness and strength based state transitions. There are perhaps a dozen different potential parameters that we could capture in CBA settings if camp colonels really wanted to fine tune how the thing behaved. For now, we simply transliterated from the current FSM to potentially parameter driven variables. For instance, we track an awareness transition from reinforce to defend with the key "awareness:reinforce:defend", rinse and repeat depending on strength, skirmish, counterattack, etc. All distilled from the current FSM. Which request must also be aware of the threshold direction, i.e. _awareness >= _threshold, being "awareness:ge", rinse and repeat depending on strength, <= being "le", etc. This is all routed through the configuration function KPLIB_fnc_enemy_getThreshold, which leans into the HASHMAP KPLIB_preset_enemy_thresholdMap. KPLIB_param_enemy_maxAwareness and KPLIB_param_enemy_maxStrength are used for defaults when necessary in the less than or equal to comparison, respectively, or 0 in the greater than or equal to direction.