AGElint -- an AGE debugging toolkit

Post new mods and scenarios here.
Post Reply
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

2 more news:

- EvalEvent = xxx;>;13 doesn't work, contrary to EvalEvent = xxx;=>;13. The wiki is mentionning quite the reverse, but the Scriptreport is rejecting >...

- SetEvtOccur: MaxOccurs may be set to -999...Scriptreport again.


Line 163480: SelectFaction, selected: Southern Whites
Line 163482: Started processing event: evt_nam_test
Line 163482: This event is not yet referenced, base number of allowed occurences 0
Line 163484: Too many occurences for event evt_nam_test further processing aborted.
Line 163499: Finished processing event: evt_nam_test
Line 163499: ------------------------------
Line 163502: SelectFaction, selected: Southern Whites
Line 163504: Started processing event: evt_nam_test2
Line 163504: This event is not yet referenced, base number of allowed occurences 1
Line 163508: Min date evaluated: 1919/01/01 converted to turn 4057 current turn 4066 True
Line 163509: Max date evaluated: 1922/01/30 converted to turn 4131 current turn 4066 True
Line 163514: Entering triggered actions for event evt_nam_test2
Line 163519: Set Event Occurs command: evt_nam_test Max Occurences: -999 Current Occurences: 0
Line 163521: Finished processing event: evt_nam_test2
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

FY 1.06 errors

Post by berto »


I did a

[root@berto agelint]# ./chkaliases.pl +i +E -g rus 2>&1 > junk3

on RUS FY 1.06, and among other things (excluded in the 'egrep -v' below), this is what I found:

[root@berto agelint]# egrep -v "mdl_|uni_" junk3 | egrep "Grand\ Campaign.sct"
Events/Grand Campaign.sct:587: Tzarytsin not found
Events/Grand Campaign.sct:604: Tzarytsin not found
Events/Grand Campaign.sct:621: Tzarytsin not found
Events/Grand Campaign.sct:638: Tzarytsin not found
Events/Grand Campaign.sct:4597: Fergana not found
Events/Grand Campaign.sct:5569: Tzarytsin not found
Events/Grand Campaign.sct:16397: Area_Tzaritsyn not found
Events/Grand Campaign.sct:17178: Khakhib not found

For the 'Tzarytsin not found', in Grand Campaign.sct I see:

[root@berto Aliases]# egrep "Tzarytsin" ../Events/Grand\ Campaign.sct
Objectives = $Petrograd;10;$Moscow;20;$Warsaw;20;$Poznan;15;$Kiev;10;$Riga;10;$Kaunas;10;$Tallinn;10;$Smolensk;5;$Pskov;5;$Minsk;5;$Novgorod;5;$Odessa;2;$Kharkov;2;$Rostov;2;$Samara;2;$Kazan;2;$Tzarytsin;2;$Tver;2;$Tula;1;$Sevastopol;2;$Ivanovo;1;$Voronezh;1;$Kursk;1;
Objectives = $Petrograd;10;$Moscow;20;$Warsaw;20;$Poznan;15;$Kiev;10;$Riga;10;$Kaunas;10;$Tallinn;10;$Smolensk;5;$Pskov;5;$Minsk;5;$Novgorod;5;$Odessa;2;$Kharkov;2;$Rostov;2;$Samara;2;$Kazan;2;$Tzarytsin;2;$Tver;2;$Tula;1;$Sevastopol;2;$Ivanovo;1;$Voronezh;1;$Kursk;1;
Objectives = $Petrograd;10;$Moscow;20;$Warsaw;20;$Poznan;15;$Kiev;10;$Riga;10;$Kaunas;10;$Tallinn;10;$Smolensk;5;$Pskov;5;$Minsk;5;$Novgorod;5;$Odessa;2;$Kharkov;2;$Rostov;2;$Samara;2;$Kazan;2;$Tzarytsin;2;$Tver;2;$Tula;1;$Sevastopol;2;$Ivanovo;1;$Voronezh;1;$Kursk;1;
Objectives = $Petrograd;10;$Moscow;20;$Warsaw;20;$Poznan;15;$Kiev;10;$Riga;10;$Kaunas;10;$Tallinn;10;$Smolensk;5;$Pskov;5;$Minsk;5;$Novgorod;5;$Odessa;2;$Kharkov;2;$Rostov;2;$Samara;2;$Kazan;2;$Tzarytsin;2;$Tver;2;$Tula;1;$Sevastopol;2;$Ivanovo;1;$Voronezh;1;$Kursk;1;
Objectives = $Petrograd;10;$Moscow;20;$Warsaw;20;$Poznan;15;$Kiev;10;$Riga;10;$Kaunas;10;$Tallinn;10;$Smolensk;5;$Pskov;5;$Minsk;5;$Novgorod;5;$Odessa;2;$Kharkov;2;$Rostov;2;$Samara;2;$Kazan;2;$Tzarytsin;2;$Tver;2;$Tula;1;$Sevastopol;2;$Ivanovo;1;$Voronezh;1;$Kursk;1;

And in Aliases *.ini I see:

