Adjusting the number of colonies being built (fewer) and reduces cheating. The AI trade profit modifier is now reduced linearly until a turn number determined by a new option. The AI difficulty and colony expansion has been tuned for the default (small) map. We might want to make the number of colonies being built by the AI depend on the map size.

This commit is contained in:
Stian Grenborgen 2023-05-06 10:02:23 +02:00
parent 112201316a
commit 2d668b5676
6 changed files with 58 additions and 41 deletions

View File

@ -3518,21 +3518,23 @@
</optionGroup>
<optionGroup id="model.difficulty.cheat" editable="false">
<integerOption id="model.option.liftBoycottCheat"
value="1"/>
value="0"/>
<integerOption id="model.option.equipScoutCheat"
value="1"/>
value="0"/>
<integerOption id="model.option.equipPioneerCheat"
value="1"/>
value="0"/>
<integerOption id="model.option.landUnitCheat"
value="1"/>
value="0"/>
<integerOption id="model.option.offensiveLandUnitCheat"
value="0"/>
<integerOption id="model.option.offensiveNavalUnitCheat"
value="1"/>
value="0"/>
<integerOption id="model.option.transportNavalUnitCheat"
value="1"/>
value="0"/>
<integerOption id="model.option.tradeProfitMultiplierCheat"
value="1"/>
<integerOption id="model.option.tradeProfitMultiplierCheatTurns"
value="0"/>
</optionGroup>
</optionGroup>
@ -3722,9 +3724,11 @@
<integerOption id="model.option.offensiveNavalUnitCheat"
value="5"/>
<integerOption id="model.option.transportNavalUnitCheat"
value="5"/>
value="0"/>
<integerOption id="model.option.tradeProfitMultiplierCheat"
value="2"/>
<integerOption id="model.option.tradeProfitMultiplierCheatTurns"
value="200"/>
</optionGroup>
</optionGroup>
@ -3909,9 +3913,11 @@
<integerOption id="model.option.offensiveNavalUnitCheat"
value="10"/>
<integerOption id="model.option.transportNavalUnitCheat"
value="10"/>
value="4"/>
<integerOption id="model.option.tradeProfitMultiplierCheat"
value="5"/>
value="4"/>
<integerOption id="model.option.tradeProfitMultiplierCheatTurns"
value="200"/>
</optionGroup>
</optionGroup>
@ -4093,6 +4099,8 @@
value="15"/>
<integerOption id="model.option.tradeProfitMultiplierCheat"
value="10"/>
<integerOption id="model.option.tradeProfitMultiplierCheatTurns"
value="200"/>
</optionGroup>
</optionGroup>
@ -4273,7 +4281,9 @@
<integerOption id="model.option.transportNavalUnitCheat"
value="20"/>
<integerOption id="model.option.tradeProfitMultiplierCheat"
value="15"/>
value="30"/>
<integerOption id="model.option.tradeProfitMultiplierCheatTurns"
value="400"/>
</optionGroup>
</optionGroup>
@ -4549,6 +4559,8 @@
value="20"/>
<integerOption id="model.option.tradeProfitMultiplierCheat"
value="15"/>
<integerOption id="model.option.tradeProfitMultiplierCheatTurns"
value="400"/>
</optionGroup>
</optionGroup>
</optionGroup>

View File

@ -683,6 +683,8 @@ model.option.transportNavalUnitCheat.name=Get Transport Naval Unit
model.option.transportNavalUnitCheat.shortDescription=Percent chance per turn of an AI building a free naval transport unit in Europe (if it has work for more transport units).
model.option.tradeProfitMultiplierCheat.name=A multiplier for AI trading profits.
model.option.tradeProfitMultiplierCheat.shortDescription=The AI gets its profits from any sale in Europe multiplied by this amount.
model.option.tradeProfitMultiplierCheatTurns.name=Number of turns for the multiplier above.
model.option.tradeProfitMultiplierCheatTurns.shortDescription=The AI trading profits multiplier will be linearly reduced until this amount of turns.
# GameOptions
gameOptions.name=Game Options

View File

