Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Combat value (CV)

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> World in Flames >> AI Opponent Discussion >> Combat value (CV) Page: [1]
Login
Message << Older Topic   Newer Topic >>
Combat value (CV) - 3/8/2021 7:26:58 AM   
peskpesk


Posts: 2347
Joined: 7/17/2003
From: Stockholm, Sweden
Status: offline
Having the AIO playing means being able to assign a combat value (CV) to each unit. The design for the AIO has CVs at its heart. They determine which air units should be assigned pilots. When a combat loss has to be taken, they determine which unit lives and which dies. Then they are also an integral part of the logic for deciding which units to build. The list of where a unit’s CV is referenced is very long.

One of the first ‘calls’ in an AIO script is to calculate the CV for every unit in the game. There are 70 unique unit types in MWIF.

quote:

// To the straight forward combat factor of a land unit, adjustments are made
// that take into consideration its mobility. Working from a base of 4
// movements points, the combat value is incremented or decremented by 0.5
// points for every difference in movement points. For example, a 7-5 infantry
// is worth 7.5 CVs and a 6-3 is worth 5.5 CVs. Divisional units are reduced by
// a full point for their lack of zones of control. Similarly, territorial
// units have their CV reduced by 1 for the penalty they suffer in combat when
// not stacked with a non-territorial land unit.
//
// There is a minimum combat value of 1 CV for a unit after adjustments, which
// keeps a 2-1 garrison and 1-4 divisional unit from becoming worthless.
// ****************************************************************************
utInfantry, utMilitia, utGarrison:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5);

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Corps sized German SS units have a garrison value of 2.
// ****************************************************************************
else if LU.Country = GermanSS.ID then Result := Result + 1.0;
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
if LU.Elite then Result := Result + 2;
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;

if Result < 1.0 then Result := 1.0;
end;

utWarlord:
begin
LU := TLandUnit(U);
// ****************************************************************************
// Warlords can only move 6 hexes from their home city, so their value is
// reduced by 1.
// ****************************************************************************
Result := LU.Combat + ((LU.Move - 4.0) * 0.5) - 1;

if Result < 1.0 then Result := 1.0;
end;

utTerritorial:
begin
LU := TLandUnit(U);
// ****************************************************************************
// While territorial units suffer penalties when attacking and defending without
// the help of non-territorial units, they are capable of getting supply from
// cities in their home country and can move more freely in their home country.
// ****************************************************************************
Result := LU.Combat+ ((LU.Move - 4.0) * 0.5) - 1.0 ;

if Result < 1.0 then Result := 1.0;
end;

utMountain:
begin
LU := TLandUnit(U);
// ****************************************************************************
// Besides being tripled in mountain terrain, mountain units can also be air
// transported by ATR units and are 'SnowSet' units.
// ****************************************************************************
Result := LU.Combat + ((LU.Move - 4.0) * 0.5) + 3.0; // Mountain + 3.

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
else if LU.Elite then Result := Result + 2;

if Result < 1.0 then Result := 1.0;
end;

utMotorized:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5) + 1; // Motorized + 1.

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Corps sized German SS units have a garrison value of 2.
// ****************************************************************************
else if LU.Country = GermanSS.ID then Result := Result + 1.0;
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
if LU.Elite then Result := Result + 2;
// ****************************************************************************
// Add bonus for winterized units (e.g., Finnish, Swedish, Norwegian, Russian).
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;
end;

utMechanized:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5) + 2.0 ; // Mechanized + 2.

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
else if LU.Elite then Result := Result + 2;
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;
end;

utArmor:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5) + 3.0; // Armor + 3.

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
else if LU.Elite then Result := Result + 2;
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;
end;

utCavalry:
begin
LU := TLandUnit(U);
Result := LU.Combat;
// ****************************************************************************
// Cavalry units have movement values of either 4 or 5. Being able to move 5
// means that they can enter adjacent swamp hexes without becoming disorganized.
// ****************************************************************************
if LU.Move = 5 then Result := Result + 2.0;

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Corps sized German SS units have a garrison value of 2.
// ****************************************************************************
else if LU.Country = GermanSS.ID then Result := Result + 1.0;
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
if LU.Elite then Result := Result + 2;
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;

if Result < 1.0 then Result := 1.0;
end;

utMarine:
begin
LU := TLandUnit(U);
Result := (LU.Combat * 2) + ((LU.Move - 4.0) * 0.5); // Marine doubled.

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
else if LU.Elite then Result := Result + 2;
end;