[root@berto Aliases]# egrep -i tzar *.ini
MetaAreas_Aliases.ini:$EventArea_Close_to_Tzaritsyn = 139
MetaAreas_Aliases.ini:$Tzaritsyn_check = 164
Regions.ini:$Tzaritsyn = 661

Note the differences in spelling: In the Grand Campaign.sct file, it is 'Tzarytsin', but in Aliases.ini it is 'Tzaritsyn' -- i.e., see how the 'i' and 'y' were inverted.

For 'Area_Tzaritsyn not found':

[root@berto Aliases]# egrep "Area_Tzaritsyn" ../Events/Grand\ Campaign.sct
SelectRegInArea = $Area_Tzaritsyn

I don't see the exactly corresponding Area_*:

[root@berto Aliases]# egrep -i tzar *.ini
MetaAreas_Aliases.ini:$EventArea_Close_to_Tzaritsyn = 139
MetaAreas_Aliases.ini:$Tzaritsyn_check = 164
Regions.ini:$Tzaritsyn = 661

For Fergana & Khakhib, I have:

[root@berto Aliases]# egrep -i "fergana|khakhib" ../Events/Grand\ Campaign.sct
AddToRegList = $Fergana
AddToRegList = $Vladikavkaz;$Argun;$Nalchik;$Khakhib

[root@berto Aliases]# egrep -i "fergana|khakhib" *.ini
Regions.ini:// $Fergana = $Olmalik

That is, no alias spec for $Fergana (commented out in Regions.ini, no?), and no mention at all of $Khakhib in any Aliases *.ini file.

(Forgive me if I am mistaken in any of this. I just want to compare notes with you, to ensure that we see eye to eye, and to validate my own code.)

But aside from these few possible remaining errors, congratulations on -- for the most part -- cleaning up all "bad" alias refs in FY Grand\ Campaign.sct. (There are still bad refs in other files, as I'm sure you're well aware.)
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
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: FY 1.06 errors

Post by Chilperic »

Fixed in the new version I've uploaded toniht. Thanks. I was sure to have fixed them, but I guess I forgot to save the GC file [8|].

BTW, the Anarchist bug was created by an event which didn't worked, in spite of correct syntax. I've found how to change the event to get the same result, but I'm going to look deeper at this later.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

AGElint future focus

Post by berto »


As of now, AGElint supports all current AGEOD AGE system games. You can use it just as well to debug one game as another.

Going forward, AGElint development will focus on AGEOD games in this order of priority (highest to lowest):
  • RUS, Revolution under Siege
  • ACW, American Civil War
  • ROP, Rise of Prussia
  • WIA, Wars in America
  • NCP, Napoleon's Campaigns
  • PON, Pride of Nations
This ordering is based on:
  • ongoing, active modding
  • ongoing, active, diligent fixing of bugs en masse
  • ongoing, active, useful, constructive player and modder feedback
  • player activity
  • forum activity
  • closest proximity to bug-free "perfection"
  • the AGElint developer's areas of personal player interest
Note that, in the shared AGE engine, most commands and data are common to all games. So work and improvements focusing on the top-ranked games (RUS, ACW & ROP) will spill over as well to the other, lower-ranked games (WIA, NCP, PON). But commands and data and nuances specific to the lower-ranked games -- especially PON, with its many, many new commands and data extensions -- will get less, if any attention. Eventually, perhaps, but not in the near term. In the near term, attention will be directed to where the action is.
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
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint future focus

Post by Chilperic »

I've the same priority order [:)][:D]. Not the place to discuss here, but i've once again left any idea to mod PON, for reason tied to the AI behaviour in economy field.

I should use agelint this next days on the offical DNO scenario and on the offical AACW version, then oon my current set for SVF.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: AGElint future focus

Post by berto »


I should be releasing AGElint 1.0 by Friday or Saturday. Not much further work on the parser, but tying up lots of loose ends. Work on the parser etc. will proceed in the coming weeks.
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: AGElint TODO

Post by berto »


AGElint TODO

Things still to do in agelint:
  • In the txt.y parser, reduce genericalness, increase specificity.
  • Deepen and extend the txt.y parser, refining the syntax checks, but also adding semantic and logical checks.
  • Integrate SelectFaction & SelectRegion into the semantic and logical checks.
  • In the txt.y parser, add more CHKINT() checks.
  • Better pinpoint the exact line number of reported error.
  • Improve parser 'error' recovery, for detecting all errors etc. in a given data file.
  • In names, more generally solve the problem of "foreign" (non-English, non-ASCII) characters.
  • Generally solve the problem of files not ending in EOL (end-of-line, e.g., CR/LF).
  • Present a pleasing display of blank lines for every possible combination of agelint command arguments.
  • Better pinpoint the exact DB sources file of reported error.

Things still to do in the *.pl and other (Perl & Bash) scripts:
  • Add automated setting of agelintroot & gameroot in all scripts, not just the chk*.pl ones (by, for example, universal reference to agelint.conf).
  • Check for duplication of UIDs/aliases.
  • Check inter-regional linkages.
  • Trim, or better categorize, reported "bad" aliases, localizations, graphics files, etc.

