attempt fix private game not connecting

This commit is contained in:
Evan
2024-12-07 20:55:47 -08:00
parent 7669105a1b
commit 0a29a1fe90
5 changed files with 14 additions and 12 deletions
+2 -2
View File
@@ -210,11 +210,11 @@
* add radiation from nuke DONE 12/4/2024
* add cities DONE 12/4/2024
* write multiplayer games to GCS DONE 12/6/2024
* write single player games to GCS
* write single player games to GCS DONE 12/7/2024
* bugfix: private game host game doesn't start
* bufix: mini map doesn't load in time
* record game winner
* record game difficulty
* bufix: mini map doesn't load in time
* standardize game ids
* record commit hash of game
* store metadata in BigQuery
+1
View File
@@ -154,6 +154,7 @@ export class GameRunner {
}
if (message.type == "turn") {
if (!this.hasJoined) {
this.transport.joinGame(0)
return
}
if (this.turns.length != message.turn.turnNumber) {
-4
View File
@@ -84,10 +84,6 @@ class Client {
);
}
private stopGame() {
this?.gameStop?.()
}
private async handleLeaveLobby(event: CustomEvent) {
if (this.gameStop == null) {
return
+7 -2
View File
@@ -32,10 +32,11 @@ export type Turn = z.infer<typeof TurnSchema>
export type GameConfig = z.infer<typeof GameConfigSchema>
export type ClientMessage = ClientPingMessage | ClientIntentMessage | ClientJoinMessage
export type ServerMessage = ServerSyncMessage | ServerStartGameMessage
export type ServerMessage = ServerSyncMessage | ServerStartGameMessage | ServerPingMessage
export type ServerSyncMessage = z.infer<typeof ServerTurnMessageSchema>
export type ServerStartGameMessage = z.infer<typeof ServerStartGameMessageSchema>
export type ServerPingMessage = z.infer<typeof ServerPingMessageSchema>
export type ClientPingMessage = z.infer<typeof ClientPingMessageSchema>
export type ClientIntentMessage = z.infer<typeof ClientIntentMessageSchema>
@@ -193,6 +194,10 @@ export const ServerTurnMessageSchema = ServerBaseMessageSchema.extend({
turn: TurnSchema,
})
export const ServerPingMessageSchema = ServerBaseMessageSchema.extend({
type: z.literal('ping')
})
export const ServerStartGameMessageSchema = ServerBaseMessageSchema.extend({
type: z.literal('start'),
// Turns the client missed if they are late to the game.
@@ -201,7 +206,7 @@ export const ServerStartGameMessageSchema = ServerBaseMessageSchema.extend({
})
export const ServerMessageSchema = z.union([ServerTurnMessageSchema, ServerStartGameMessageSchema]);
export const ServerMessageSchema = z.union([ServerTurnMessageSchema, ServerStartGameMessageSchema, ServerPingMessageSchema]);
// Client
+4 -4
View File
@@ -15,10 +15,10 @@ export const devConfig = new class extends DefaultConfig {
percentageTilesOwnedToWin(): number {
return 95
}
// numSpawnPhaseTurns(gameType: GameType): number {
// return 40
// // return 100
// }
numSpawnPhaseTurns(gameType: GameType): number {
return 40
// return 100
}
gameCreationRate(): number {
return 10 * 1000
}