Page 4 of 5

RE: Supply Paths

Posted: Thu Jul 19, 2007 2:20 am
by Shannon V. OKeets
Every once in a while someone mentions that they are interested in programming war games. Here's a glimpse into what is involved.

This code fragment defines the fundamental data structures for programming the supply determination routines.
===========

Code: Select all

 // ****************************************************************************
 // There are 3 TLinkType's used in determining supply: Basic, Rail, and
 // Overseas.  A series of links, or perhaps just one link, connects a supply
 // source to a unit or another supply source.  These are called
 // TSupplyConnection's herein.  A series of supply connections is called a
 // TSupplyPath, which connects a unit to a primary supply source.
 // ****************************************************************************
   TSupplyLinkTypes = (sltBasic, sltRail, sltOverseas);
 // ****************************************************************************
 // Nodes are the end points of a supply link.  Besides a unit or supply source,
 // nodes can also be ports or simply a rail hex that is being used to start or
 // end a link.  For example, an HQ that is not in a rail hex usually traces a
 // Basic link from itself to a rail hex.  The next link is often a Rail link
 // from the rail hex to a primary supply source.
 // **************************************************************************** 
   TNodeTypes = (nodStaticPrimary, nodHQPrimaryTurn, nodHQPrimaryImpulse,
     nodStaticSecondary, nodHQSecondary, nodStaticTertiary, nodHQTertiary,
     nodPort, nodRailHex, nodUnit);
 // ****************************************************************************
 // A TSupplyLink is exclusively of one LinkType.  That is, it is either purely
 // Basic hexes, connected Rail hexes, or Sea areas.  LandLink stores the Basic
 // and Rail hexes that make up the link, while SeaLink stores the sea areas that
 // make up a sea area link.  Only one of those two lists is ever used in a
 // TSupplyLink.  The other is nil.  Simply put, a link connects one node to
 // another.  Note that a Overseas link, by definition, uses the single instance
 // of overseas link permitted in a supply path.
 // ****************************************************************************
   TSupplyLink = record
     LinkType: TSupplyLinkTypes;
     Valid: Boolean;          // Whether the link is functioning or cut.
     Validated: Boolean;      // Flag used when determining which links are valid
     StartNode: TSmallPoint;  // Column, Row
     StartNodeType: TNodeTypes;
     EndNode: TSmallPoint;    // Column, Row
     EndNodeType: TNodeTypes;
     LandLink: THexList;      // The path as a TDataTable of hexes
     SeaLink: TSeaAreaList;   // The path as a (sorted) list of sea area IDs
     BasicHexCount: 0..4;     // The # of basic hexes used by the link.
   end;
 // ****************************************************************************
 // Class TSuppyLinkList
 // ****************************************************************************
   TSupplyLinkList = class(TObjectTable)
 // ****************************************************************************
 // This class contains a list of supply links (Item[index]) that make up a
 // TSupplyConnection.  The reason more than 1 link may be involved is that the
 // connection may be comprised of Basic, Rail, and/or Overseas links.
 // However, there may never be more than one overseas link in a connection.
 // Also the total number of Basic hexes is a maximum of 4.
 // ****************************************************************************
   private
 		function GetItem(const Index: Longint): TSupplyLink;
 
   public
 
   	constructor Create;
     destructor Destroy; override;
 
     property Item[const Index: Longint]: TSupplyLink read GetItem; default;
   end;
 // ****************************************************************************
 // TConnectionTypes identify what is connecting to what.
 // ****************************************************************************
   TConnectionTypes = (ptUnitPrimary, ptUnitSecondary, ptUnitTertiary,
     ptSecondaryPrimary, ptTertiarySecondary, ptTertirayTertiary);
 // ****************************************************************************
 // A TSupplyConnection is a portion (or all) of a full supply path.  It has an
 // associated ConnectionType that identifies what is being connect to what:
 // from a unit to primary, secondary, or tertiary supply source,
 // from a secondary to a primary, or
 // from a tertiary to a secondary or another tertiary.
 //
 // A TSupplyConnection can contain a maximum total of 4 Basic hexes, summed over
 // all TSupplyLink's.
 // ****************************************************************************
   TSupplyConnection = record
     ConnectionType: TConnectionTypes;
     Overseas: Boolean;      // Whether this connection includes an overseas link
     Links: TSupplyLinkList;
     Valid: Boolean;         // Whether the connection is functioning or cut.
     Validated: Boolean;     // Flag used when determining valid connections. 
   end;
 // ****************************************************************************
 // Class TSuppyPath
 // ****************************************************************************
   TSuppyPath = class(TObjectTable)
 // ****************************************************************************
 // This class contains a list of supply connections (Item[index]) which connect
 // a unit to a primary supply source.  A TSuppyPath has the following
 // restrictions.  it can contain:
 // (1) only one instance of an overseas link,
 // (2) only one connection of type ptSecondaryPrimary.
 //
 // Note that a TSupplyPath may contain more than 4 Basic hexes in total, since
 // that constraint applies to each TSupplyConnection, but not a TSupplyPath.
 // ****************************************************************************
   private
 		function GetItem(const Index: Longint): TSupplyConnection;
 
   public
 
   	constructor Create;
     destructor Destroy; override;
 
     property Item[const Index: Longint]: TSupplyConnection read GetItem; default;
   end;
 
