Create ranked type enum, last person not afk wins in 1v1 (#2892)

## Description:

* Add RankedType enum, for now it's just 1v1
* Add new method to MapPlaylist to create 1v1 game config
* Update WinCheck so the last player is declared a winner on 1v1.

## 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:

evan
This commit is contained in:
Evan
2026-01-13 19:48:14 -08:00
committed by GitHub
parent 247c78151c
commit 42c944c9cc
6 changed files with 275 additions and 6 deletions
+35
View File
@@ -9,6 +9,7 @@ import {
HumansVsNations,
PublicGameModifiers,
Quads,
RankedType,
Trios,
} from "../core/game/Game";
import { PseudoRandom } from "../core/PseudoRandom";
@@ -140,6 +141,40 @@ export class MapPlaylist {
} satisfies GameConfig;
}
public get1v1Config(): GameConfig {
const ffaMaps = [
GameMapType.Iceland,
GameMapType.World,
GameMapType.EuropeClassic,
GameMapType.Australia,
GameMapType.FaroeIslands,
GameMapType.Pangaea,
GameMapType.Italia,
GameMapType.FalklandIslands,
GameMapType.Sierpinski,
];
return {
donateGold: false,
donateTroops: false,
gameMap: ffaMaps[Math.floor(Math.random() * ffaMaps.length)],
maxPlayers: 2,
gameType: GameType.Public,
gameMapSize: GameMapSize.Compact,
difficulty: Difficulty.Easy,
rankedType: RankedType.OneVOne,
infiniteGold: false,
infiniteTroops: false,
maxTimerValue: 10, // 10 minutes
instantBuild: false,
randomSpawn: false,
disableNations: false,
gameMode: GameMode.FFA,
bots: 100,
spawnImmunityDuration: 5 * 10,
disabledUnits: [],
} satisfies GameConfig;
}
private getNextMap(): MapWithMode {
if (this.mapsPlaylist.length === 0) {
const numAttempts = 10000;
+2 -3
View File
@@ -8,7 +8,7 @@ import { fileURLToPath } from "url";
import { WebSocket, WebSocketServer } from "ws";
import { z } from "zod";
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
import { GameMapSize, GameType } from "../core/game/Game";
import { GameType } from "../core/game/Game";
import {
ClientMessageSchema,
GameID,
@@ -522,8 +522,7 @@ async function pollLobby(gm: GameManager) {
log.info(`Lobby poll successful:`, data);
if (data.assignment) {
const gameConfig = await playlist.gameConfig();
gameConfig.gameMapSize = GameMapSize.Compact;
const gameConfig = playlist.get1v1Config();
const game = gm.createGame(gameId, gameConfig);
setTimeout(() => {
// Wait a few seconds to allow clients to connect.