R.E.D. World War II development thread

Some bugs/crashes fixing, gitHub updated

DLL:
Fix Damage limit (can't receive more than 20% of our MaxHP and can't inflict more than 100% of our MaxHP in a combat)
Fix territory capture (original owner value was not saved)
Fix Best Defender selection (now based on health percentage remaining)
Crash fix (don't try to call pUnit->GetMaxHitPoints() before initializing pUnit...)

Visual:

Fix Field Gun size
 
Is there any chance the America/Europe map could be reintegrated into the next upcoming version? Would like to continue my 'mini mod' in the next version!
 
In next version the scenarios will be independent mods. I won't be able to fully convert the America/Europe scenario to the new format, but I'll try to make at least a base mod with the map you can work on.
 
Posting here my draft on population, for reference...

rename "personnel" to "enlisted" ?

CvPlayer
Code:
InitialNationPopulation // Player initial population (set in the Civilization table at <InitialNationPopulation>)

InitialRuralPopulation = InitialNationPopulation - pPlayer->getRealPopulation() // must be calculated on first turn, after setting Cities population
CurrentRuralPopulation // Player population outside of cities
CurrentNationPopulation =pPlayer->getOwnCitiesCurrentPopulation() +pPlayer->getCurrentRuralPopulation() //must not include captured cities !
CurrentOccupedPopulation =pPlayer->getCapturedCitiesCurrentPopulation()

KilledCivilians // total civilian killed
KilledPersonnel // total enlisted killed  
killedOfficers // total officers killed

killedDestroyedLandVehicles // total land vehicles (tanks, assault guns, artilleries, ...) destroyed (can't be repaired)
DestroyedAirVehicles // total air vehicles (fighters, bombers, ...) destroyed
DestroyedSeaVehicles // total ship sunk

CvCity
Code:
InitialPopulation // city initial population
CurrentPopulation// that number includeCivilianWounded (don't draft from rural population or reduce city size when there are wounded, todo : reduce productions in city with wounded ratio ?)

Personnel
Officers

WoundedCivilians
WoundedPersonnel
WoundedOfficers
Prisonners

CvUnit
Code:
Personnel
Officers
Vehicles
MaxVehicle // for sea units or other case when 1 vehicle != 1 HP

RequiredOfficersPercent
PersonnelPerHP
OfficersPerHP
MaterielPerHP
FuelConsumption

PersonnelReserve
OfficersReserve
VehiclesReserve
Materiel

WoundedPersonnel
WoundedOfficers
DamagedVehicles
Prisonners

Mechanism : Recruiting

Personnel is taken from city CurrentPopulation

Each turn cities draft population from player CurrentRuralPopulation.
Captured cities does not draft.
Size 1 cities can't recruit personnel

Define:
Code:
MAX_DRAFTED_RURAL_POPULATION_PERCENT
Pseudo code:
Code:
PersonnelRecruted =pCity->getNumRecruit();
pCity->changeCurrentPopulation( - PersonnelRecruted );
pCity->changePersonnel( PersonnelRecruted );

OfficersTrained =pCity->getNumTrainedOfficers();
pCity->changePersonnel( -OfficersTrained);
pCity->changeOfficers(OfficersTrained);

if (pCity->getOwner() ==pCity->getOriginalOwner()) // Do not draft our rural population to captured city
{
 RequiredPopulation = pCity->getInitialPopulation() - pCity->getCurrentPopulation();
 PopulationDrafted = min (pPlayer->getCurrentRuralPopulation() *MAX_DRAFTED_RURAL_POPULATION_PERCENT / 100,RequiredPopulation * (pPlayer->getCurrentRuralPopulation()* 100 /pPlayer->getInitialRuralPopulation()) / 100); // less and less population drafted from rural area
 pPlayer->changeCurrentRuralPopulation (- PopulationDrafted);
 pCity->changeCurrentPopulation ( PopulationDrafted );
}

if (((long)(pow((double)(pCity->getPopulation() - 1), 2.8))) * 1000) > pCity->GetCurrentPopulation())
 pCity->changePopulation(-1, true);

if (((long)(pow((double)(pCity->getPopulation() + 1), 2.8))) * 1000) < pCity->GetCurrentPopulation())
 pCity->changePopulation(1, true);

Mechanism : City Combat

Each attack on a city will wound or kill population (use Anti-Personnel value)

