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.


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

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

#==========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

#=========CUT BELOW=============

gsub(/[ \t]+$/, "", $2);
gsub(/[ \t]+$/, "", $4);
gsub(/[ \t]+$/, "", $5);
gsub(/[ \t]+$/, "", $6); 
print $2 SEP brf SEP $2 SEP $4 SEP $8 SEP SEP $5 SEP $9 SEP SEP $6 SEP $10 SEP SEP
#==========CUT ABOVE============