MWIF code modules

World in Flames is the computer version of Australian Design Group classic board game. World In Flames is a highly detailed game covering the both Europe and Pacific Theaters of Operations during World War II. If you want grand strategy this game is for you.

Moderator: Shannon V. OKeets

Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

MWIF code modules

Post by Shannon V. OKeets »

Here is a list of the routines that I work with daily. The .pas indicates a Pascal file. The tools directory on the left contains small files, that are very stable, though I still want to replace a few of them with JEDI components.

The heart of the program is the rest of the list. When a file name is preceded by a +, that indicates that there is a form/screen associated with it. The size of each Pascal module runs anywhere from a few hundred lines of code to over 12,000 (for Main.pas). I guess on average they are a couple of thousand lines of code each. The total number of lines of Pascal code is over 210,000 - though I haven't checked that number for a couple of months.

Over the last 16 months I have documented about 2/3rds of these routines (there was almost no documentation when I started). Less than 30 of these are brand new (post-CWIF), but those from CWIF have received an enormous amount of modifications. In particular, I spent the last month going through every module that has a form (+) and replacing all the components that appear on the form. Some of the new modules are the RecordLog*.pas, *Tutorial*.pas, and Bitmap*.pas set, OpeningScreen.pas, Start.pas, and any file that contains the letter group VAR.

Note the absence of NetPlay, PBEM, AIO, and GameReplay - each of which will require several new modules. I expect the AIO to require a dozen or so.

This is why I fight so hard against feature creep - the task is daunting enough as it is.

Image
Attachments
ModuleLis..072006.jpg
ModuleLis..072006.jpg (330.36 KiB) Viewed 974 times
Steve

Perfection is an elusive goal.
User avatar
Froonp
Posts: 7998
Joined: Tue Oct 21, 2003 8:23 pm
Location: Marseilles, France
Contact:

RE: MWIF code modules

Post by Froonp »

Wow, seeing those tens of "files", or "components", or "I don't know what they are", leaves me shared with both a feeling of horror from the part of me who knows nothing at programing, and a feeling of curiosity of peeking in each of them to see what hides inside.
Anyway, it seems less daunting, seen this way, that as I imagined it (thousands of lines of codes, one below the other).
User avatar
wworld7
Posts: 1726
Joined: Tue Feb 25, 2003 2:57 am
Location: The Nutmeg State

RE: MWIF code modules

Post by wworld7 »

Looks more complicated then my ex-wife wish list during our divorce...
Flipper
Jeff Gilbert
Posts: 67
Joined: Sun Oct 02, 2005 1:03 am
Contact:

RE: MWIF code modules

Post by Jeff Gilbert »

ORIGINAL: flipperwasirish
Looks more complicated then my ex-wife wish list during our divorce...
Ouch, been there done that ... twice!
NEVER AGAIN !!
Jeff Gilbert
US Army [Ret]
Palm Harbor, Florida, USA
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

I just finished this week my first ever complete print out of the source code for MWIF. I have the 250 modules separted into 15 binders, as listed in the summary below, and each module has its own little separation tab. The numbers are the lines of code in each module (or binder).
=========================
Table of Contents for MWIF Printed Program Modules
(as December 23, 2006)

Summary
Main Module (11,100)
MWIF Control (13,250)
Loading MWIF & Saved Games (8950)
Beginning Processing Sequence (19,500)
Beginning & End of Turn (9400)
Game Record Logs (23,600)
Maps, Resources, Factories, Production, & Trade (22,850)
Movement & Combat (23,500)
NetPlay & PBEM (1100)
Player Interface, Information Forms, Messages, Tutorials & Filters (20,250)
Units (28,150)
Variables & Strings (3650)
WIFCustom (3850)
WIFCustom External Procedures (6300)
Tools (15,050)
Total = 210,500


Main Module (11,100)
Main (11,100)

MWIF Control (13,250)
GameControl (450)
MessageControl (50)
Password (50)
PhaseControlProcs (3550)
SeqOfPlay (150)
SimControl (7400)
SwitchPlayer (50)
WIFMessageID (1550)

Loading MWIF & Saved Games (8950)
BitmapProcs (250)
Cursors (50)
GameSaveRestore (6000)
LoadStatus (50)
MWIFLoadBitmaps (950)
SavedGame (1600) - CWIF, reference only
SaveSetup (50)

Beginning Processing Sequence (19,500)
Alternate (150)
Bid (500)
ChangeControl (550)
FortHexside (200)
GameData (2250)
OpeningScreen (300)
OptionalRules (450)
Player (850)
Politics (600)
Reserves (200)
Scrap (1850)
Scenario (200)
Setup (2950)
SetupData (4250)
SetupGroups (400)
SetupUnitTypes (1300)
Start (1300)
StartChits (150)
TimeDate (150)
USEntryPool (800)