Define:
Code:
CITY_COMBAT_BASE_CASUALTY_PERCENT // (or per mil ?)
CITY_COMBAT_POSSIBLE_EXTRA_CASUALTY_PERCENT

Pseudo code:
Code:
PercentDamage = (CityMaxHealth - Damage) * 100 / CityMaxHealth;

InvolvedPopulation =(pCity->getCurrentPopulation() -pCity->getWounded())*PercentDamage / 100;

// (and calculate InvolvedWoundedCivilians,InvolvedWoundedPersonnel,InvolvedWoundedOfficers, InvolvedPersonnel, InvolvedOfficers)

Casualties =InvolvedPopulation *CITY_COMBAT_BASE_CASUALTY_PERCENT/ 100;
ExtraCasualties =( InvolvedPopulation -Casualties ) * GC.getGame().getJonRandNum(GC.getCITY_COMBAT_POSSIBLE_EXTRA_CASUALTY_PERCENT(), "population Damage") / 100;
Casualties +=ExtraCasualties;

Killed =Casualties* GC.getGame().getJonRandNum(pAttacker->getAntiPersonnelValue(), "population Damage") / 100;
Wounded =Casualties - killed;

pCity->changeCurrentPopulation( -Killed);
pPlayer->changeKilledCivilians(Killed);
pCity->changeWoundedCivilians( Wounded);

Mechanism : Unit Combat

Each attack on a unit will wound or kill personnel / officers (use Anti-Personnel value)
Each attack on a unit will damage or destroy vehicles (use Anti-Tank value)

Define:
Code:
UNIT_COMBAT_BASE_KILLED_PERCENT
UNIT_COMBAT_POSSIBLE_EXTRA_KILLED_PERCENT
UNIT_COMBAT_MAX_KILLED_PERCENT
UNIT_COMBAT_BASE_PRISONNERS_PERCENT
UNIT_COMBAT_POSSIBLE_EXTRA_PRISONNERS_PERCENT
UNIT_COMBAT_POSSIBLE_ATTACK_PRISONNERS_PERCENT
UNIT_COMBAT_POSSIBLE_RETREAT_PRISONNERS_PERCENT
UNIT_COMBAT_BASE_DESTROYED_PERCENT
UNIT_COMBAT_POSSIBLE_EXTRA_DESTROYED_PERCENT
UNIT_COMBAT_MAX_DESTROYED_PERCENT

Pseudo code:
Code:
personnelCasualties = Damage * pUnit->getPersonnelPerHP();
officersCasualties =Damage * pUnit->getOfficersPerHP();

if (pUnit->getRequiredOfficersPercent() > 0)
{
 OfficerPercent = (pUnit->getOfficers()-officersCasualties)* 100 /pUnit->getPersonnel();
 officersCasualties +=personnelCasualties *OfficerPercent/ 100;
}

vehicleCasualties = Damage; // 1 HP = 1 vehicle

// Personnel killed

killpercent = GC.getUNIT_COMBAT_BASE_KILLED_PERCENT();
killpercent += GC.getGame().getJonRandNum(GC.getUNIT_COMBAT_POSSIBLE_EXTRA_KILLED_PERCENT(), "personnel Killed");
killpercent += GC.getGame().getJonRandNum(pOtherUnit->getAntiPersonnelValue(), "personnel Killed by AP");
killpercent = min(killpercent,GC.getUNIT_COMBAT_MAX_KILLED_PERCENT());

personnelKilled = min(personnelCasualties ,personnelCasualties*killpercent/ 100);
personnelCasualties -= personnelKilled;

// those that are not killed are either prisonners or wounded

capturedPercent = GC.getUNIT_COMBAT_BASE_PRISONNERS_PERCENT();
capturedPercent += GC.getGame().getJonRandNum(GC.getUNIT_COMBAT_POSSIBLE_EXTRA_PRISONNERS_PERCENT(), "personnel Captured");

if (bDefend)
 capturedPercent += GC.getGame().getJonRandNum(GC.getUNIT_COMBAT_POSSIBLE_ATTACK_PRISONNERS_PERCENT(), "personnel Captured");

if (bRetreat)
 capturedPercent += GC.getGame().getJonRandNum(GC.getUNIT_COMBAT_POSSIBLE_ATTACK_PRISONNERS_PERCENT(), "personnel Captured");

personnelCaptured= min(personnelCasualties*capturedPercent/ 100,personnelCasualties);
personnelCasualties- = personnelCaptured;