Other things still to do:
  • Extend the 'make check' to encompass still more regression tests.
  • Develop a functioning 'make install'.
  • Add still more examples to the USAGE file.
  • Host a web services site, where users can upload and check game data files without their having to install and run AGElint locally.
  • Host on the web the Kwd (AGE keyword usage) database and support programs.
  • In general, reduce false positives to a bare minimum.
  • Fix bugs!

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:

AGElint first "official" 1.00 release

Post by berto »


The first "official" AGElint version 1.00 has been posted in message #1 of this "AGElint -- an AGE debugging toolkit" thread.

No profound changes in version 1.00. This release "just" ties up lots of loose ends. Lays the basis for future development and progress.

The first "release" of AGElint, in late October 2011, was Not Ready For Prime Time, was essentially only fit for the developer's personal use. Subsequent releases in early December 2011 were tidied up, and usable, but with not a few rough edges. This AGElint version 1.00 is the first "polished" release. Not perfect by any means, but fully usable, and (together with the forum posts here) pretty well documented.

Here are the changes in AGElint 1.00:

Changes from the first public release, on 20111209, to the first "official" release, AGElint_1.00, on 20111230:
  • In agelint.conf, added acwdir, ncpdir, pondir, ropdir, rusdir, wiadir.
  • For agelint.conf, priority default location changed from /usr/local/etc to /usr/local/games/etc
  • Added conf.pl, for agelint.conf processing by Perl scripts.
  • In agelint.c, cleaned up agelintroot & gameroot code and logic.
  • Fixed broken 'make check'.
  • Substituted new, vetted test files in the CHK directory tree (and revised the squelches.chk.pl file).
  • In agelint, chk*.pl, common.pl, cmd.[ly], etc., cleaned up command-line arguments, and fixed all Usage: statements.
  • In chkaliases.pl, filtered out some false positives.
  • In txt.[ly], fixed several bugs & false positives.
  • Added grprpt.pl & rmgameroot scripts to distribution.
  • Emptied FIX directory tree of useless junk files.
  • Added USAGE, CHANGES & TODO files to distribution.
  • Other minor code & doc fixes/changes.

Nothing earth shattering in that list, mostly technical stuff.

The most important change? It is fixing the 'make check' regression tests. With each new version, with each new batch of extensions, improvements, and bug fixes, we want to ensure that no parts of the code regress, "fix" what ain't broken, (re)introduce (new) bugs. Two steps forward, one step back? No, we want to ensure forward steps only. Regression testing is essential to that.

With the 'make check' restored to working functionality, that lays the basis for future progress. For example, as I add and refine parser rules (and tweak the lexer pattern matches), I want to 'make check' every new change. In lex (lexer) and yacc (parser) programming, it's easy to blow things up! The 'make check' regression tests should help keep a lid on it.

The frequent use of 'make check', combined with a newly decided prioritization of RUS, ACW & ROP (see post #84 above), should speed up AGElint development. The more focused I am, and the more I do this, the faster it goes.

I will have more to say about the AGElint 'make check' (also use of the agelint & chklint.pl -S error "squelch" mechanism) in future posts.

But as a user, you really don't need to concern yourself with 'make check', regression testing, etc. Just use AGElint.

And enjoy!
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
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint first "official" 1.00 release

Post by Chilperic »

I will use the 1.00 next weeks both on FY and AACW. Thanks [8D]
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint first "official" 1.00 release

Post by Chilperic »

Another possible false positive:

ChgUnitPoolInfos = $uni_DON_Amt1d;-999;75

The command accepts values from -999 to 999 for variation of force pool
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint first "official" 1.00 release

Post by Chilperic »

and 2 others:

ERROR: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Events/RUS All Scenarios.sct, at (or before) line 2287: syntax error: #|# (0x7c), #|#

in event evt_nam_Allied_involment_level:

2284 MaxDate = 1921/12/30
2285
2286 Actions
2287> PopUpText = str_nam_Allied_Involv_01|NULL|2|Allied_Involv_08|Event-img_Renforts_CMN_BlackSeaAllied|NULL
2288 EndEvent


This command accepts | rather than ; as the official tutorial files show it.

The second false positive is the lack of conditions in the evens in the scripts file (.ini): theses files serving for creating scenarios are made with events command without needing conditions).

Scripts/Script_T1.ini, Fri Oct 1 2010 11:26:12

WARNING: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Scripts/Script_T1.ini, at (or before) line 1130: no Conditions section

1127 Replacement = FIN;$famMilitia;3
1128 NULL = NULL
1129
1130> EndEvent

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

RE: AGElint first "official" 1.00 release

Post by berto »

ORIGINAL: Chliperic

Another possible false positive:

ChgUnitPoolInfos = $uni_DON_Amt1d;-999;75

The command accepts values from -999 to 999 for variation of force pool
Interesting. Indeed, the AGEWiki page

http://www.ageod.net/agewiki/ChgUnitPoolInfos