Beginning & End of Turn (9400)
Action (700)
ActionLimits (150)
AddMinorUnits (100)
BreakDown (250)
Broken (100)
Conquest (500)
DeclareWar (700)
Initiative (500)
Lending (350)
Loan (100)
MoveFirst (100)
Pact (1050)
PactOD (50)
PactMarkerMove (250)
PactMarkers (100)
Partisans (300)
Reform (200)
Split (100)
UnitDialog (500)
UseOil (1000)
USWar (150)
Vichy (750)
WeatherChances (100)
WeatherReport (200)
WIFUSEntryAction (800)
WIFWeather (300)

Game Record Logs (23,600)
RecordLogIDs (500)
RecordLogVar (500)
RecordLogRecords (4650)
RecordLogIn (6150)
RecordLogOut (5700)
RecordLogSet (6100)

Maps, Resources, Factories, Production, & Trade (22,850)
Coast (150)
Globe (1100)
GlobeLegend (200)
HexList (1150)
HexListProcs (100)
MapCSV (1950)
Maps (3650)
MapTable (800)
SeaArea (1250)
SeaBoxes (50)
WIFGlobe (550)
BuildPoint (50)
Captured (200)
Factory (1000)
NewTrade (200)
Production (2400)
ProductionData (50)
ProductionUndo (100)
Resource (1650)
ResourceProduction (3250)
ResourceTrace (50)
SaveBuild (300)
SaveOil (200)
Site (750)
Trade (1450)
TradeResource (250)

Movement & Combat (23,500)
AirDistance (150)
AirTransportLand (100)
CAP (200)
ChooseCarrier (550)
CVPClasses (150))
Distance (250)
DropOff (100)
IgnoreNotional (100)
MoveStack (1650)
OverStacked (250)
PickHQ (350)
PickSeaArea (100)
PlaneRole (200)
Reorganize (450)
SBLosses (250)
Section (400)
SelectUnits (800)
Stack (3300)
StackProcs (50)
AirAttack (1050)
AirCombat (2100)
AntiAir (400)
AntiAirCombat (550)
ChartLandCombat (200)
CommitSubs (150)
DestroyFactory (100)
DestroyUnits (1350)
LandCombat (2750)
NavalCombat (950)
NavalCombatIncludeType (550)
NavalCombatResults (1600)
NavalInterception (300)
Surprise (100)
SurprisePoints (1150)
TwoD10 (200)
USNavalCombat (150)

NetPlay & PBEM (1100)
Chat (450)
NewMessage (150)
NetData (200)
SendTo (200)
WIFMessage (100)

Player Interface, Information Forms, Messages, Tutorials & Filters (20,250)
PlayerInterfaceControl (100)
MapCreateDestroy (50)
MouseCommands (2000)
MapDisplayControls (350)
MapVList (350)
Note (150)
ScreenLayout (2150)
ScreenLList (300)
Undo (300)
UnitMenuProcs (1350)
UnitResolution (50)
ActiveForms (50)
AirReserves (250)
CntList (750)
ConvoyInfo (350)
Dice (150)
DiceProcs (400)
GameAbout (50)
GameOptions (150)
Place (1500)
Pool (600)
Relations (450)
Supply (200)
UnitPanel (200)
Victory (500)
ViewUnits (550)
WIFUSEntry (1300)
HelpMessage (300)
MessageNoYes (50)
MessageOK (50)
MessageYesNoCancel (50)
SimpleMessage (50)
WIFMessageForm (100)
WIFMessageJointForm (50)
IntroTutorials (200)
Tutorials (100)
HexFilter (100)
LoadFilter (150)
PFilter (50)
SaveFilter (100)
UFilter (3350)
UnitDataSelFilter (50)
UnitViewerFilter (900)

Units (28,150)
Air (2900)
Land (2300)
Naval (2100)
Special (450)
WIFUnits (7600)
UnitTable (2200)
Leader (200) - MWIF Product 2
Commitment (50)
Country (9950)
MajorCountry (150)
MPGroup (250)

Variables & Strings (3650)
BitmapVar (200)
DynamicVar (50)
InitGameVar (150)
InProgressVar (250)
InterfaceVar (50)
PackageVar (150)
RigidVar (800)
SetupVar (50)
StaticVar (300)
UnitDrawVar (600)
WIFGlobals (150)
ResStrings (900)

WIFCustom (3850)
MapArea (350)
HexArea (2200)
UnitStackViewer (600)
UnitDataDef (600)
UnitPicture (100)

WIFCustom External Procedures (6300)
GameMap (100)
GameMapArea (2950)
GameStackViewer (1000)
MapLabel (250)
RailLines (400)
UnitDataProcs (1250)
UnitPictureProcs (50)
WIFMap (300)

