Shannon V. OKeets -> RE: The RaW 7 Aug 04 and Scenario RTF (3/8/2006 5:41:45 AM)
will scenarios be moddable? could we add a scenario?
This comes up every so often. No. WIF scenarios are extremely complex.
I am still working on the assumption that my task is to program MWIF, not a MWIF construction kit.
The following code segment simply lays the groundwork for reading in the units. Each of these 14 routines does a bunch of stuff.
SetInitiative; // 1 Who has the initiative
SetIntelligence; // 2 Set intelligence points from scenario data
SetForts; // 3 Forts that have been destroyed
SetRelations; // 4 Who is at war, aligned, conquered
SetLegalCountries; // 5 Set which countries are in the scenario + convoys
SetControl; // 6 Who controls which hexes
SetUnits; // 7 Remove some units and put others in reserve pool
TransferOwnership; // 8 Transfer ownership of conquered naval units
SetGearing; // 9 Gearing limits are infinitie to start
SetAllow; // 10 Convoys & land hexes usable by other major powers
SetPacts; // 11 Neutrality pacts
SetTradeAgreements; // 12 Trade agreements
SetPolitics; // 13 Set which US entry actions have occurred
SetEntryAction; // 14 Create (empty) delayed US entry action table
Here is part of the SetRelations routine, for the scenario Lebensraum.
// The country absorption, force pool additions and alignments, before the Case
// statement for Scenarios, apply to all scenarios
// Austria is always part of Germany
if Start > 1938 then ChangeCountry(rsGermany, [rsAustria]);
// Set aligned countries
// Commonwealth possessions
AddAligned(Commonwealth, [rsAngloEgyptianSudan, rsBechuanaland,
rsBritishGuyana, rsBritishHonduras, rsCeylon, rsEgypt, rsGambia,
rsGoldCoast, rsJordan, rsKenya, rsNigeria, rsNorthernRhodesia,
rsNyasaland, rsPalestine, rsSierraLeone, rsSouthernRhodesia,
rsSouthWestAfrica, rsTanganyika, rsUganda]);
// Move other country's forces that belong in a major power's force pool
AddForcePool(Germany, [rsGermanSS]); // SS units
AddForcePool(China, [rsCommunistChina, rsNationalistChina]);
AddForcePool(Commonwealth, [rsAustralia, rsCanada, rsIndia, rsNewZealand,
rsSouthAfrica, rsUnitedKingdom]); // Commonwealth member nations
if Options.Siberians then AddForcePool(USSR, [rsSiberia]);
// Scenario dependent alignments, ownership, & conquests
case CurrScenario of
AddAligned(Italy, [rsEritrea, rsItalianSomaliland, rsLibya]);
// Commonwealth (Iceland, and Greenland go to CW when Denmark is conquered)
AddAligned(Commonwealth, [rsBurma, rsMalaya, rsBelgianCongo, rsNorway,
AddConquered(Commonwealth, [rsEritrea, rsItalianSomaliland]);
// Crete and Tobruk are held by the CW - Alternate Control Record entries
// Free France and Vichy France
AddAligned(France, [rsCameroons, rsChad, rsFrenchGuyana, rsMiddleCongo,
rsFrenchSomaliCoast, rsGabon, rsUbangiShari]);
Countries.CreateVichyFrance(Germany); // Corsica is part of Vichy
AddAligned(VichyFrance, [rsAlgeria, rsDahomey, rsFrenchGuinea, rsSyria,
rsFrenchSudan, rsIvoryCoast, rsMadagascar, rsMauretania, rsMorocco,
rsNigerColony, rsSenegal, rsTogo, rsTunisia, rsUpperVolta]);
ChangeForVichy; // Handles most of the changes except those below
GDChangeControl(rsFreeFrance, [rsFrenchPolynesia, rsMarquesasIslands,
AddAligned(Germany, [rsRumania, rsBulgaria, rsIraq]);
AddConquered(Germany, [rsBelgium, rsDenmark, rsFreeFrance, rsGreece,
rsNetherlands, rsNorway, rsPoland, rsYugoslavia]);
AddWar(Germany, [rsCommonwealth, rsFreeFrance]);
AddWar(Italy, [rsCommonwealth, rsFreeFrance]);
AddWar(VichyFrance, [rsCommonwealth, rsFreeFrance]);
// Free France
ChangeCountry(rsUSSR, [rsFinnishBorderlands, rsBessarabia]);
AddConquered(USSR, [rsEstonia, rsLatvia, rsLithuania]);
USSR.NeutralThisYear := True;
AddAligned(Japan, [rsKorea, rsManchuria, rsFrenchIndoChina]);
AddForcePool(Japan, [rsKorea, rsManchuria]);
This is all before the units are randomly drawn and assigned to restricted setup locations (e.g., European ports controlled by Germany but not bordering on the Mediterranean or Black Seas). All named naval units have to be assigned a specific place and time for setup. One small mistake is fatal to the setup process.
The sequence of everything is crucial too. Setting alignments, conquest, and changing control of hexes (e.g., how far into China Japan has gotten) needs to be done in the right order.
WIF is not like other games where you simply pick out a bunch of units and set them up on your side of the board, while the opponent sets his up on his side of the board. You basically have to review all 238 countries/territories, sometimes going down to the hex level within some of those countries, figure out the political status of each country vis-a-vis the major powers, and then go through all the units for each major power and all the minor countries that are active at the start of the scenario.
It's basically a bear to do, with inevitable mistakes that have to be corrected as they come to light. There is a very good reason why CWIF only contained 3 of the 11 scenarios.
Writing a routine that automates this process is pretty daunting. It is a hodge-podge of variables that have to be set. All the comments above are mine (the code I inherited had none). I modified the code to use the 'case' statement to provide some structure (by scenario) for the Set Relations routine. Most of the other routines do not lend themselves to simple structures - each scenario contains some unique items that no other scenario has.
Days of Decision III (if I ever get around to that as a future MWIF product) might provide some more structure, simply because the political relationships are more fully developed in the that simulation.
MWIF construction kits are a long way in the future.