says:
<variation of Force Pool>

Integer (-999 to 999)

Changes the pool value by this amount
Currently, txt.y has:

Code: Select all

chgunitpoolinfos: _CHGUNITPOOLINFOS eq val sc intpos
                 | _CHGUNITPOOLINFOS eq val sc intpos sc intpos
                 {
                 /*                                                              
                 http://www.ageod.net/agewiki/ChgUnitPoolInfos                   
                 Syntax:  ChgUnitPoolInfos = <UnitDef>|<variation of Force Pool>|<AI Pool Ratio>       .                                                        
                 */
                 }
                 ;

I must change that to

Code: Select all

 chgunitpoolinfos: _CHGUNITPOOLINFOS eq val sc int sc pct

(and possibly also add a CHKINT() to ensure that the second argument, the int, falls between -999 and 999). Note the removal of the first alternative

Code: Select all

                   _CHGUNITPOOLINFOS eq val sc intpos

The AGEWiki page clearly requires three arguments for the ChgUnitPoolInfos command. Why do I list the two-argument case?

It's because in actual usage across all AGEOD games, I saw the following exceptions:

[root@telemann agelint]# ./kwddat ChgUnitPoolInfos | awk -F\; 'NF!=3'
1 ChgUnitPoolInfos = $uni_GBR_Inf_1850C_Bde;2
1 ChgUnitPoolInfos = $uni_GBR_Inf_1870_Ghurkas_Rgt1;1
1 ChgUnitPoolInfos = $uni_GBR_Med_Med1;2
1 ChgUnitPoolInfos = $uni_GBR_Mix_1850_Bde;1
1 ChgUnitPoolInfos = $uni_GBR_Sig_Sig1850;3
1 ChgUnitPoolInfos = $uni_IND_Cav_1850_Bde;1
1 ChgUnitPoolInfos = $uni_IND_Inf_1850C_Bde;2
1 ChgUnitPoolInfos = $uni_IND_Mix_1850_Bde;2
1 ChgUnitPoolInfos = $uni_IND_Sup_Sup1;5
1 ChgUnitPoolInfos = $uni_MUG_Art_1840;2
1 ChgUnitPoolInfos = $uni_MUG_Cav_1850_Bde;5
1 ChgUnitPoolInfos = $uni_MUG_FortArt_1840;5
1 ChgUnitPoolInfos = $uni_MUG_Inf_1840C_Bde;15
1 ChgUnitPoolInfos = $uni_MUG_Mix_1840_Bde;10
1 ChgUnitPoolInfos = $uni_MUG_Sup_Sup1;10
1 ChgUnitPoolInfos = $uni_WH3_Mil1;0

When first coding txt.y, whenever I saw many usage counterexamples (where "many" is loosely defined), I inferred that the counterexamples might be acceptable alternative usages. It could be that
  • The AGE code had been extended to allow different alternative usages (in the ChgUnitPoolInfos example, allowing two arguments instead of three), and the AGEWiki docs had not been updated to reflect the extension.
  • The AGEWiki doc is just flat out wrong; the actual usages are right.
  • The AGE code recovers from the syntax errors gracefully, and defaults to some sensible behavior (in the ChgUnitPoolInfos, defaulting say to an assumed value of 100 (percent) for the missing third argument).
  • The AGE 3.0 game, PON, might be extended to support alternative usages (but the AGEWiki was not yet edited to reflect that).
  • Most peculiarly, when I saw usage exceptions in RUS -- there were more discovered in RUS than in any other game -- at the time I thought that the agreement with SEPRUS was that Pocus had farmed out the AGE coding to a SEPRUS programmer, thus that the RUS AGE engine code had forked from the mainline, standard AGEOD AGE (2.0) code.