Tools (15,050)
Arrow (300)
CustDlg (50)
Dialog (100)
DirDlg (100)
DispGrid (100)
DragList (600)
EVerify (550)
FixedCheckListBox (100)
FixedListView (100)
KbdCtrl (100)
LastUsed (600)
ListDlg (400)
MesgDlg (100)
Name (150)
NumDlg (150)
Popup (100)
Random (150)
RealDlg (150)
Search (50)
SimpleGrid (550)
SingInst (50)
Sort (50)
Stored (1850)
StrDlg (150)
StrList (50)
Table (2100)
TableCmn (800)
TBox (200)
TxtDsp (100)
Util (1100)
WaitDlg (150)
WinUtil (3750)
Steve

Perfection is an elusive goal.
rtamesis
Posts: 78
Joined: Fri Jul 23, 2004 10:38 pm

RE: MWIF code modules

Post by rtamesis »

Just out of curiosity, are you using an object oriented programming language like Object Pascal?
amwild
Posts: 105
Joined: Mon Feb 09, 2004 9:31 am

RE: MWIF code modules

Post by amwild »

ORIGINAL: Shannon V. OKeets

I just finished this week my first ever complete print out of the source code for MWIF. I have the 250 modules separted into 15 binders, as listed in the summary below, and each module has its own little separation tab. The numbers are the lines of code in each module (or binder).
=========================
Table of Contents for MWIF Printed Program Modules
(as December 23, 2006)

Summary
Main Module (11,100)
MWIF Control (13,250)
Loading MWIF & Saved Games (8950)
Beginning Processing Sequence (19,500)
Beginning & End of Turn (9400)
Game Record Logs (23,600)
Maps, Resources, Factories, Production, & Trade (22,850)
Movement & Combat (23,500)
NetPlay & PBEM (1100)
Player Interface, Information Forms, Messages, Tutorials & Filters (20,250)
Units (28,150)
Variables & Strings (3650)
WIFCustom (3850)
WIFCustom External Procedures (6300)
Tools (15,050)
Total = 210,500


...


I am suspicious! There are too many trailing zeroes in these numbers! They can't be accurate! [:'(]

Seriously, though, this is a lot of code. Now, can you tell us just how much of it you have written/edited? Do you even want to tell us...? [;)]
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

ORIGINAL: amwild
ORIGINAL: Shannon V. OKeets
I just finished this week my first ever complete print out of the source code for MWIF. I have the 250 modules separted into 15 binders, as listed in the summary below, and each module has its own little separation tab. The numbers are the lines of code in each module (or binder).
=========================
Table of Contents for MWIF Printed Program Modules
(as December 23, 2006)

Summary
Main Module (11,100)
MWIF Control (13,250)
Loading MWIF & Saved Games (8950)
Beginning Processing Sequence (19,500)
Beginning & End of Turn (9400)
Game Record Logs (23,600)
Maps, Resources, Factories, Production, & Trade (22,850)
Movement & Combat (23,500)
NetPlay & PBEM (1100)
Player Interface, Information Forms, Messages, Tutorials & Filters (20,250)
Units (28,150)
Variables & Strings (3650)
WIFCustom (3850)
WIFCustom External Procedures (6300)
Tools (15,050)
Total = 210,500


...


I am suspicious! There are too many trailing zeroes in these numbers! They can't be accurate! [:'(]

Seriously, though, this is a lot of code. Now, can you tell us just how much of it you have written/edited? Do you even want to tell us...? [;)]
Most of this code is in Delphi, Borland's oblect oriented Pascal, with some freqently used routines (written by Chris Marinacci) in assembler for speed. Numbers were rounded to 50 lines of code. All the additions were either done in my head or by hand, so there may be inaccuracies.
--
I have gone through all of this code (except the Tools modules) and added comments and "pretty printing".

Some sections are new by me (all of Tutorials and Game Record Log, and almost all of Loading MWIF & Saved Games).

Others I have completely revamped (WIF Custom, WIFCustom External Procedues, Maps, Beginning Processing Sequence).

Many I heva extracted from larger modules and separated into new smaller ones. For instance, all the Variables & Strings files but 1 are new; Scrap and all the Setup modules had been 1 file; Main had been 23,000 lines without any comments; Mouse Commands is a new module; all the modules with the word Control in them are new.

The numbers above do not properly reflect the code associated with the forms, since most the parameter values and 'event' processing is embedded in the Delphi files that store form data (DFM). At last count there were 105 forms which define what components are shown on the screen, their positioning on the form, and much of the processing in response to the player's action. I have revised all of the forms for the new Theme Engine design, deleting some obsolete ones, compressing several into the new Start (... new game) form, and adding a few (e.g., Tutorials, Map Views, Screen Layouts.).

