Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Coder Diary #31 -- Audacious & Cautious A/I Redux

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Campaign Series: Middle East 1948-1985 >> Coder Diary #31 -- Audacious & Cautious A/I Redux Page: [1]
Login
Message << Older Topic   Newer Topic >>
Coder Diary #31 -- Audacious & Cautious A/I Redux - 9/26/2015 2:50:27 AM   
berto


Posts: 19699
Joined: 3/13/2002
From: metro Chicago, Illinois, USA
Status: offline

Coder Diary #31 -- Audacious & Cautious A/I Redux



Revisiting the Campaign Series Audacious A/I and Cautious A/I:



Audacious A/I and Cautious A/I were first introduced for JTCS 2.00 in Coder Diary #10 -- New A/I Bells & Whistles, where I wrote:

quote:

  • Side A Audacious A/I
  • Side A Cautious A/I
  • Side B Audacious A/I
  • Side B Cautious A/I

    Audacious A/I tweaks the above [A/I] parameters to encourage more risky behavior, such as offloading units nearer the enemy, sending "unhealthy" units into battle, etc. Cautious A/I does just the opposite: discourages risky behavior -- increases standoff distance, keeps unhealthy units out of harms way, etc.

    So, players can affect the game's A/I behavior either by, at game's outset, specifying the A/I parameters in the ai.ini file [now handled differently, via the new Adaptive A/I system], else by making the A/I side's profile Audacious or Cautious, at any time, based on whimsy, or out of a desire to nudge the A/I to adopt one or the other behavior more appropriate to the current game situation.

  • Audacious A/I and Cautious A/I have been buffed in Middle East. How so?

    For one thing, unlike the earlier minimalist ai.ini (since retired), Audacious & Cautious A/I are now based on the greatly expanded Adaptive A/I system, where not just the original dozen or so parameters (in ai.ini), now nearly six dozen modifiable A/I parameters guide solo vs. A/I game play, but many aspects of game behavior in the other game play modes as well (PBEM, H2H, NetPlay).

    When the game launches, whether or not you have selected the Adaptive A/I optional rule



    the game engine sets internal variables to their init.ai or <scenario>.ai values, if Adaptive A/I is ON, else to their standard default values, if Adaptive A/I is turned OFF.

    Thereafter, if you select A/I > Side B Audacious A/I (see the first screenshot above), these internal variables for Side B are adjusted, like for example:



    ...

    // 60-69 combat, direct fire, assault
    AIParameterInc (side, leader_loss_prob, 10, 100, _aggressive [side]);
    AIParameterDec (side, fire_starshell_prob, 10, 0, _aggressive [side]);
    // starshell_scatter_prob
    AIParameterDec (side, fire_smoke_prob, 10, 0, _aggressive [side]);
    AIParameterInc (side, banzai_prob, 10, 100, _aggressive [side]);
    // combat_reserved_65
    // combat_reserved_66
    // combat_reserved_67
    // combat_reserved_68
    // combat_reserved_69

    ...



    For Audacious A/I, the first line



    AIParameterInc (side, leader_loss_prob, 10, 100, _aggressive [side]);



    indicates to increment the leader_loss_prob (the likelihood a leader will become a casualty) by 10% over its base A/I value, with a max for leader_loss_prob of 100% (can't go higher than certainty).

    The second line



    AIParameterDec (side, fire_starshell_prob, 10, 0, _aggressive [side]);



    indicates to decrement the fire_starshell_prob by 10% from its base probability, not to go under 0%.

    And so on, for the other example parameters, and many other parameters not shown. (Note how, in the above list, starshell_scatter_prob is not affected by Audacious or Cautious A/I.)

    For Cautious A/I, we have instead



    ...

    // 60-69 combat, direct fire, assault
    AIParameterDec (side, leader_loss_prob, 10, 0, _aggressive [side]);
    AIParameterInc (side, fire_starshell_prob, 10, 100, _aggressive [side]);
    // starshell_scatter_prob
    AIParameterInc (side, fire_smoke_prob, 10, 100, _aggressive [side]);
    AIParameterDec (side, banzai_prob, 10, 0, _aggressive [side]);
    // combat_reserved_65
    // combat_reserved_66
    // combat_reserved_67
    // combat_reserved_68
    // combat_reserved_69

    ...



    Note how AIParameterInc() under Audacious A/I corresponds to AIParameterDec(), for the same parameter, under Cautious A/I. And similarly for AIParameterDec() to AIParameterInc().

    So under Audacious A/I, the appropriate parameters are tweaked in such a way either to promote risk-taking behavior, or to alter the likelihood of something happening, or not happening, if a force was acting in a risky manner. While under Cautious A/I, the appropriate parameters are tweaked in such a way either to discourage risk-taking behavior, or to alter the likelihood of something happening, or not happening, if a force was acting in a cautious manner.

    Let's take a closer look at the AIParameterInc() function, for example



    AIParameterInc (side, leader_loss_prob, 10, 100, _aggressive [side]);



    What is that final function argument, _aggressive [side]? It is the side Aggressiveness, as set either initially by the scenario designer (and saved in the .scn file; see the discussion about this in Coder Diary #10), or adjusted in game, before Audacious A/I or Cautious A/I are selected, like so:



    Side A/I Aggressiveness not only impacts a side's, um, "aggressiveness" (as described in Coder Diary #10), it also impacts whether or not an Adaptive A/I parameter is incremented, or decremented.

    In the AIParameterInc() function definition, we have:



    // A I P a r a m e t e r I n c
    //
    // Maybe increment the specified AI parameter by a given amount, for the given
    // side & nations active for that side; and check against the given maximum.

    void AIParameterInc (SideValue side, AIparameter parameter, int increment, int max, int prob)
    {
    static const char fnnam[] = "AIParameterInc";
    int nation;
    if (::DieRoll (100) <= prob) {

    [increment the appropriate parameter, for the indicated side, and all that side's nations]

    }
    }



    That is to say, the higher the prob value -- the higher the side "aggressiveness" -- the more likely the indicated parameter values will be incremented.

    And similarly for AIParameterDec(): the higher the prob value -- the higher the side aggressiveness -- the more likely the indicated parameter values will be decremented.

    So various A/I parameter values are increased or decreased -- maybe, depending on the side Aggressiveness values, and how the internal "die roll" falls.

    The net effect is: One side (or its several nations) or the other (or its several nations) are nudged to be more Audacious, or more Cautious. The overall mix of adjustments is never the same. It rolls out differently each time you play the game!

    Finally, a recap of Shifting A/I. From Coder Diary #10:

    quote:

  • Side A Shifting A/I.
  • Side B Shifting A/I.

    How do they work? First off, if you choose Shifting A/I, it overrides Audacious A/I and Cautious A/I; you can't have both. (Obviously, Audacious A/I precludes Cautious A/I, and vice versa.)

    Secondly, in a random shift direction, the game will have the A/I go Audacious for (random) X number of turns, also tilt towards increased Aggressiveness; or go Cautious for (random) X number of turns, and become less Aggressive; then stay Audacious/More Aggressive, or stay Cautious/Less Aggressive; else revert to default neutral (neither Audacious/Aggressive+ nor Cautious/Aggressive-).

    That is to say, the A/I would not jump immediately from Audacious/Aggressive+ to Cautious/Aggressive- (or vice versa). It would have to pass through the neutral middle behavior if and when passing from Audacious/Aggressive+ to Cautious/Aggressive- (or vice versa).

    At each A/I behavior stage, the A/I would linger there for (random) X turns before (possibly) moving on to a new stage.

    Depending on the internal "dice", it is entirely possible with Shifting A/I for the A/I to go Audacious/Aggressive+ and stay there for the entire game. Or go Cautious/Aggressive- and remain there. Or stay neutral throughout. Spend most of the game Audacious/Aggressive+, then turn Cautious/Aggressive- toward the end. Or start out Cautious/Aggressive-, then go Audacious/Aggressive+ later. In longer games, go Audacious/Aggressive+, then tend towards Cautious/Aggressive-, then back to Audacious/Aggressive+, then...

  • Shifting A/I still works essentially the same, no change from previously.

    In the new Campaign Series, there are A/I options galore. With more to come! We will be expanding the list of Adaptive A/I parameters, hence the affected subset list of Audacious/Cautious A/I parameters. We also have other ideas on how to improve and expand upon other areas of the A/I's operation.

    Our work on the A/I -- is it the beginning of the end, or the end of the beginning? I would judge the latter. There's vast potential here. We're just getting started!

    Until the next time...

    < Message edited by berto -- 9/27/2015 12:33:08 AM >


    _____________________________

    Post #: 1
    Page:   [1]
    All Forums >> [New Releases from Matrix Games] >> Campaign Series: Middle East 1948-1985 >> Coder Diary #31 -- Audacious & Cautious A/I Redux Page: [1]
    Jump to:





    New Messages No New Messages
    Hot Topic w/ New Messages Hot Topic w/o New Messages
    Locked w/ New Messages Locked w/o New Messages
     Post New Thread
     Reply to Message
     Post New Poll
     Submit Vote
     Delete My Own Post
     Delete My Own Thread
     Rate Posts


    Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

    0.105