utParatroop:
begin
LU := TLandUnit(U);
Result := (LU.Combat * 1.5) + ((LU.Move - 4.0) * 0.5); // Para * 1.5.

if LU.Small then Result := Result - 1.0
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
else if LU.Elite then Result := Result + 2;
end;

utInfantryHQ:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5);
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
if LU.Elite then Result := Result + 2;
// ****************************************************************************
// HQs belonging to major powers can act as secondary supply sources for aligned
// minor countries and cooperating major powers. That makes them superior to
// HQs belonging to minor countries, including Nationalist and Communist Chinese
// HQs.
// ****************************************************************************
if UnitHomeCountryCommonwealth(LU).ClassType = TMajorCountry then
begin
Result := Result + (LU.Reorg * 2) + 10;
end
else
begin // Minor country HQs can trace supply to their home country cities.
Result := Result + (LU.Reorg * 2) + 6;
end;
end;

utArmorHQ:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5);
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
if LU.Elite then Result := Result + 2;
// ****************************************************************************
// HQs belonging to major powers can act as secondary supply sources for aligned
// minor countries and cooperating major powers. That makes them superior to
// HQs belonging to minor countries, including Nationalist and Communist Chinese
// HQs. All armor HQs belong to major powers.
// ****************************************************************************
Result := Result + (LU.Reorg * 3) + 10;
end;

utPartisanHQ:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5);
// ****************************************************************************
// Partisan HQs belong to the USSR and Yugoslavia. The former is a major power
// and the latter is a minor country. Partisan HQs are especially nice since
// they are always in supply and do not need oil to be reorganized.
// ****************************************************************************
if UnitHomeCountryCommonwealth(LU).ClassType = TMajorCountry then
begin
Result := Result + (LU.Reorg * 2) + 12;
end
else
begin
Result := Result + (LU.Reorg * 2) + 8;
end;
// ****************************************************************************
// Add bonus for winterized units.
// ****************************************************************************
if LU.SnowUnit then Result := Result + 2;
// ****************************************************************************
// Add bonus for elite units.
// ****************************************************************************
if LU.Elite then Result := Result + 2;
end;



< Message edited by peskpesk -- 3/8/2021 7:43:45 AM >


_____________________________

"'Malta - The Thorn in Rommel's Side"
Post #: 1
RE: Combat value (CV) - 3/8/2021 7:35:56 AM   
peskpesk


Posts: 2347
Joined: 7/17/2003
From: Stockholm, Sweden
Status: offline
So far I have 2 small additions suggestions. And I made dummy code below.

1. A " Flexible bonus" for DIV. since the can: the can Invade by SCS, naval transport
air transport, Reform, invade from TRS.

Ex 2-3 INF DIV VS 2-3 MIL. I want the the CV of INF DIV to be higher.



utInfantry, utMountain, utParatrooper,utMarine:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5);


if LU.Small then Result := Result + 1
// ****************************************************************************
// Add bonus for Flexible bonus for Divisions, the can Invade by SCS, naval transport
// air transport, Reform, invade from TRS
// ****************************************************************************


2.A "Movement bonus" for 4 mp INF, MTN for Japan. The have very few of these units.
move 2 hexes in bad weather very important in ex China to outflank the opponent.
NOTE This rule could apply to other nations too, if we think so.

Ex 5-4 INF vs 6-2 MIL I want the 5-4 to be higher.


utInfantry, utMountain:
begin
LU := TLandUnit(U);
Result := LU.Combat + ((LU.Move - 4.0) * 0.5);
if LU.Country = Japan and LU.Move = 4 then Result := Result + 0.5
// ****************************************************************************
// Add bonus for movement bonus for Japanese units which can move 2 hexes in bad weather
// very important in ex China to outflank the opponent. Japan only have few of these units.
// ****************************************************************************


< Message edited by peskpesk -- 3/8/2021 7:47:55 AM >


_____________________________

"'Malta - The Thorn in Rommel's Side"

(in reply to peskpesk)
Post #: 2
RE: Combat value (CV) - 3/8/2021 8:19:28 AM   
Orm


Posts: 22154
Joined: 5/3/2008
From: Sweden
Status: offline
Should the CV consider stacking size as well? Or garrison value?

_____________________________

Have a bit more patience with newbies. Of course some of them act dumb -- they're often students, for heaven's sake. - Terry Pratchett

(in reply to peskpesk)
Post #: 3
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> World in Flames >> AI Opponent Discussion >> Combat value (CV) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

1.391