Saturday, 20 November 2010

PGF conversion tutorial, version 2.

General remark:
Fast conversion to PGF can be done by doing steps 0, 1, 2, 3, 4.3, 5.1, 5.2, 5.3 only. After those steps you should be able to play scenarios of campaign. Probably some scenarios will have errors that make PGF crash or finish scenario after first turn. To correct these do 7.1.

Tools:

FPGE v0.6.3b15 - April 2012
Notepad++, Notepad 
UnixTools - Optional, used to help find problems. The gawk and grep programs are only needed.
GIMP - Optional, fixing icon problems
Graphviz - Optional, drawing campaign tree

Steps:
0. Make sure that you have correctly installed and working campaign for PG or AG (including patching of exe with new NUPL).
1. Save equipment file

2. Save units bmp

3. Save flags bmp

4. FPGE -Ehl ALL - check for units errors : FPGE -Ehl ALL | grep "Er:X\|scenario #" Substitute X with 0 (not found) or 2(nation changed) or 4(unit name changed) to observe how FPGE has converted units. More codes : 1- ok, 3- found unit with "any country", -1 in equipment file, mostly navy. Example: FPGE -Ehl ALL | grep Er:2


4.1. Correct original units
4.2. Correct equipment file
4.3. When satisfied convert with FPGE -Eh ALL
5. Move created files to new dir in PGF directory:
5.1 bmp to Graphics dir
5.2 *.pgscn, MAPNAMES.STR to Scenario dir
5.3 Prepare game.png file with info about this campaign. Picture resolution is 211x158. Store this picture in new campaign directory.
6. Fix map : FPGE -Frtnh ALL
7. Check if each map got victory points set - at least one on each side FPGE -S ALL | grep "victory hexes number\|scenario #"
7.1 Correct if needed : FPGE ## -> Victory mode
8. Correct maps:
8.1 Check for map errors like: wrong roads, rivers, lack of coastal tiles
8.2 Randomize needed map elements like swamps, forests, etc. Can be done by : FPGE -Rocdefbs ALL Sometimes forest randomization is not needed.
8.3 Randomize rivers or roads - this works different then 8.2 randomization. Can be done : FPGE -Rri ALL
8.4 Manually add mountains using predefined mountains when needed


8.5 Once again fix maps since randomization of roads or map corrections can broke down map:  FPGE -Frtnh ALL
9. Fix units on maps. Check FPGE -u ALL | grep "ID\|#" Possible errors are:

9.1 Flag of unit not set or set not properly - use FPGE flag mode with ALT
9.2 Ground units on sea without sea transport - use FPGE transport mode
9.3 Paradrop units on without air transport - use FPGE transport mode
10. Copy default campaign file
10.1 In case of AG copy SCENARIO.TDB file, remove not needed lines and not used scenario lines.
10.2 Make campaign path while converting from AG :
gawk -F \. -f camp_tree.awk SCENARIO.tdb > camp_tree.txt

10.3 Set victory conditions, read campaign manual or guess
10.4 Draw camp tree: FPGE -Y 1 to file "pgcam.gv", then draw pgcam.png tree:
dot -Tpng  pgcam .gv >  pgcam.png
11. Convert briefings FPGE -yb 1
11.1 Check pgcam vs briefings: FPGE -y 1
11.2 Fix briefings: for non-ASCII chars add HTML quotes: FPGE -yf 1
12. Option: check icons vs countries: FPGE -XAu


13. Option Ag: draw campaign tree while converting from AG:

gawk -F \. -f tree.awk SCENARIO.TDB > tree.gv
dot -Tpng tree.gv > tree.png




tree.awk
#==========CUT BELOW============

BEGIN{print "digraph G { node [shape=box]" }
END  {print "}" }
{ if (NF > 4 ) {
print "\""$2"\" -> \"" $4"\" [color=\"#0000ff\"]";
print "\""$2 "\" -> \""$5"\" [color=\"#00ff00\"]";
print "\""$2"\" -> \""$6"\" [color=\"#ff0000\"]"
}
}#=========CUT ABOVE============= 


gawk -F \. -f camp_tree.awk SCENARIO.tdb > camp_tree.txt

camp_tree.awk
#=========CUT BELOW=============

{
gsub(/[ \t]+$/, "", $2);
gsub(/[ \t]+$/, "", $4);
gsub(/[ \t]+$/, "", $5);
gsub(/[ \t]+$/, "", $6); 
brf=sprintf("%04d.pgbrf",NR);
SEP="\t";
print $2 SEP brf SEP $2 SEP $4 SEP $8 SEP SEP $5 SEP $9 SEP SEP $6 SEP $10 SEP SEP
}
#==========CUT ABOVE============



Thursday, 7 October 2010

PGF conversion tutorial

Tools:

FPGE v0.6.0
Notepad++, Notepad 
UnixTools - Optional, used to help find problems
GIMP - Optional, fixing icon problems
Graphviz - Optional, drawing campaign tree