Obviously I have done extensive revisions to the Maps and Units files to support the new graphics for the units and maps.

Areas still to be fully reviewed and revised are: Beginning and End of Turn, Production & Trade, Movement & Combat, and more work on Units related to legality of moves.

I have left Tools and the Filter code virtually untouched and I have no plans to ever even look at them since they do their job well behind the scenes.

The NetPlay and PBEM sections need to written and so does the AIO code.

Not included in the above listings are the documentation I have created for each of them which are part of each binder. I also have the various graphics/flowcharts and other odd pieces of documentation I have created bound into the appropriate binder. Instead of folders and pieces of paper floating around, everything related to the project is in the binders on a shelf and I take down the one or two I need for whatever I am currently working on. This is a much improved organization for my desktop workspace.

There are limits to my obsessiveness: I have never printed out any of the weekly or monthly status reports and I rarely print out my task lists and the bug reports.
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

I have been encountering bugs in the transitioning from one phase to the next so I reviewed all 77 phases of the game and updated this Sequence Of Play flowchart I had created earlier.

The dark blue labels are for forms that get called up so the player can enter his decisions. The red labels are for phases/subphases (as set internally for processing).

I am about to introduce a variable that tracks the Game Stage. Those are shown in the left margin. By knowing the current Game Stage, I can write a Pascal case statement on GameStage and then within that separate case statements for Phase/Subphase that have very few possible values. For example, if the GameStage is gsNewGame, there are only 2 possible values for Phase (pScrap and pSetup). Right now the case statements are based on Phase, which has 77 values. That's not very easy to write code for.

Image
Attachments
Seq122720061.jpg
Seq122720061.jpg (93.9 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

Page 2 of 8.

There are a lot of forms that can be called up while placing units on the map:
select unit(s) from the setup tray
split convoys
merge convoys
breakdown corps/army into divisions
reform divisions into corps/army
choose a carrier for a carrier based air unit
place a new fort andorient which hexside it protects

Yet to be created are the forms for saving and restoring setup positions for named units and generic units.

Image
Attachments
Seq122720062.jpg
Seq122720062.jpg (65.36 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

At many places in the sequence of play, the Air Mission sequence is executed.

Image
Attachments
Seq122720063.jpg
Seq122720063.jpg (95.48 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

During naval movement, the naval combat sequence may be called.

Image
Attachments
Seq122720064.jpg
Seq122720064.jpg (56.82 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

As you might expect, the sequence for naval combat is complex.

Image
Attachments
Seq122720065.jpg
Seq122720065.jpg (91.94 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

Land movement is a little tricky when units get overrun and have to rebase. Even so, notice that almost all land movement is done on the map (as indicated by the little yellow hexagon) without the use of extra forms - just one for selecting which land unit in the hex are to be picked up by the Air Transport Unit (ATR).

Image
Attachments
Seq122720066.jpg
Seq122720066.jpg (62.7 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

The land combat sequence is long, but pretty straight. The only side trip is for flying in ground support.

Image
Attachments
Seq122720067.jpg
Seq122720067.jpg (70.8 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

8th and last in the series. This is a new page - I hadn't drawn it the last time I posted the sequence of play. I need to go over this in detail, tracking it through the code and comparing the diagram to what the code is actually doing. For example, I haven't listed any of the forms here because I am not sure exactly which ones appear when.

Image
Attachments
Seq122720068.jpg
Seq122720068.jpg (85.89 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

Here are updated diagrams for the sequence of play (first 3 pages only). Most of the others haven't changed much (other than the pages numbers increasing by 1). I have a lot of hand written notes for the final page, but I haven't gotten around to editing its diagram yet.

Image
Attachments
Seq5820071.jpg
Seq5820071.jpg (103.54 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

No changes here but since I was showing # 1 and #3, it seemed right to include #2.

I have added a legend which appears on each page.

Image
Attachments
Seq5820072.jpg
Seq5820072.jpg (82.65 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

3rd and last in the series. Here is where the major changes have taken place. This shows all the new subphases for DOW.

Image
Attachments
Seq5820073.jpg
Seq5820073.jpg (88.98 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Shannon V. OKeets
Posts: 22165
Joined: Wed May 18, 2005 11:51 pm
Location: Honolulu, Hawaii
Contact:

RE: MWIF code modules

Post by Shannon V. OKeets »

Oops, the Legend had a typo. Here's a better view of the legend.

Image
Attachments
Seq5820074.jpg
Seq5820074.jpg (72.32 KiB) Viewed 973 times
Steve

Perfection is an elusive goal.
Post Reply

Return to “World in Flames”