I had learned from experience that directing explicit questions to the devs, requesting for clarification of this or that technical point directly, seldom got answered. (We can assume that the insiders were (a) too busy (quite likely) and/or (b) for whatever reason didn't care to respond.) I was more or less on my own to deal with the ambiguities I found, in some cases just guess, in many cases code the parser "loosely" in order to reduce the "false positivess" -- not always really "false"!

In the above two-argument ChgUnitPoolInfos cases, if I had not coded the syntax rule exception, if I had gone strictly with the overwhelming usage consensus -- use three arguments (and had scrutinized the AGEWiki page; didn't always have time for that; or if I did, I didn't always trust its accuracy for reasons stated above) -- if I had omitted the two-argument parser case, then those lines would have been reported as "syntax error ...".

Then afterwards complained about as "false positives"?

Do you begin to understand how, if the people you are working with complain about false positives too much, I over-react by coding the parser too loosely, by sanctioning in-fact erroneous usage cases, cases of "true positives"?

What's worse? (a) a false positive, or (b) an unreported true positive (actual error)?

In the AGElint README file, I write:
When deciding the txt.y parser rules, I am guided primarily by the AGE Wiki documentation (where it exists, which is not always), and secondarily by actual usage as demonstrated by the game data files. They are not always in agreement! And there is much ambiguity and nuance. Bear that in mind when reviewing/critiquing the txt.y parser specification.
Going forward, and as I review and refine the txt.y parser, I will have to base "truth" on
  • The AGEWiki pages.
  • Actual usage (across all games).
  • Experienced dev/modder feedback (now possible, since I at least have your attention and active cooperation).
  • Actual experimentation (don't just speculate; "look in the horse's mouth!") (but I really don't have time for it).
in that order of authority.

Another long-winded response, I know. I would apologize for all the blah blah, but if we are to take AGElint further, we need to discuss where we are going with it. And the discussions need to consider nuance and complexities, hence a lot of blah blah.

Anyway, thanks for pointing out the error. I will revisit and revise the ChgUnitPoolInfos (and many other) parser rules in the next and all future AGElint releases.
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: AGElint first "official" 1.00 release

Post by berto »

ORIGINAL: Chliperic

and 2 others:

ERROR: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Events/RUS All Scenarios.sct, at (or before) line 2287: syntax error: #|# (0x7c), #|#

in event evt_nam_Allied_involment_level:

2284 MaxDate = 1921/12/30
2285
2286 Actions
2287> PopUpText = str_nam_Allied_Involv_01|NULL|2|Allied_Involv_08|Event-img_Renforts_CMN_BlackSeaAllied|NULL
2288 EndEvent


This command accepts | rather than ; as the official tutorial files show it.
It should be easy to code in allowance for that alternative usage.
The second false positive is the lack of conditions in the evens in the scripts file (.ini): theses files serving for creating scenarios are made with events command without needing conditions).

Scripts/Script_T1.ini, Fri Oct 1 2010 11:26:12

WARNING: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Scripts/Script_T1.ini, at (or before) line 1130: no Conditions section

1127 Replacement = FIN;$famMilitia;3
1128 NULL = NULL
1129
1130> EndEvent
It should be easy to code an adjustment for that, too.

This is great! Keep 'em coming! [8D]
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:

AGElint: still more bug types: SelectRegion/SelectFaction

Post by berto »


In an earlier post, I had written:
At present, AGElint is more than a beginning, but far from an ending. The dream is to code a vast set of utilities and capabilities to check all manner of AGEOD bugs/errors/glitches/anomalies. In agelint itself, beyond the syntax checking already in place, there are the beginnings of semantic and logic checking. Outside of agelint, there are many more QA checks we can apply to the AGE game data files.
On a hunch, I suspected that there are "bad" alias refs in SelectRegion (also SelectFaction) statements. Turns out my hunch was correct. [:)]

Here is a Perl script, chkSelectRegion.pl, for checking data file 'SelectRegion =' statements:

Code: Select all

