diff --git "a/docs/01_Env/ENV_07_\343\203\206\343\202\271\343\203\210\346\223\215\344\275\234\346\211\213\351\240\206.txt" "b/docs/01_Env/ENV_07_\343\203\206\343\202\271\343\203\210\346\223\215\344\275\234\346\211\213\351\240\206.txt" index ad79662..a2dce9b 100644 --- "a/docs/01_Env/ENV_07_\343\203\206\343\202\271\343\203\210\346\223\215\344\275\234\346\211\213\351\240\206.txt" +++ "b/docs/01_Env/ENV_07_\343\203\206\343\202\271\343\203\210\346\223\215\344\275\234\346\211\213\351\240\206.txt" @@ -29,7 +29,7 @@ 2-2. 設定値 ■ 接続先URL ・既定値: https://skillsemiwebgame.onrender.com -・変更方法: 環境変数で指定する +・変更方法: コマンドライン引数(--dev)または定数を編集する 3. 実行手順 (Execution Steps) @@ -43,20 +43,30 @@ 3-2. 実行 - コマンド: $ pnpm start + - 開発環境に接続する場合: $ pnpm start -- --dev 4. パラメータ一覧 (Parameters) ------------------------------------------------------------------------ -4-1. 環境変数 - ・TARGET_URL: 接続先URL +4-1. コマンドライン引数 + ・--dev: 開発環境(DEV_SERVER_URL)に接続する + +4-2. 定数 (load-bot.constants.ts) + ・URL: 本番サーバURL + ・DEV_URL: 開発サーバURL ・BOTS: 同時接続数 - ・ROOMS: ルーム数 ・DURATION_MS: 実行時間 (ms) ・JOIN_DELAY_MS: 参加間隔 (ms) - ・START_GAME: ゲーム開始の有効化 (1/0) - ・MOVE_INTERVAL_MS: 移動送信間隔 (ms) + ・MOVE_TICK_MS: 移動送信間隔 (ms) + ・BOT_SPEED: 移動速度 + ・BOT_RADIUS: プレイヤー半径 + ・START_DELAY_MS: 開始遅延 (ms) ・MAX_X: X座標上限 ・MAX_Y: Y座標上限 + ・ROOM_ID: ルームID + ・START_GAME: ゲーム開始の有効化 (true/false) + ・SOCKET_PATH: Socket.IOのパス + ・SOCKET_TRANSPORTS: Socket.IOのトランスポート 5. 出力と終了 (Output & Termination) diff --git a/test/load-bot.constants.ts b/test/load-bot.constants.ts index 553ddc6..12216fd 100644 --- a/test/load-bot.constants.ts +++ b/test/load-bot.constants.ts @@ -3,8 +3,9 @@ const { GAME_CONFIG, NETWORK_CONFIG } = config; export const URL = NETWORK_CONFIG.PROD_SERVER_URL; +export const DEV_URL = NETWORK_CONFIG.DEV_SERVER_URL; export const BOTS = 20; -export const DURATION_MS = 60_000; +export const DURATION_MS = Infinity; export const JOIN_DELAY_MS = 25; export const MOVE_TICK_MS = GAME_CONFIG.PLAYER_POSITION_UPDATE_MS; export const BOT_SPEED = GAME_CONFIG.PLAYER_SPEED; diff --git a/test/load-bot.ts b/test/load-bot.ts index 65aba05..a84b409 100644 --- a/test/load-bot.ts +++ b/test/load-bot.ts @@ -13,6 +13,7 @@ SOCKET_TRANSPORTS, START_DELAY_MS, START_GAME, + DEV_URL, URL, } from "./load-bot.constants.js"; @@ -44,8 +45,13 @@ const bots: Bot[] = []; // 既にオーナーがいるルームを追跡。 +const args = new Set(process.argv.slice(2)); +const useDev = args.has("--dev"); +const targetUrl = useDev ? DEV_URL : URL; + console.log("Load test starting...", { - url: URL, + env: useDev ? "dev" : "prod", + url: targetUrl, bots: BOTS, roomId: ROOM_ID, durationMs: DURATION_MS, @@ -63,7 +69,7 @@ for (let i = 0; i < BOTS; i += 1) { const delay = i * JOIN_DELAY_MS; setTimeout(() => { - const bot = createBot(i, stats); + const bot = createBot(i, stats, targetUrl); bots.push(bot); }, delay); } @@ -80,13 +86,13 @@ }, 500); }, DURATION_MS); -function createBot(index: number, counters: Stats): Bot { +function createBot(index: number, counters: Stats, url: string): Bot { const roomId = ROOM_ID; const playerName = `bot-${index}`; const isOwner = index === 0; // 固定トランスポートで再接続なしのクライアント接続。 - const socket = io(URL, { + const socket = io(url, { transports: SOCKET_TRANSPORTS, path: SOCKET_PATH, reconnection: false,