@ -2735,6 +2735,7 @@ public final class Specification implements OptionContainer {
// @compat 1.0.0
ret |= checkDifficultyIntegerOption(GameOptions.TRADE_PROFIT_MULTIPLIER_CHEAT, GameOptions.DIFFICULTY_CHEAT, lb, 10);
ret |= checkDifficultyIntegerOption(GameOptions.TRADE_PROFIT_MULTIPLIER_CHEAT_TURNS, GameOptions.DIFFICULTY_CHEAT, lb, 200);
// end @compat 1.0.0
// Ensure 2 levels of groups, and one level of leaves

View File

@ -529,6 +529,8 @@ public class GameOptions {
public static final String TRADE_PROFIT_MULTIPLIER_CHEAT
= "model.option.tradeProfitMultiplierCheat";
public static final String TRADE_PROFIT_MULTIPLIER_CHEAT_TURNS
= "model.option.tradeProfitMultiplierCheatTurns";
// Serialization

View File

@ -547,18 +547,6 @@ public class EuropeanAIPlayer extends MissionAIPlayer {
}
}
}
if (!getAIColonies().isEmpty()) {
/*
* It's no fun if the AI explores all the lost city rumours right from
* the beginning of the game, or if it's aggressively trading with the
* natives.
*
* We need to compensate for the lack of such activities by gaining
* some gold every turn.
*/
getPlayer().modifyGold(100);
}
if (!europe.isEmpty()
&& scoutsNeeded() > 0
@ -1450,29 +1438,30 @@ public class EuropeanAIPlayer extends MissionAIPlayer {
Player player = getPlayer();
if (!player.canBuildColonies()) return 0;
int nColonies = 0, nPorts = 0, nWorkers = 0, nEuropean = 0;
int nColonies = 0, nPorts = 0, nColonySize1 = 0;
for (Settlement settlement : player.getSettlementList()) {
nColonies++;
if (settlement.isConnectedPort()) nPorts++;
nWorkers += count(settlement.getAllUnitsList(), Unit::isPerson);
final int colonySize = settlement.getUnitList().size();
if (colonySize == 1) {
nColonySize1++;
}
}
Europe europe = player.getEurope();
nEuropean = (europe == null) ? 0
: count(europe.getUnits(), Unit::isPerson);
// If would be good to have at least two colonies, and at least
// one port. After that, determine the ratio of workers to colonies
// (which should be the average colony size), and if that is above
// a threshold, send out another colonist.
// The threshold probably should be configurable. 2 is too
// low IMHO as it makes a lot of brittle colonies, 3 is too
// high at least initially as it makes it hard for the initial
// colonies to become substantial. For now, arbitrarily choose e.
return (nColonies == 0 || nPorts == 0) ? 2
: ((nPorts <= 1) && (nWorkers + nEuropean) >= 3) ? 1
: ((double)(nWorkers + nEuropean) / nColonies > Math.E) ? 1
: 0;
if (nPorts == 0) {
return 2;
}
if (nPorts == 1) {
return 1;
}
if (nColonies < 3) {
return 1;
}
if (nColonySize1 < 2) {
return 1;
}
return 0;
}

View File

@ -1306,8 +1306,19 @@ public class ServerPlayer extends Player implements TurnTaker {
* For example, the human player can still actively reduce the amount of
* money the AI gets by stopping cargo / capture colonies with custom houses.
*/
final int tradeProfitMultiplierCheat = getSpecification().getInteger(GameOptions.TRADE_PROFIT_MULTIPLIER_CHEAT);
modifyGold(incomeAfterTaxes * tradeProfitMultiplierCheat);
final int tradeProfitMultiplierCheatTurns = getSpecification().getInteger(GameOptions.TRADE_PROFIT_MULTIPLIER_CHEAT_TURNS);
/*
* Linear reduction of the tradeProfitMultiplierCheat from the first year
* until turn number tradeProfitMultiplierCheatTurns.
*/
final double currentMultiplier = Math.max(1.0D,
tradeProfitMultiplierCheat * ((double) tradeProfitMultiplierCheatTurns - getGame().getTurn().getNumber()) / tradeProfitMultiplierCheatTurns);
final int adjustedGoldAfterCheating = (int) (incomeAfterTaxes * currentMultiplier);
modifyGold(adjustedGoldAfterCheating);
} else {
modifyGold(incomeAfterTaxes);
}