#!/usr/bin/perl                                                                 
 
 $DEBUG = 0;
 
 $RUSDIR = "/media/KINGSTON/Games/AGEOD/Revolution under Siege FY/RUS";
 
 open(REGIONS, "$RUSDIR/Aliases/Regions.ini");
 while(<REGIONS>) {
     chomp;
     $line = $_;
     next if ($line =~ /^\s*#/);
     next if ($line =~ /^\s*\/\//);
     if ($line =~ /^\s*(\$[^=]+[a-zA-Z0-9])\s*=/) {
         $reglc = lc($1);
         print "#$reglc#\n" if $DEBUG;
         $regions{$reglc}++;
     }
 }
 close(REGIONS);

Code: Select all

 open(FIND, "find \"$RUSDIR\" -exec egrep \"SelectRegion\" {} \\; \| awk -F= '{print \$2}' \| sort \| uniq |");
 while(<FIND>) {
     chomp;
     print "line #$_#\n" if $DEBUG;
     next unless (/^\s*(\$[-\. a-zA-Z0-9]*[a-zA-Z0-9])/);
     $reg = $1;
     $reglc = lc($reg);
     print "reg  #$reglc#\n" if $DEBUG;
     next if ($reglc =~ /(playboard)/);
     if (! $regions{$reglc}) {
 	print "$reg not found\n";
     }
 }
 close(FIND);
 
 exit 0;

(As always, please excuse the extra blank lines. The Matrix Forum code tags are quite broken! [:@])

Here is a sample program run, on RUS/FY:

[root@telemann agelint]# ./chkSelectRegion.pl 2>&1 | sort | uniq
$Almetevsk not found
$Baltic Channel not found
$Bay of Samsun not found
$Black Sea not found
$Cape Civa not found
$Cape Ince not found
$Fergana not found
$FRA not found
$Gulf of Trapezus not found
$Hoburgen not found
$Huiliaipole not found
$Kalmar Sund not found
$Keuruu not found
$North Baltic Sea not found
$Osel not found
$Ost See not found
$Rustavi not found
$Savo not found
$Shchuche Ozero not found
$South Baltic Sea not found
$Southeastern Black Sea not found
$SouthWestern Black Sea not found
$Swedish Channel not found
$Verkhovie not found

Not consolidating duplicates, counting distinct separate error instances:

[root@telemann agelint]# ./chkSelectRegion.pl 2>&1 | wc -l
32

The chkSelectRegion.pl script is subject to further refinement, including especially generalizing across all AGEOD games, and importantly pinpointing the exact file and line number of each error. There might very well be some false positives here. (If so, pardon me, Chliperic!) But as is, in its not quite finished state, chkSelectRegion.pl demonstrates my point.

There are, more or less, 32 "bad" region alias refs in the RUS(/FY) game data files alone.

Remember: AGElint is being designed to function across all six (current) AGEOD AGE games. How many more bug instances of just this one type are there lurking about in the other AGEOD games?

Verifying a small sample of these bad alias refs:

[root@telemann agelint]# egrep -i "baltic channel|huiliaipole|shchuche|verkhovie" /media/KINGSTON/Games/AGEOD/Revolution\ under\ Siege\ FY/RUS/Aliases/Regions.ini
// $Verkhovie = $Verkhove
// $Shchuche Ozero = $Birsk

So, for those four samples, no (uncommented) matches in the Regions.ini file.

Some possible "good" alias refs, or added info:

[root@telemann agelint]# egrep -i "baltic|huilia|chuche|verkhov" /media/KINGSTON/Games/AGEOD/Revolution\ under\ Siege\ FY/RUS/Aliases/Regions.ini
// $Verkhove = $Shalimovo
// $Verkhovie = $Verkhove
// $Shchuche Ozero = $Birsk
// New names for Volga-Baltic Canals created
$Verkhove = 461
$Baltic Sea = 802

Verifying the SelectRegion instance mistakenly referencing a faction tag:

[root@telemann agelint]# find /media/KINGSTON/Games/AGEOD/Revolution\ under\ Siege\ FY/RUS -exec egrep "SelectRegion" {} \; | egrep "FRA"
SelectRegion = $FRA

In like manner, I can and eventually will write a script to investigate bad SelectFaction references.

chkSelectRegion.pl, and its soon-to-be cousin chkSelectFaction.pl, is not part of the current AGElint distribution, but it soon will be. The current AGElint distribution (version 1.00) doesn't yet detect these SelectRegion/SelectFaction bugs. (Remember my earlier comments about how I have "swept under the rug" the SelectRegion/SelectFaction complications.)

These are newly found bugs, and new bug types.

Quoting myself again:
There's still much more untapped potential, much more to be done...
Indeed, indeed ...
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
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint: still more bug types: SelectRegion/SelectFaction

Post by Chilperic »

Historically, the first command was:

ChangeUnitPool = UnitDefUID; Value

Then has been added ChgUnitPoolInfos adding as third parameter the AI ratio for building an unit.

So

[root@telemann agelint]# ./kwddat ChgUnitPoolInfos | awk -F\; 'NF!=3'
1 ChgUnitPoolInfos = $uni_GBR_Inf_1850C_Bde;2
1 ChgUnitPoolInfos = $uni_GBR_Inf_1870_Ghurkas_Rgt1;1
1 ChgUnitPoolInfos = $uni_GBR_Med_Med1;2
1 ChgUnitPoolInfos = $uni_GBR_Mix_1850_Bde;1
1 ChgUnitPoolInfos = $uni_GBR_Sig_Sig1850;3
1 ChgUnitPoolInfos = $uni_IND_Cav_1850_Bde;1
1 ChgUnitPoolInfos = $uni_IND_Inf_1850C_Bde;2
1 ChgUnitPoolInfos = $uni_IND_Mix_1850_Bde;2
1 ChgUnitPoolInfos = $uni_IND_Sup_Sup1;5
1 ChgUnitPoolInfos = $uni_MUG_Art_1840;2
1 ChgUnitPoolInfos = $uni_MUG_Cav_1850_Bde;5
1 ChgUnitPoolInfos = $uni_MUG_FortArt_1840;5
1 ChgUnitPoolInfos = $uni_MUG_Inf_1840C_Bde;15
1 ChgUnitPoolInfos = $uni_MUG_Mix_1840_Bde;10
1 ChgUnitPoolInfos = $uni_MUG_Sup_Sup1;10
1 ChgUnitPoolInfos = $uni_WH3_Mil1;0


is just a serie of bugs by using the second command with the parameters of the first command ChangeUnitPool.
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint: still more bug types: SelectRegion/SelectFaction

Post by Chilperic »

[root@telemann agelint]# ./chkSelectRegion.pl 2>&1 | sort | uniq
$Almetevsk not found
$Baltic Channel not found
$Bay of Samsun not found
$Black Sea not found
$Cape Civa not found
$Cape Ince not found
$Fergana not found
$FRA not found
$Gulf of Trapezus not found
$Hoburgen not found
$Huiliaipole not found
$Kalmar Sund not found
$Keuruu not found
$North Baltic Sea not found
$Osel not found
$Ost See not found
$Rustavi not found
$Savo not found
$Shchuche Ozero not found
$South Baltic Sea not found
$Southeastern Black Sea not found
$SouthWestern Black Sea not found
$Swedish Channel not found
$Verkhovie not found

Don't forget FY is for now only the modding of the Grand Campaign. This one doesn't use all the files of RUS;

For example, I've noticed Drang Nach Osten files have a lot of errors. However, as There aren't used in FY, I haven't fixed them. Yet. [:D] So these mispelled aliases in files may result of event files unused in the FY Grand Campaign, which by the contrary, is now 99.99% error free ( I'm yet inspecting 2 reports which may be false positive).

User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: AGElint: still more bug types: SelectRegion/SelectFaction

Post by Chilperic »

SelectRegion = $FRA is rather a wrong name for a region; There was a same type of error for Great Britain. Fixed BTW [:)]
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: AGElint: still more bug types: SelectRegion/SelectFaction