Steps:
1. Save equipment file
2. Save units bmp
3. Save flags bmp
4. FPGE -E ALL - check for units errors : FPGE -E ALL | grep "Not found\#"
4.1. Correct original units
4.2. Correct equipment file
4.3 Delete pgscn files, start over with . When satisfied move to 5.
5. Move created files to new dir in PGF directory:
5.1 bmp to Graphics dir
5.2 *.pgscn, MAPNAMES.STR to Scenario dir
6. Fix map : FPGE -Frtnh ALL
7. Check if each map got victory points set - at least one on each side
7.1 Correct if needed : FPGE ## -> Victory mode
8. Correct maps:
8.1 Check for map errors like: wrong roads, rivers, lack of coastal tiles
8.2 Randomize needed map elements like swamps, forests, etc. Can be done by : FPGE -Rocdefbs ALL Sometimes forest randomization is not needed.
8.3 Randomize rivers or roads - this works different then 8.2 randomization. Can be done : FPGE -Rri ALL
8.4 Manually add mountains using predefined mountains when needed
8.5 Once again fix maps since randomization of roads or map corrections can broke down map:  FPGE -Frtnh ALL
9. Fix units on maps. Check FPGE -U ALL | grep "ID\|#" Possible errors are:
9.1 Flag of unit not set or set not properly - use FPGE flag mode with ALT
9.2 Ground units on sea without sea transport - use FPGE transport mode
9.3 Paradrop units on without air transport - use FPGE transport mode
10. Copy default campaign file
10.1 Make campaign path while converting from AG : awk..
10.2 Set victory conditions, read campaign manual or guess
11. Convert briefings
12. Option: check icons vs countries: FPGE -Xau 01
13. Option Ag: draw campaign tree while converting from AG:

head -n 40  SCENARIO.TDB | awk -F \. 'BEGIN{print"digraph G { node [shape=box]"} END{print"}" }{ if (NF > 4 ) {print "\""$2"\" -> \"" $4"\" [color=\"#0000ff\"]"; print "\""$2 "\" -> \""$5"\" [color=\"#00ff00\"]"; print "\""$2"\" -> \""$6"\" [color=\"#ff0000\"]"} }'> alg.gv
dot -Tpng alg.gv > alg.png

Friday, 17 September 2010

PG tables

PG series uses many tables for conversions between number encoded values and human readable strings. Some of them are listed below:

The equipment file uses following conversion for unit movement types:

0. tracked
1. halftracked
2. wheeled
3. leg
4. towed
5. air
6. naval
7. all terrain


Unit classes are coded:

0. Infantry
1. Tank
2. Recon
3.Anti-tank
4.Artillery
5.Anti-aircraft
6.Air Defense
7.Fortification
8.Fighter
9.Tactical Bomber
10.Level Bomber
11.Submarine
12.Destroyer
13.Capital Ship
14.Air. Carrier
15.Land Transport
16.Air Transport
17.Sea Transport

The countries are coded using the table:
  1. Austria 
  2. Belgium
  3. Bulgaria
  4. Luxembourg
  5. Denmark
  6. Finland
  7. France
  8. Germany
  9. Greece
  10. USA
  11. Hungary
  12. Turkey
  13. Italy
  14. Netherlands
  15. Norway
  16. Poland
  17. Portugal
  18. Rumania
  19. Spain
  20. USSR
  21. Sweden
  22. Switzerland
  23. UK
  24. Yugoslavia
Terrain type are coded:
0. Clear
1. Clear
2. Clear
3. Clear
4. Coast
5. Coast
6. Coast
7. Ocean
8. Port
9. River
10. River
11. River
12. Mountain
13. Mountain
14. Mountain
15. Mountain
16. Mountain
17. Mountain
18. Mountain
19. Airfield
20. Swamp
21. City
22. Rough
23. Forest
24. [unknown]
25. Fortification
26. Fortification
27. Bocage
28. Bocage
29. Port
30. Desert
31. Mountain
32. Mountain
33. Fortification
34. Rough Desert
35. Escarpment
36. Escarpment
37. Port
38. Desert
39. Unknown

Thursday, 16 September 2010

AG NULP

AG and PG WIN share NUPL structure. AG NUPL differs very slightly from PG DOS NUPL. One more country is in the NUPL table.
  1. Norway share NUPL with Netherlands, Sweden, Switzerland, Spain, Portugal, Austria, Turkey, Denmark
  2. United Kingdom
  3. Italy
  4. Poland
  5. Germany
  6. Belgium share NUPL with Luxembourg
  7. France
  8. Soviet Union
  9. United States
  10. Yugoslavia
  11. Rumania
  12. Hungary
  13. Bulgaria
  14. Greece
  15. Finland
The NUPL is coded the same as in PG DOS. The AG.EXE of size 2167611 got table at 1883344, 2167296 at 2167611. The PG WIN of size 2135040 at 1845024.


The NUPL table size is 647.


For more information see:
http://www.juloag.euweb.cz/

Wednesday, 8 September 2010

PG NUPL

The New Unit Purchase List in Paner General is coding information which country can buy which unit. For PG.EXE size 814305 table starts at offset 776008, while for PG.EXE size 811233 it starts at 772936. The example table:

The starting 96 00 is Id of the Infantry unit that Norway and some other countries can buy. Next FF FF is -1 meaning end of class information. The whole table ends with -2 (FE FF). There are 620 2 byte elements in this array (including -2).

The NUPL  in PG is coded for countries in the following order:
  1. Norway share NUPL with Netherlands, Finland, Sweden, Switzerland, Spain, Portugal, Austria, Turkey, Denmark
  2. United Kingdom
  3. Italy
  4. Poland
  5. Germany
  6. Belgium share NUPL with Luxembourg
  7. France
  8. Soviet Union
  9. United States
  10. Yugoslavia
  11. Rumania
  12. Hungary
  13. Bulgaria
  14. Greece 
There are 12 classes per country. Each country got following classes coded.
  • Infantry
  • Tank
  • Recon
  • Anti-tank
  • Artillery
  • Anti-Aircraft
  • Air Defense
  • Fortification
  • Fighter
  • Tactical Bomber
  • Level Bomber
  • Land Transport