// only wounded left

personnelWounded = personnelCasualties;
 
Well there were Waffen-SS units from other countries, so maybe recruiting for the SS?
 
you'll still be able to recruit in captured cities.
 
Speaking of Foreign units, is it possible to create a function where AI units will be placed under your control after a condition has been met? Example would be Germany taking control of all Italian units in Africa if Tripoli falls.
 
yes, see the code that give french units to it's colony on Fall of France.
 
Updated the DLL on gitHub with the converted code for plot capture and switching owner when surrounding portions of ennemy territory that are not linked to (controlled by) one of it's cities or units.

I've also updated the R.E.D. WWII Reloaded files, the mouse over plot now show if an unit or a city is in range to control that plot.

there is also a visual text (like the healing/damage values) over plots changing ownership when the map is updated.

and I've also cleaned the OP.
 
A guide on creating scenarios? Seems intressting cause I want to make a 1st January 1945 scenario.
 
Yes, but that can't be done before all the mechanisms to load a scenario in the main mod are defined.
 
BTW we'll need a complete city listing.

edit: the convoy mechanism will use the TXT_KEY_CITY_[name] to create routes, so that's something that must be done for at least exporting/importing cities on a map.
 
RED WWII Reloaded <- updated
RED WWII DLL <- updated

DLL:
Add <FirePoints> to Units table, used to limit support and counter-fire
Add various settings to support/counter-fire rules
Stacking weight is now related to units health

UI:
Show "stacking weight" on unit flag and "filling percentage" in mouse over plot
Display correct value on combat preview (compute damage from first level defensive/offensive fire support and counter-fire)
 
Hey are the above files for RED WW2 and if so how do i go about installing them? Or are the above files just for testing out the new product you are building?
 
Those are the files for the new version, if you have correctly installed modbuddy you just need to build the project and the mod(s) will be available in Civ5 (except the DLL link that is just for those that want to see/edit/build the C++ code, the DLL itself is included in "Reloaded")

You also need the updated data files and the test map (see OP) and either firetuner of IGE to put stuff on the map.

The more people that are able to use this, the better, I welcome feedback/suggestions at any stage of the development (I'd say it's "pre-alpha" for the new version/framework)
 
I'm converting the supply lines code from Lua, I've got something working, but I need feedback... In v.44 (and before) the supply line can have an infinite length, but:

- should we have a limited range to get supply ?
- should we scale the available supplies for an unit with the distance to the city providing those supplies ?
- should we link to the closest city or the one with the most supply ? Or weight both ?

Other suggestions on the supply line mechanism ?
 
I'm converting the supply lines code from Lua, I've got something working, but I need feedback... In v.44 (and before) the supply line can have an infinite length, but:


- should we link to the closest city or the one with the most supply ? Or weight both ?

Other suggestions on the supply line mechanism ?

- should we have a limited range to get supply ?

I dont think so, supply ships where going from US to Arkhangelsk and from US to Philippine. That is quite a distance.

- should we scale the available supplies for an unit with the distance to the city providing those supplies ?

Not sure I understand that, you mean for a nation to have the required supply to build units? If they start with a reserve of supply, that can be the answer.

- should we link to the closest city or the one with the most supply ? Or weight both ?

For supply ships, it should be the closest inland city with an habor. Harbor can be seen as some sort of dépot? For ground supply like Romanian oil for Germany it should be the closest city with accomodation like raffinery for oil?
 
By the way, did the coal processing plant where producing ready to use oil or it have to be refined after? But since its a game, anything is possible.
 
- should we have a limited range to get supply ?

I dont think so, supply ships where going from US to Arkhangelsk and from US to Philippine. That is quite a distance.

- should we scale the available supplies for an unit with the distance to the city providing those supplies ?

Not sure I understand that, you mean for a nation to have the required supply to build units? If they start with a reserve of supply, that can be the answer.

- should we link to the closest city or the one with the most supply ? Or weight both ?

For supply ships, it should be the closest inland city with an habor. Harbor can be seen as some sort of dépot? For ground supply like Romanian oil for Germany it should be the closest city with accomodation like raffinery for oil?
I'm not talking of convoy/resource, sorry for the misunderstanding.

I mean the supply line between a land unit and a city to check each turn if the unit can get reinforcement and "heal".
 
Well, after a given distance. Let say 5 or 10 depending on the size of the map there is a penalty increasing with the distance!
 
Top Bottom