=====================

RE: Supply Paths

Posted: Thu Jul 19, 2007 3:23 am
by Neilster
For some reason these code fragments freak out Firefox. On my machine (totally updated, latest of everything) this spills out of the message box and over-writes all the stuff at the bottom of the screen ("post reply" buttons etc).

Cheers, Neilster

RE: Supply Paths

Posted: Thu Jul 19, 2007 3:27 am
by Shannon V. OKeets
ORIGINAL: Neilster

For some reason these code fragments freak out Firefox. On my machine (totally updated, latest of everything) this spills out of the message box and over-writes all the stuff at the bottom of the screen ("post reply" buttons etc).

Cheers, Neilster
Sorry about that.

Here is a little test to see if FireFox is taking the word code enclosed in [] as a command to do something. Let me know if you see the 3 x's or not, and if FireFox has fits.

Begin test:

Code: Select all

 
 xxx
 
 
End test.


RE: Supply Paths

Posted: Thu Jul 19, 2007 4:00 am
by Neilster
When I reply by quoting your message, I can see what you wrote. Otherwise it's lost in the overrun from the first message.

Cheers, Neilster

RE: Supply Paths

Posted: Thu Jul 19, 2007 5:32 am
by Shannon V. OKeets
ORIGINAL: Neilster

When I reply by quoting your message, I can see what you wrote. Otherwise it's lost in the overrun from the first message.

Cheers, Neilster
Ok.

I have never been happy with showing code this way anyway. It comes out in too small a font. In the future what I can do is take a screen shot of the code and post it as a JPG instead. I don't show actual lines of code very often.

RE: Supply Paths

Posted: Thu Jul 19, 2007 8:13 am
by Froonp
ORIGINAL: Neilster

When I reply by quoting your message, I can see what you wrote. Otherwise it's lost in the overrun from the first message.

Cheers, Neilster
Dump Firefox, use IE [:D]

RE: Supply Paths

Posted: Thu Jul 19, 2007 10:01 am
by Neilster
ORIGINAL: Froonp
ORIGINAL: Neilster

When I reply by quoting your message, I can see what you wrote. Otherwise it's lost in the overrun from the first message.

Cheers, Neilster
Dump Firefox, use IE [:D]
I used to but I think Firefox is better in general. I prefer IE for downloading stuff.

Cheers, Neilster

RE: Supply Paths

Posted: Thu Jul 19, 2007 4:28 pm
by composer99
Ah, having a glimpse at that code reminds me why I left software engineering. Thanks for helping me avoid too much nostalgia, Steve. [;)]
 
That aside, the revised supply path/source documentation seems complete. I find it a bit unusual to call an HQ providing emergency supply a "primary supply source", but that is, in effect, what it is for the impulse, so it makes sense.

RE: Supply Paths

Posted: Thu Jul 19, 2007 5:06 pm
by Shannon V. OKeets
ORIGINAL: composer99

Ah, having a glimpse at that code reminds me why I left software engineering. Thanks for helping me avoid too much nostalgia, Steve. [;)]

That aside, the revised supply path/source documentation seems complete. I find it a bit unusual to call an HQ providing emergency supply a "primary supply source", but that is, in effect, what it is for the impulse, so it makes sense.
Thank you to everyone who proofread this program documentation. There were errors in the some of the actual code which the compiler caught, but I was more concerned about logic of the process. The English text describes the process in non-programming terms (I believe) which most players can understand and pass judgment on.

