Lobby Gold Options (Starting Gold, Gold Multiplier) 💰 (#2915)

## Description:

We might want to add this to v29 to have a third possible public game
modifier from the beginning on 😄 Would be fun

- Add starting gold option (0 to 1_000_000_000 allowed, also applies to
nations)
- Add gold multiplier option (0.1 to 1000 allowed, also applies to
nations and bots)
- Add third public game modifier (3% chance of starting with 5M gold)
- Why 5M? It's enough gold to massively change the game start but not
enough to insta-hydro someone (launcher + hydro is 6M)

<img width="357" height="140" alt="image"
src="https://github.com/user-attachments/assets/72acc15c-e788-4e04-8590-ac72dd9657c7"
/>


## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

FloPinguin
This commit is contained in:
FloPinguin
2026-01-16 19:19:41 +01:00
committed by evanpelle
parent d0fda1d535
commit 4e8454f3cc
11 changed files with 488 additions and 14 deletions
+6 -2
View File
@@ -127,14 +127,18 @@ export class GameServer {
if (gameConfig.gameMode !== undefined) {
this.gameConfig.gameMode = gameConfig.gameMode;
}
if (gameConfig.disabledUnits !== undefined) {
this.gameConfig.disabledUnits = gameConfig.disabledUnits;
}
if (gameConfig.playerTeams !== undefined) {
this.gameConfig.playerTeams = gameConfig.playerTeams;
}
if (gameConfig.goldMultiplier !== undefined) {
this.gameConfig.goldMultiplier = gameConfig.goldMultiplier;
}
if (gameConfig.startingGold !== undefined) {
this.gameConfig.startingGold = gameConfig.startingGold;
}
}
public joinClient(client: Client) {
+6 -2
View File
@@ -94,7 +94,9 @@ export class MapPlaylist {
const playerTeams =
mode === GameMode.Team ? this.getTeamCount() : undefined;
let { isCompact, isRandomSpawn } = this.getRandomPublicGameModifiers();
const modifiers = this.getRandomPublicGameModifiers();
const { startingGold } = modifiers;
let { isCompact, isRandomSpawn } = modifiers;
// Duos, Trios, and Quads should not get random spawn (as it defeats the purpose)
if (
@@ -122,7 +124,8 @@ export class MapPlaylist {
maxPlayers: await this.lobbyMaxPlayers(map, mode, playerTeams, isCompact),
gameType: GameType.Public,
gameMapSize: isCompact ? GameMapSize.Compact : GameMapSize.Normal,
publicGameModifiers: { isCompact, isRandomSpawn },
publicGameModifiers: { isCompact, isRandomSpawn, startingGold },
startingGold,
difficulty:
playerTeams === HumansVsNations
? Difficulty.Impossible
@@ -198,6 +201,7 @@ export class MapPlaylist {
return {
isRandomSpawn: Math.random() < 0.1, // 10% chance
isCompact: Math.random() < 0.05, // 5% chance
startingGold: Math.random() < 0.03 ? 5_000_000 : undefined, // 3% chance
};
}