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 #19 -- A/I Dithering Unit, Backtracking Move Bug -- Fixed!

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

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Current Games From Matrix.] >> [World War II] >> John Tiller's Campaign Series >> Coder Diary #19 -- A/I Dithering Unit, Backtracking Move Bug -- Fixed! Page: [1]
Login
Message << Older Topic   Newer Topic >>
Coder Diary #19 -- A/I Dithering Unit, Backtracking Mov... - 4/22/2014 7:04:12 AM   
berto


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

Coder Diary #19 -- A/I Dithering Unit, Backtracking Move Bug -- Fixed!


What is the most vexing, most notorious bug in all of the Campaign Series? Might it be this?

  • A unit, or stack of units, "dithers", can't make up its mind, as it moves forwards, then backwards, forwards again, then backwards again, ... in some cases, turn after turn after turn...

    Worse still, this often happens in the rear, out of harms way. There is no rhyme or reason to it. (Well, maybe there is a rhyme: "forwards, then backwards, forwards, then backwards".)

    Nothing destroys the immersion so much as seeing your A/I opponent move units back and forth, back and forth so senselessly. No human opponent would move like that. Aggravating!

    In the forthcoming JTCS 2.01 Update, the A/I dithering unit, backtracking move bug has been fixed!

    In JTCS 2.01, you will have the option to Prohibit A/I Backtracking. See the screenshot.




    Note the new A/I > Prohibit A/I Backtracking menu option.

    In the screenshot, the Troop Train invariably runs from the yellow highlighted hot spot hex to the yellow circled hex then back again. It will do this turn after turn after turn. Madness! By setting Prohibit A/I Backtracking, we can prevent that!

    Every time an A/I backtracking move is thwarted, this is noted in the ai.log, for example:



    2014-04-18 14:29:35 ef.exe: [INFO ID 1] in Move::MoveUnitsI: turn 1, side 1, isai true, ai_nobacktrack true; prev from hex 6,20, prev to hex 5,21, prev position 1, prev number 4; from hex 5,21, to hex 6,20, position 1, number 4; attempted backtrack move, aborted
    2014-04-18 14:29:35 ef.exe: [INFO ID 1] in Move::MoveUnitsI: turn 1, side 1, isai true, ai_nobacktrack true; prev from hex 6,20, prev to hex 5,21, prev position 1, prev number 4; from hex 5,21, to hex 6,20, position 1, number 4; attempted backtrack move, aborted
    2014-04-18 14:32:14 ef.exe: [INFO ID 1] in Move::MoveUnitsI: turn 2, side 1, isai true, ai_nobacktrack true; prev from hex 6,20, prev to hex 5,21, prev position 1, prev number 4; from hex 5,21, to hex 6,20, position 1, number 4; attempted backtrack move, aborted
    2014-04-18 14:32:14 ef.exe: [INFO ID 1] in Move::MoveUnitsI: turn 2, side 1, isai true, ai_nobacktrack true; prev from hex 6,20, prev to hex 5,21, prev position 1, prev number 4; from hex 5,21, to hex 6,20, position 1, number 4; attempted backtrack move, aborted
    2014-04-18 14:33:47 ef.exe: [INFO ID 1] in Forces::MoveUnits: turn 2, side 0, isai false, ai_nobacktrack true; prev from hex 68,9, prev to hex 69,9, prev position 1, prev number 1; from hex 69,9, to hex 68,9, position 1, number 1; attempted backtrack move, accomplished
    2014-04-18 14:35:25 ef.exe: [INFO ID 1] in Move::MoveUnitsI: turn 3, side 1, isai true, ai_nobacktrack true; prev from hex 6,20, prev to hex 5,21, prev position 1, prev number 4; from hex 5,21, to hex 6,20, position 1, number 4; attempted backtrack move, aborted
    2014-04-18 14:35:25 ef.exe: [INFO ID 1] in Move::MoveUnitsI: turn 3, side 1, isai true, ai_nobacktrack true; prev from hex 6,20, prev to hex 5,21, prev position 1, prev number 4; from hex 5,21, to hex 6,20, position 1, number 4; attempted backtrack move, aborted
    ...



    Does this thwarting mechanism prevent you, the human player, from backtracking a move? No, as you can see in the highlighted text above.

    Why might you (or the A/I) legitimately want to backtrack a move?

  • A unit moves forward, comes under heavy fire, then retreats to safety.
  • A unit moves forward, spots some enemy units from its forward position, then mission accomplished, moves back again.
  • The unit commander (you) changes his mind!

    In all such cases, we give the human player license to backtrack a move.

    Why the A/I dithers -- it's still a mystery. I am yet unable to distinguish between legitimate use of the backtracking tactic and mindless indecision. All I can do is to thwart backtracking moves in every case, for whatever the "reason".

    Might this handicap the A/I? Could be. Which is one reason why Prohibit A/I Backtracking is an optional choice. Toggle it on or off. Your call.

    How widespread is this dithering unit, backtracking move problem? Very widespread. In a series of automated test trials (run to ensure that this new prohibition doesn't maybe lock the A/I in an endless loop of indecision), here are the tested East Front scenarios with 10 or more attempted, and aborted, A/I backtrack moves:



    Robert@Berto /cygdrive/c/Games/Matrix Games/John Tiller's Campaign Series 2.00/East Front
    $ egrep -ic "backtrack move. aborted" Logs/*.scn_ai.log | awk -F: '$2>10' | tee ai_nobacktrack.dat
    Logs/02odessa.scn_ai.log:48
    Logs/04odessa.scn_ai.log:41
    Logs/16odessa.scn_ai.log:21
    Logs/Alushta.scn_ai.log:15
    Logs/Babirova.scn_ai.log:25
    Logs/Barvenkovo.scn_ai.log:110
    Logs/Bernau.scn_ai.log:18
    Logs/Blinov.scn_ai.log:12
    Logs/Bootcamp10.scn_ai.log:92
    Logs/Budy.scn_ai.log:43
    Logs/Bukrin.scn_ai.log:23
    Logs/Drazna.scn_ai.log:26
    Logs/Dubrovka.scn_ai.log:24
    Logs/Duderhof.scn_ai.log:18
    Logs/Fabulbattyan.scn_ai.log:28
    Logs/Gaffron.scn_ai.log:52
    Logs/Gorodok.scn_ai.log:18
    Logs/Hango.scn_ai.log:12
    Logs/Hlusk.scn_ai.log:61
    Logs/Izyum.scn_ai.log:16
    Logs/Kamenny.scn_ai.log:43
    Logs/Kirovograd.scn_ai.log:15
    Logs/Klepchevo.scn_ai.log:28
    Logs/Kokovkeeno.scn_ai.log:27
    Logs/Krasnogorodka.scn_ai.log:12
    Logs/Kremlin.scn_ai.log:266
    Logs/Kustrin.scn_ai.log:27
    Logs/Letornovski.scn_ai.log:32
    Logs/Leuenberg.scn_ai.log:16
    Logs/Lilienbach.scn_ai.log:41
    Logs/Lipki.scn_ai.log:19
    Logs/Lopyashna.scn_ai.log:80
    Logs/Losevo.scn_ai.log:51
    Logs/Lozovenka.scn_ai.log:37
    Logs/Lyutezh.scn_ai.log:16
    Logs/Maloyaroslavets.scn_ai.log:16
    Logs/Molodovka.scn_ai.log:85
    Logs/Moscow.scn_ai.log:14
    Logs/Naro-Fominsk.scn_ai.log:15
    Logs/Novgorod2.scn_ai.log:24
    Logs/Ostroye.scn_ai.log:17
    Logs/Pabianice.scn_ai.log:13
    Logs/Perekop.scn_ai.log:55
    Logs/Prusy.scn_ai.log:14
    Logs/Radomysl.scn_ai.log:13
    Logs/Rappards.scn_ai.log:14
    Logs/Raseiniai.scn_ai.log:26
    Logs/Sadki.scn_ai.log:11
    Logs/Schmergow.scn_ai.log:30
    Logs/Semenovka.scn_ai.log:22
    Logs/Semiluki.scn_ai.log:13
    Logs/Slonim.scn_ai.log:24
    Logs/Stalingrad.scn_ai.log:14
    Logs/Suomussalmi.scn_ai.log:14
    Logs/Szekesfehervar.scn_ai.log:58
    Logs/Tac.scn_ai.log:31
    Logs/Targul.scn_ai.log:37
    Logs/Teploye.scn_ai.log:19
    Logs/Titovka.scn_ai.log:45
    Logs/Tomarovka.scn_ai.log:15
    Logs/Venskyula.scn_ai.log:58
    Logs/Veseloye.scn_ai.log:20
    Logs/Warka.scn_ai.log:25
    Logs/Yakhroma2.scn_ai.log:49
    Logs/Zsambek.scn_ai.log:18

    Robert@Berto /cygdrive/c/Games/Matrix Games/John Tiller's Campaign Series 2.00/East Front
    $ ls -1 Logs/*ai.log | wc -l
    190



    Out of 190 scenarios tested (without any crashes or freezes, BTW), you can see that in 65 of them, about 1/3rd, the A/I attempts to backtrack move at least 10 times. In many other scenarios (not listed here), the problem still occurs, but not quite so often. In just a small minority of scenarios is there no sign of A/I backtracking whatsoever.

    The solution implemented is not quite perfect. It is still possible for the A/I to move a unit or stack from A to B, then back from B to A -- but not consecutively, and not in the same turn. If other units move in the interim, or if the turn rolls over, it is still possible for the A/I to backtrack move. In unusual circumstances, you might still occasionally see sporadic backtrack moves. But they are now rare to nonexistent.

    Fixing the dithering unit, backtracking move bug -- a major annoyance eliminated!

    Another A/I tweak: In 2.01, in the ai.ini parameters file, we have added the following highlighted moddable parameters:



    # AI parameters
    #
    # AI_hot_max // Maximum hot value.
    # AI_hot_trigger // Value which causes hex to be hot.
    # AI_move_trigger_AttackHigh // Move trigger for AttackHigh order type.
    # AI_move_trigger_AttackLow // Move trigger for AttackLow order type.
    # AI_move_trigger_NoOrder // Move trigger for NoOrder order type.
    # AI_move_trigger_DefendHigh // Move trigger for DefendHigh order type.
    # AI_move_trigger_DefendLow // Move trigger for DefendLow order type.
    # AI_bad_health // Bad health value.
    # AI_good_health // Good health value.
    # AI_unload // Unload distance.
    # AI_stand_off // Stand-off distance for IF units.
    # AI_smoke_prob // Probability of firing smoke.
    # AI_blind_fire_prob // Probability of blind fire.
    # AI_dig_prob // Probability of digging in.


    # AI_ constant defaults
    # AI_move_trigger_NoOrder is 0 for MW, 3 for CS
    #12 6 0 2 0 4 6 70 90 2 4 10 15 25

    # Allied _AI_ resets
    12 6 0 2 0 4 6 70 90 2 4 10 15 25

    # Axis _AI_ resets
    12 6 0 2 0 4 6 70 90 2 4 10 15 25



    (Note: At present, AI_blind_fire_prob is effectively unused. For now, it is just there as a placeholder.)

    We invite you to play around with the ai.ini parameters. Increase this, lower that. See what might happen.

    AI_smoke_prob & AI_dig_prob have also been factored into the A/I options: Allied or Axis Audacious or Cautious A/I, and Allied or Axis Shifting A/I. As you might expect, with Cautious set, the A/I will tend to fire smoke and dig in more. With Audacious set, the opposite is true: less digging in and hiding under cover of smoke.

    Not for JTCS 2.01 but for future releases and for new games in the series, I have implemented special tracing and logging mechanisms to help me observe how the A/I "thinks". Step by step, I'm finding ways to make the A/I better, or at least more moddable.

    In other news...

    We are now in the final stages of testing the 2.01 Update, paying special attention to the DCGs. We have devoted weeks of intensive effort to reviewing the DCG code and data. A number of issues and crash bugs have been fixed. In 2.01, DCGs should be in much better shape.

    When will we release the 2.01 Update? Soon, but not soon enough! In addition to the final testing, we are endeavoring to provide a fully up-to-date manual with this release. We have farmed out work on the Manual PDF to Matrix/Slitherine. When they will finish it is anybody's guess, hence we can't be quite precise about the 2.01 release date. We ask you to be patient a while longer.

    Reviewing, fixing, testing, much work going on behind the scenes...

    Until the next time...

    < Message edited by berto -- 4/26/2014 11:37:33 PM >


    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com
  • Post #: 1
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 12:33:47 PM   
    TJD

     

    Posts: 294
    Joined: 1/6/2008
    Status: offline
    Your skills are amazing, Berto. You're truly a brilliant guy. Thank you for your dedication to this game.

    Best,

    Tim

    (in reply to berto)
    Post #: 2
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 1:43:01 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Oh no, the dithering HQ is gone!



    _____________________________


    (in reply to TJD)
    Post #: 3
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 2:39:57 PM   
    Jafele


    Posts: 737
    Joined: 4/20/2011
    From: Seville (Spain)
    Status: offline
    I don´t know the reason why, but we need to look back in time to find high quality wargames, nowdays they are something really uncommon. One of the reasons could be there was a generation who lived the golden age of boardgames. For gamers and developers imagination and craftmanship was a priority over technology in those times. Something similar has happened with music since the 60s-70s till today IMO. I learned the lesson: Lack of technology doesn´t mean lack of quality, frequently lack of technology is replaced with loads of imagination and creativity.

    So, I think the process of resurrection of JTCS is priceless.

    Thanks for your efforts and dedication!


    (in reply to Crossroads)
    Post #: 4
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 3:10:03 PM   
    Josh

     

    Posts: 2576
    Joined: 5/9/2000
    From: Leeuwarden, Netherlands
    Status: offline
    What can I say Berto et al

    Still ... loved to see that AI movement... back and forth back and forth LOL

    (in reply to Jafele)
    Post #: 5
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 5:17:58 PM   
    berto


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

    quote:

    ORIGINAL: TJD

    Your skills are amazing, Berto. You're truly a brilliant guy. Thank you for your dedication to this game.

    My "brilliance" is open to question. I merely follow in the footsteps of John Tiller -- the truly "brilliant guy" for designing and coding the Campaign Series in the first instance. All around, quite an awesome achievement!

    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com

    (in reply to TJD)
    Post #: 6
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 5:26:31 PM   
    berto


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

    quote:

    ORIGINAL: Josh

    Still ... loved to see that AI movement... back and forth back and forth LOL

    And so you still can! Simply uncheck the "Prohibit A/I Backtracking". "Back and forth back and forth" restored as you've always loved it!

    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com

    (in reply to Josh)
    Post #: 7
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 5:36:14 PM   
    berto


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

    quote:

    ORIGINAL: Jafele

    I don´t know the reason why, but we need to look back in time to find high quality wargames, nowdays they are something really uncommon. One of the reasons could be there was a generation who lived the golden age of boardgames. For gamers and developers imagination and craftmanship was a priority over technology in those times. Something similar has happened with music since the 60s-70s till today IMO. I learned the lesson: Lack of technology doesn´t mean lack of quality, frequently lack of technology is replaced with loads of imagination and creativity.

    So, I think the process of resurrection of JTCS is priceless.

    IMHO, more time, effort, and resources should be devoted to resurrecting the best of the old classic games than to creating new ones. In several cases, even "just" spiffing up the UI and graphics will do.

    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com

    (in reply to Jafele)
    Post #: 8
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 5:59:25 PM   
    Jafele


    Posts: 737
    Joined: 4/20/2011
    From: Seville (Spain)
    Status: offline

    quote:

    ORIGINAL: berto

    IMHO, more time, effort, and resources should be devoted to resurrecting the best of the old classic games than to creating new ones.



    Absolutely. Classics should live forever between us, working on then to make it real is a wise decision that gamers around the world will never forget. Furthermore TOAW is another gem that future generations will have the opportunity to taste. Clearly a safe bet by Matrix.

    Thanks again.

    (in reply to berto)
    Post #: 9
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 6:39:48 PM   
    wings7


    Posts: 4591
    Joined: 8/11/2003
    From: Phoenix, Arizona
    Status: offline
    berto, thank you, we have all been waiting for a fix on this one!

    Patrick

    (in reply to Jafele)
    Post #: 10
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/22/2014 6:49:57 PM   
    berto


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

    Thanks to the Dev Team also -- especially Jason, Warhorse & Crossroads. They have been working hard on the data and the graphics and the testing, too.

    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com

    (in reply to wings7)
    Post #: 11
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/23/2014 9:28:54 AM   
    Big Ivan


    Posts: 1963
    Joined: 6/9/2008
    From: Mansfield, Ohio USA
    Status: offline
    Yiipee!!

    The dithering little A/I bridge troll has finally met his match!
    Look out you little pest, the Orkin man is here.

    Thanks Berto for this wonderful fix!!

    Big Ivan

    < Message edited by Big Ivan -- 4/24/2014 10:17:30 AM >

    (in reply to berto)
    Post #: 12
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/23/2014 2:17:53 PM   
    kool_kat


    Posts: 558
    Joined: 7/7/2008
    From: Clarksville, VA.
    Status: offline
    Gents:

    Excellent news!

    Eliminating the "AI Dithering Unit Phenomena" (AIDUP)will greatly improve the solo gaming experience with JTCS! Now, if you can substantially improve HAL's tactics, I might even be persuaded to try an AI battle!

    _____________________________

    Regards, - Mike

    "You have to learn the rules of the game. And then you have to play better than anyone else." - Albert Einstein

    (in reply to Big Ivan)
    Post #: 13
    RE: Coder Diary #19 -- A/I Dithering Unit, Backtracking... - 4/29/2014 12:32:43 AM   
    big dawg


    Posts: 311
    Joined: 2/5/2007
    From: Georgia, USA
    Status: offline
    Well done, sir!

    (in reply to kool_kat)
    Post #: 14
    Page:   [1]
    All Forums >> [Current Games From Matrix.] >> [World War II] >> John Tiller's Campaign Series >> Coder Diary #19 -- A/I Dithering Unit, Backtracking Move Bug -- Fixed! 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

    1.172