RE: Supply Paths

Posted: Wed Aug 01, 2007 10:58 pm
by Shannon V. OKeets
My perusal of the rules over lunch yeilded the following. Do these look correct?
==========
Use of Railway and Road Transportation Lines
(as of August 1, 2007)

Roads
∙ Tracing supply: same as rail lines
∙ Unit movement: may not be used
∙ Resource movement: same a rail lines

Rail movement action limits
∙ Tracing supply: none needed
∙ Unit movement: costs 1 Rail Move per unit (factories cost 2); more for long distances
∙ Resource movement: none needed

Distance
∙ Tracing supply: infinite
∙ Unit movement: affects # of rail moves needed
∙ Resource movement: infinite

Neutral countries
∙ Tracing supply: may not pass through (exceptions are Vichy France and Sweden)
∙ Unit movement: may not be used
∙ Resource movement: may be used

Hexes controlled by allies
∙ Tracing supply: permission by owner needed
∙ * Unit movement: permission by owner not needed
∙ Resource movement: permission by owner needed

Enemy ZOC
∙ Tracing supply: no effect if a friendly unit is present
∙ Unit movement: stops movement even if a friendly unit is present
∙ Resource movement: stops movement even if a friendly unit is present

Straits
∙ Tracing supply: no effect; not permitted if enemy controls sea area
∙ Unit movement: only 1 unit per side per turn; not permitted if enemy controls sea area
∙ Resource movement: A resource can cross only 1 straits hexside; not permitted if enemy controls sea area

USSR & Allied mutual use of railways
∙ Tracing supply: only if the USSR and Germany are at war
∙ * Unit movement: always
∙ Resource movement: only if the USSR and Germany are at war

* ==> unexpected.


RE: Supply Paths

Posted: Thu Aug 02, 2007 7:13 am
by Froonp
ORIGINAL: Shannon V. OKeets

My perusal of the rules over lunch yeilded the following. Do these look correct?
==========
Use of Railway and Road Transportation Lines
(as of August 1, 2007)
Enemy ZOC
∙ Tracing supply: no effect if a friendly unit is present
∙ Unit movement: stops movement even if a friendly unit is present
You can also say : Can not even enter if no friendly unit present.
∙ Resource movement: stops movement even if a friendly unit is present

RE: Supply Paths

Posted: Thu Aug 02, 2007 7:28 am
by Shannon V. OKeets
ORIGINAL: Froonp
ORIGINAL: Shannon V. OKeets

My perusal of the rules over lunch yeilded the following. Do these look correct?
==========
Use of Railway and Road Transportation Lines
(as of August 1, 2007)
Enemy ZOC
∙ Tracing supply: no effect if a friendly unit is present
∙ Unit movement: stops movement even if a friendly unit is present
You can also say : Can not even enter if no friendly unit present.
∙ Resource movement: stops movement even if a friendly unit is present
How do you feel about the items I asterisked? They seem inconsistent with the other rules.

I assume they are correct or someone would have mentioned it.

RE: Supply Paths

Posted: Thu Aug 02, 2007 8:04 am
by Froonp
How do you feel about the items I asterisked? They seem inconsistent with the other rules.

I assume they are correct or someone would have mentioned it.

I am not bothered with them.

But 11.11.5 says :
*******************************
You can move a land unit controlled by an active major power into any hex controlled by:
ï that major power and its aligned minors; or
ï another active major power on the same side (or its controlled minor countries); or
ï a major power or minor country it is at war with.

There are some exceptions:
(...)
ï units cannot enter a country controlled by another power on their side without permission of the owner.
*******************************

RE: Supply Paths

Posted: Thu Aug 02, 2007 2:28 pm
by Mziln
ORIGINAL: Froonp
How do you feel about the items I asterisked? They seem inconsistent with the other rules.

I assume they are correct or someone would have mentioned it.

I am not bothered with them.

But 11.11.5 says :
*******************************
You can move a land unit controlled by an active major power into any hex controlled by:
ï that major power and its aligned minors; or
ï another active major power on the same side (or its controlled minor countries); or
ï a major power or minor country it is at war with.