Post by berto »

ORIGINAL: Chliperic

Don't forget FY is for now only the modding of the Grand Campaign. This one doesn't use all the files of RUS;

For example, I've noticed Drang Nach Osten files have a lot of errors. However, as There aren't used in FY, I haven't fixed them. Yet. [:D] So these mispelled aliases in files may result of event files unused in the FY Grand Campaign, which by the contrary, is now 99.99% error free ( I'm yet inspecting 2 reports which may be false positive).
I don't mean to suggest that everything I report is detected in FY. If I post results here, they might very well reflect data files and bugs in the "official" AGEOD distributions, not those in FY.

Soon, I will describe in detail the various AGElint exclude mechanisms, to filter out the non-pertinent stuff.

I discovered today that my RUS/FY USB installation, the one I use for my analysis and development work, dates back to 12/25! I've been diligently updating my actual, for-game-play installation on hard disk with each new FY release. I had just forgotten to update my USB install as well. [>:] I will have to be more careful going forward to keep both installations up-to-date, and in sync.

Still one more reason why I need to stay out of the reporting business, and just be a tool maker!

After the New Year revels, work on AGElint will resume tomorrow, Tuesday. In particular, it will be full steam ahead on refining and extending the txt.y parser.
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: AGElint: still more bug types: SelectRegion/SelectFaction

Post by berto »


I have coded two new bug checking scripts -- chkselfac.pl & chkselreg.pl -- for detecting "bad" alias refs in 'SelectFaction =' & 'SelectRegion =' statements in the AGEOD game data files.

(Actually, there is a single new script -- chksel.pl -- and chkselfac.pl & chkselrel.pl are links to the chksel.pl script. chksel.pl adapts to the appropriate behavior depending on the program name you invoke.)

For a discussion of Select{Faction,Region} bugs, see post #94 above.

Here is some chkselreg.pl output, basing off the "official" RUS 1.04 data files:

[root@telemann agelint]# ./chkselreg.pl -g rus 2>&1 | ./rmgameroot.pl -g rus
Includes/NoCitiesTest.inc:3351: Verkhovie not found
Includes/NoCitiesTest.inc:5540: Rustavi not found
Includes/NoCitiesTest.inc:5788: South Baltic Sea not found
Includes/NoCitiesTest.inc:5791: Hoburgen not found
Includes/NoCitiesTest.inc:5794: Ost See not found
Includes/NoCitiesTest.inc:5800: North Baltic Sea not found
Includes/NoCitiesTest.inc:5842: Osel not found
Includes/NoCitiesTest.inc:5845: Baltic Channel not found
Includes/NoCitiesTest.inc:5848: Swedish Channel not found
Includes/NoCitiesTest.inc:5950: Gulf of Trapezus not found
Includes/NoCitiesTest.inc:5953: Cape Civa not found
Includes/NoCitiesTest.inc:5956: Bay of Samsun not found
Includes/NoCitiesTest.inc:5959: Cape Ince not found
Includes/NoCitiesTest.inc:5971: SouthWestern Black Sea not found
Includes/NoCitiesTest.inc:6007: Southeastern Black Sea not found
Includes/NoCitiesTest.inc:6290: Savo not found
Includes/NoCitiesTest.inc:7346: Almetevsk not found
Includes/NoCitiesTest.inc:7861: Shchuche Ozero not found
Includes/NoCitiesTest.inc:9464: Fergana not found
Includes/NoCitiesTest.inc:10996: Kalmar Sund not found
Includes/NoCitiesTest.inc:12076: Keuruu not found
Events/RUS F6 Options Various.sct:2981: Vladivostock not found

Yes, indeed, all but one of the errors are in a test file, so have no practical importance. (In "official" RUS. But what about other AGEOD games? It remains to be seen.)

(When basing off the Fatal Years data files, I am happy to report that the last bug, the bad 'Vladivostock' reference, has been fixed in FY.)

(Note the use of rmgameroot.pl, which replaces rmgameroot in all future AGElint distributions.)

Here is some chkselfac.pl output, basing off the "official" RUS 1.04 data files, and just reporting errors in Grand Campaign.sct:

