Shannon V. OKeets
Posts: 22095
Joined: 5/19/2005 From: Honolulu, Hawaii Status: offline
|
quote:
ORIGINAL: wfzimmerman 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
AddAligned(Germany, [rsCzechoslovakia]);
AddAligned(Italy, [rsAlbania]);
AddAligned(USSR, [rsMongolia]);
// 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(Japan, [rsFormosa]);
AddForcePool(China, [rsCommunistChina, rsNationalistChina]);
AddForcePool(Commonwealth, [rsAustralia, rsCanada, rsIndia, rsNewZealand,
rsSouthAfrica, rsUnitedKingdom]); // Commonwealth member nations
AddForcePool(USSR, [rsMongolia]);
if Options.Siberians then AddForcePool(USSR, [rsSiberia]);
// Scenario dependent alignments, ownership, & conquests
case CurrScenario of
...
scLebensraum:
begin
// Balkans
ChangeCountry(rsHungary, [rsTransylvania]);
ChangeCountry(rsBulgaria, [rsSouthDobruja]);
// Italy
AddAligned(Italy, [rsEritrea, rsItalianSomaliland, rsLibya]);
AddConquered(Italy, [rsEthiopia]);
// Commonwealth (Iceland, and Greenland go to CW when Denmark is conquered)
AddAligned(Commonwealth, [rsBurma, rsMalaya, rsBelgianCongo, rsNorway,
rsGreece, rsNetherlandsEastIndies]);
AddForcePool(Commonwealth, [rsBurma]);
AddConquered(Commonwealth, [rsEritrea, rsItalianSomaliland]);
AddLiberated(Commonwealth, [rsEthiopia]);
// 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
Countries.RenameFrance;
ChangeCountry(rsVichyFrance, [rsVichyFrance]);
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,
rsNewCaledonia]);
GDChangeControl(rsVichyFrance, [rsFrenchGuyana]);
// Germany
AddAligned(Germany, [rsRumania, rsBulgaria, rsIraq]);
AddConquered(Germany, [rsBelgium, rsDenmark, rsFreeFrance, rsGreece,
rsNetherlands, rsNorway, rsPoland, rsYugoslavia]);
GDChangeControl(rsGermany, [rsSyria]);
AddWar(Germany, [rsCommonwealth, rsFreeFrance]);
AddWar(Italy, [rsCommonwealth, rsFreeFrance]);
AddWar(VichyFrance, [rsCommonwealth, rsFreeFrance]);
// Free France
ChangeFranceHomeCountry;
// Belgium
ChangeBelgiumHomeCountry;
// Netherlands
ChangeNetherlandsHomeCountry;
// USSR
ChangeCountry(rsUSSR, [rsFinnishBorderlands, rsBessarabia]);
GDChangeControl(rsUSSR, [rsEasternPoland]);
AddConquered(USSR, [rsEstonia, rsLatvia, rsLithuania]);
USSR.NeutralThisYear := True;
// USA
AddAligned(UnitedStates, [rsPhilippines]);
// Japan
AddAligned(Japan, [rsKorea, rsManchuria, rsFrenchIndoChina]);
AddForcePool(Japan, [rsKorea, rsManchuria]);
AddWar(Japan, [rsChina]);
end;
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.
_____________________________
Steve Perfection is an elusive goal.
|