## Description:

- Add trios and quads
- Add translations for duos, trios, quads
- Add duos, trios, quads to the public lobby rotation
- Increase the frequency of team games


![image](https://github.com/user-attachments/assets/a7bac4e7-9db2-486d-87bc-5779dd64da08)

![image](https://github.com/user-attachments/assets/c1b9225e-2193-4776-b97f-be01a1bdeeed)

## 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
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
This commit is contained in:
Scott Anderson
2025-07-06 20:09:18 -04:00
committed by GitHub
parent 6353a5d6f7
commit 3a8ff6304a
10 changed files with 106 additions and 45 deletions
+24 -9
View File
@@ -1,13 +1,16 @@
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
import {
Difficulty,
Duos,
GameMapType,
GameMode,
GameType,
Quads,
Trios,
UnitType,
} from "../core/game/Game";
import { PseudoRandom } from "../core/PseudoRandom";
import { GameConfig } from "../core/Schemas";
import { GameConfig, TeamCountConfig } from "../core/Schemas";
import { logger } from "./Logger";
const log = logger.child({});
@@ -45,19 +48,31 @@ interface MapWithMode {
mode: GameMode;
}
const TEAM_COUNTS = [
2,
3,
4,
5,
6,
7,
Duos,
Trios,
Quads,
] as const satisfies TeamCountConfig[];
export class MapPlaylist {
private mapsPlaylist: MapWithMode[] = [];
public gameConfig(): GameConfig {
const { map, mode } = this.getNextMap();
const numPlayerTeams =
mode === GameMode.Team ? 2 + Math.floor(Math.random() * 5) : undefined;
const playerTeams =
mode === GameMode.Team ? this.getTeamCount() : undefined;
// Create the default public game config (from your GameManager)
return {
gameMap: map,
maxPlayers: config.lobbyMaxPlayers(map, mode, numPlayerTeams),
maxPlayers: config.lobbyMaxPlayers(map, mode, playerTeams),
gameType: GameType.Public,
difficulty: Difficulty.Medium,
infiniteGold: false,
@@ -65,12 +80,16 @@ export class MapPlaylist {
instantBuild: false,
disableNPCs: mode === GameMode.Team,
gameMode: mode,
playerTeams: numPlayerTeams,
playerTeams,
bots: 400,
disabledUnits: [UnitType.Train, UnitType.Factory],
} satisfies GameConfig;
}
private getTeamCount(): TeamCountConfig {
return TEAM_COUNTS[Math.floor(Math.random() * TEAM_COUNTS.length)];
}
private getNextMap(): MapWithMode {
if (this.mapsPlaylist.length === 0) {
const numAttempts = 10000;
@@ -98,7 +117,6 @@ export class MapPlaylist {
const ffa1: GameMapType[] = rand.shuffleArray([...maps]);
const ffa2: GameMapType[] = rand.shuffleArray([...maps]);
const ffa3: GameMapType[] = rand.shuffleArray([...maps]);
const team: GameMapType[] = rand.shuffleArray([...maps]);
this.mapsPlaylist = [];
@@ -109,9 +127,6 @@ export class MapPlaylist {
if (!this.addNextMap(this.mapsPlaylist, ffa2, GameMode.FFA)) {
return false;
}
if (!this.addNextMap(this.mapsPlaylist, ffa3, GameMode.FFA)) {
return false;
}
if (!this.addNextMap(this.mapsPlaylist, team, GameMode.Team)) {
return false;
}