There are some exceptions:
(...)
ï units cannot enter a country controlled by another power on their side without permission of the owner.
*******************************
ORIGINAL: WiFFE RAW 7.0.pdf

There are some exceptions:

• units can’t enter the home country of a non co-operating major power on the same side unless they satisfy the foreign troop commitment rules (see 18.2); and

• minor country units can’t enter a hex controlled by another minor country aligned with their side unless they satisfy the foreign troop commitment rules.

• units cannot enter a country controlled by another power on their side without permission of the owner.

Your partial posting of the exceptions to "11.11.5 Active major powers" gives the wrong impression to readers who are not familiar with the rules.


Example: Even though the Commonwealth and France are at war with Germany and on the same side on the first turn of the campaign sceanario. The Commonwealth, without committing their HQ unit, cannot land units in France since thay don't co-operate.

The Commonwealth must satisfy the foreign troop commitment rules (see 18.2) and have permission from the French player.

RE: Supply Paths

Posted: Thu Aug 02, 2007 3:07 pm
by Froonp
It was to answer to
∙ * Unit movement: permission by owner not needed
And to make my answer short.
Just to point out that the affirmation was not always true.

RE: Supply Paths

Posted: Thu Aug 02, 2007 6:35 pm
by Shannon V. OKeets
ORIGINAL: Froonp
How do you feel about the items I asterisked? They seem inconsistent with the other rules.

I assume they are correct or someone would have mentioned it.

I am not bothered with them.

But 11.11.5 says :
*******************************
You can move a land unit controlled by an active major power into any hex controlled by:
ï that major power and its aligned minors; or
ï another active major power on the same side (or its controlled minor countries); or
ï a major power or minor country it is at war with.

There are some exceptions:
(...)
ï units cannot enter a country controlled by another power on their side without permission of the owner.
*******************************
Ok. The exception covers one of the holes I was seeing. You still need permission by the owner to move units by rail through a country. That is covered in the unit movement rules rather than the section on railway movement. I'll note that in the document.

My main purpose here was to design a data storage structure for rail networks. I'll make them simple lists of hexes (rail and road separate) for each network for each country.

When moving resources I will create a new variable that merges road and rail networks and brings in neutral country networks too. But that will need to check for stoppage points due to EZOC occupied by friendly units (note these might be projected into a country from another country). I am not sure about asking for permission of the owner. Right now I think I will set that to "permission is always granted" and give each major power the option to change the setting to either ask, or deny. Why someone would want to deny an ally the ability to transport a resource eludes me at the moment.

For tracing supply, I will merge the roads and rail networks, but not bring in the neutral country networks. I can also ignore EZOC if friendly units are present.

I think that gives you the idea of where I am heading with this stuff and why I want to make sure I have got it right before writing the code.

RE: Supply Paths

Posted: Thu Aug 02, 2007 7:54 pm
by cerosenberg
Why someone would want to deny an ally the ability to transport a resource eludes me at the moment.
 
The Soviet Union frequently denied thier "allies" access to resources, esp. airfields.  This was most noteable when the British tried to support the Polish Warsaw uprising in 1944.  Since you are working on a game/simulation the ability to deny allies access should be available, even if rarely used.

RE: Supply Paths

Posted: Thu Aug 02, 2007 8:22 pm
by Shannon V. OKeets
ORIGINAL: cerosenberg

Why someone would want to deny an ally the ability to transport a resource eludes me at the moment.

The Soviet Union frequently denied thier "allies" access to resources, esp. airfields.  This was most noteable when the British tried to support the Polish Warsaw uprising in 1944.  Since you are working on a game/simulation the ability to deny allies access should be available, even if rarely used.
Thanks for the information.

I was not proposing to remove the option. Players are unlikely to do something similar since it can't be good for their side.

RE: Supply Paths

Posted: Thu Aug 02, 2007 9:01 pm
by composer99
Doesn't that rule cited from 11.11.5 cover both the loopholes in your table of rail/road use?

RE: Supply Paths

Posted: Thu Aug 02, 2007 9:20 pm
by Shannon V. OKeets
ORIGINAL: composer99

Doesn't that rule cited from 11.11.5 cover both the loopholes in your table of rail/road use?
The second asterisked entry is for the special rule(s) that the USSR and Germany must be at war. I didn't see that mentioned for rail moves or regular land moves.