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

John Tiller's Campaign Series exemplifies tactical war-gaming at its finest by bringing you the entire collection of TalonSoft's award-winning campaign series. Containing TalonSoft's West Front, East Front, and Rising Sun platoon-level combat series, as well as all of the official add-ons and expansion packs, the Matrix Edition allows players to dictate the events of World War II from the tumultuous beginning to its climatic conclusion. We are working together with original programmer John Tiller to bring you this updated edition.

Moderators: Jason Petho, Peter Fisla, asiaticus, dogovich

Post Reply
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

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

Post by berto »


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.

Image

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...
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
TJD
Posts: 281
Joined: Sun Jan 06, 2008 2:04 pm

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

Post by TJD »

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

Best,

Tim
User avatar
Crossroads
Posts: 18167
Joined: Sun Jul 05, 2009 8:57 am

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

Post by Crossroads »

Oh no, the dithering HQ is gone! [:(]

[:D]
Visit us at: Campaign Series Legion
---
CS: Vietnam 1948-1967 < v2.00.03 Remastered Edition (May 20, 2025)
CS: Middle East 1948-1985 < v3.00.03 Remastered Edition (May 20, 2025)
User avatar
Jafele
Posts: 782
Joined: Wed Apr 20, 2011 7:27 am
Location: Seville (Spain)
Contact:

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

Post by 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. [:)]

Thanks for your efforts and dedication! [&o]

Las batallas contra las mujeres son las únicas que se ganan huyendo.

NAPOLEÓN BONAPARTE


Cuando el necio oye la verdad se carcajea, porque si no lo hiciera la verdad no sería la verdad.

LAO TSE
Josh
Posts: 2568
Joined: Tue May 09, 2000 8:00 am
Location: Leeuwarden, Netherlands

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

Post by Josh »

What can I say Berto et al [&o]

Still ... loved to see that AI movement... back and forth back and forth LOL
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

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

Post by berto »

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/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

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

Post by berto »

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/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

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

Post by berto »

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/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Jafele
Posts: 782
Joined: Wed Apr 20, 2011 7:27 am
Location: Seville (Spain)
Contact:

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

Post by Jafele »

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. [;)]
Las batallas contra las mujeres son las únicas que se ganan huyendo.

NAPOLEÓN BONAPARTE


Cuando el necio oye la verdad se carcajea, porque si no lo hiciera la verdad no sería la verdad.

LAO TSE
User avatar
wings7
Posts: 4586
Joined: Mon Aug 11, 2003 4:59 am
Location: Phoenix, Arizona

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

Post by wings7 »

berto, thank you, we have all been waiting for a fix on this one! [&o]

Patrick
Please come and join and befriend me at the great Steam portal! There are quite a few Matrix/Slitherine players on Steam! My member page: http://steamcommunity.com/profiles/76561197988402427
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

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

Post by berto »


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/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Big Ivan
Posts: 2032
Joined: Mon Jun 09, 2008 12:34 am
Location: Mansfield, Ohio USA

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

Post by Big Ivan »

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
Blitz call sign Big Ivan.
Assistant Forum Moderator for CS and CSx2 at The Blitz Wargaming Club.
User avatar
kool_kat
Posts: 558
Joined: Mon Jul 07, 2008 1:10 pm
Location: Clarksville, VA.

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

Post by kool_kat »

Gents: [8D]

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! [X(]
Regards, - Mike

"You have to learn the rules of the game. And then you have to play better than anyone else." - Albert Einstein
User avatar
big dawg
Posts: 201
Joined: Mon Feb 05, 2007 1:08 am
Location: Georgia, USA

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

Post by big dawg »

Well done, sir!
Post Reply

Return to “John Tiller's Campaign Series”