[root@telemann agelint]# ./chkselfac.pl -g rus 2>&1 | ./rmgameroot.pl -g rus | egrep -i "grand campaign" | head
Events/Grand Campaign.sct:6: CMN not found
Events/Grand Campaign.sct:8: CMN not found
Events/Grand Campaign.sct:19: CMN not found
Events/Grand Campaign.sct:45: CMN not found
Events/Grand Campaign.sct:48: CMN not found
Events/Grand Campaign.sct:71: CMN not found
Events/Grand Campaign.sct:74: CMN not found
Events/Grand Campaign.sct:397: CMN not found
Events/Grand Campaign.sct:399: CMN not found
Events/Grand Campaign.sct:455: CMN not found
[many more like this follow ...]

There are so many "bad" 'SelectFaction = $CMN' statements that I have shown only the first ten of a very long list.

So many ... Is CMN ("common"?) some default pseudo faction that I don't know about and that applies to all factions? It might very well be that these are false positives also (and if so, are easily excluded) ...

edit> Indeed, I have been informed that CMN is new to RUS, and applies to all factions. So, exclude this from the chkselfac.pl script I will ... After excluding CMN false positives, I am also happy to report that there are no bad faction alias refs in 'SelectFaction =' statements in either "official" or FY RUS. (We'll see about the other AGEOD games.)

Work on refining the txt.y parser is going well. I foresee posting the next AGElint release (including these new chksel*.pl scripts) perhaps by January 15. Stay tuned.
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:

AGElint: AGEWiki docs vs. actual usage

Post by berto »

ORIGINAL: berto

When first coding txt.y, whenever I saw many usage counterexamples (where "many" is loosely defined), I inferred that the counterexamples might be acceptable alternative usages. It could be that
  • The AGEWiki doc is just flat out wrong; the actual usages are right.
...

In the AGElint README file, I write:
When deciding the txt.y parser rules, I am guided primarily by the AGE Wiki documentation (where it exists, which is not always), and secondarily by actual usage as demonstrated by the game data files. They are not always in agreement! And there is much ambiguity and nuance. Bear that in mind when reviewing/critiquing the txt.y parser specification.
Going forward, and as I review and refine the txt.y parser, I will have to base "truth" on
  • The AGEWiki pages.
  • Actual usage (across all games).
  • Experienced dev/modder feedback (now possible, since I at least have your attention and active cooperation).
  • Actual experimentation (don't just speculate; "look in the horse's mouth!") (but I really don't have time for it).
in that order of authority.
Here are three good examples (there are others) of where the AGEWiki pages appear to be "flat out wrong":

ChgPopContent
ChgPopEducation
ChgPopMilitancy

In any case, the AGEWiki says nothing about using the ALL parameter. But the actual usage evidence suggests otherwise. Here for example is the actual usage of ChgPopEducation (used in PON only):

[root@berto agelint]# ./kwddat.pl ChgPopEducation pon
43 ChgPopEducation = 15
2 ChgPopEducation = 30
8 ChgPopEducationEx = 0;1;2;3;5;5;ALL
14 ChgPopEducationEx = 0;1;3;3;5;5;ALL
8 ChgPopEducationEx = 0;1;3;7;7;7;ALL
9 ChgPopEducationEx = 0;1;5;3;2;0;ALL
8 ChgPopEducationEx = 0;5;7;10;5;5;ALL

I encounter such disagreement between the AGEWiki docs and actual usage not infrequently. These here are unusual cases where actual usage trumps the AGEWiki docs.

So here is how I code ChgPopEducation[Ex] in the txt.y parser:

Code: Select all

chgpopeducation: _CHGPOPEDUCATION eq intpos
                 {
                 /*                                                              
                 http://www.ageod.net/agewiki/ChgPopEducation                    
                 Syntax:  ChgPopEducation = Value  Or  ChgPopEducationEx = Servile|Peasant|Worker|Middle|Upper|Aristocrat                                       
                 */
                 }
                 ;

and also:

Code: Select all

chgpopeducationex: _CHGPOPEDUCATIONEX eq int sc int sc int sc int sc int sc int all
                 { CHKINT( $3, -999, -999, 999, 999);
                   CHKINT( $5, -999, -999, 999, 999);
                   CHKINT( $7, -999, -999, 999, 999);
                   CHKINT( $9, -999, -999, 999, 999);
                   CHKINT($11, -999, -999, 999, 999);
                   CHKINT($13, -999, -999, 999, 999);
                 /*                                                              
                 http://www.ageod.net/agewiki/ChgPopEducation                    
                 Syntax:  ChgPopEducation = Value  Or  ChgPopEducationEx = Servile|Peasant|Worker|Middle|Upper|Aristocrat                                       
                                                                                 
                 documented | but ; in actual usage                              
                 the appended 'all' is undocumented but conforms to actual usage  
                 */
                 }
                 ;

Note the inclusion of the 'all' in chgpopeducationex (ChgPopEducationEx), where 'all' is specified in the txt.y parser as

Code: Select all

 all:              /* empty, no problem */
                 | sc _ALL
                 ;

Note also the specification of 'sc' (semi-colon) in the chgpopeducationex specification, despite the AGEWiki docs suggesting 'vb' (vertical bar)!

Getting it all right is tricky. Please bear with me (and forgive false positives!) as I continue to code and debug AGElint.
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
Post Reply

Return to “Mods and Scenarios”