BeamNG.Earth
BeamNG.drive용 1:1 비율 실시간 지구, 실제 고도·위성 이미지·부동 원점·보조 서버에서 LOD 스트리밍
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
multiplayer chess game
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
A modern, mobile-friendly two-player online chess game built with Next.js (App Router).
Two people log in with a shared password, each claim a color from their own device, and
play in near-real-time. Game state is persisted server-side so it survives refreshes,
new devices, and Vercel's stateless serverless functions.README 전문 보기 ↗A modern, mobile-friendly two-player online chess game built with Next.js (App Router). Two people log in with a shared password, each claim a color from their own device, and play in near-real-time. Game state is persisted server-side so it survives refreshes, new devices, and Vercel's stateless serverless functions.
chess.js, validated server-side so no illegal moves are possible.npm install
cp .env.example .env.local # then edit the values
npm run dev
Open http://localhost:3000. A .env.local with a dev password is already included
(GAME_PASSWORD=letmein). With no Redis credentials set, the app uses in-memory storage —
perfect for local testing (state resets when the dev server restarts).
To play a real 2-player game locally, open the app in two different browsers (or one normal
| Variable | Purpose |
|---|---|
GAME_PASSWORD | The single shared password both players type to enter. |
SESSION_SECRET | Long random string used to sign the auth cookie. |
| Edge Config | |
EDGE_CONFIG | Read connection string, auto-injected when you connect an Edge Config store. Read-only. |
VERCEL_API_TOKEN | Vercel API token (Account → Settings → Tokens) — required for writes, since Edge Config writes go through the Vercel REST API. |
VERCEL_TEAM_ID | Only if the Edge Config store belongs to a Vercel team. |
| or Redis / KV | |
KV_REST_API_URL / KV_REST_API_TOKEN | Redis REST credentials (Vercel KV). UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN also work. |
The backend is chosen automatically: Edge Config if EDGE_CONFIG is present, else Redis if the KV/Upstash vars are present, else in-memory.
Generate a session secret:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
EDGE_CONFIG).
Then create a Vercel API token (Account → Settings → Tokens) and add it as
VERCEL_API_TOKEN so the app can write moves. Add VERCEL_TEAM_ID too if the store
lives under a team.KV_REST_API_URL / KV_REST_API_TOKEN).Without any store the app still runs, but in-memory state resets on cold start — fine for a demo, not for real games.
GAME_PASSWORD and SESSION_SECRET under Settings → Environment Variables.Edge Config notes: it's read-optimized (ideal for the polling reads) and writes are rate-limited, but a turn-based game only writes on a move / seat claim / reset, so the write volume is tiny. Writes propagate globally within a second or two, so an opponent sees your move on their next poll. Because Edge Config is eventually consistent (a read just after a write can briefly return the previous version), each game state carries a strictly-increasing
updatedAt, and the client ignores any polled state older than the one it already shows — so the board never regresses (e.g. flips back to a finished game right after "New game"). If you want snappier, strongly-consistent sync, switch to Vercel KV / Upstash Redis by setting theKV_*env vars instead; no code changes needed.
middleware.ts gates / and /api/game behind the signed auth cookie.lib/game.ts holds the single source of truth. Every move is re-validated against the
stored FEN with chess.js; the server enforces turn order and seat ownership.chess_client id used to bind it to the White or Black seat.GET /api/game every 1.5s and re-renders on change.A seat is bound to the browser that claimed it (via an httpOnly cookie). If a player clears
their cookies they'll rejoin as a spectator; use New game or clear the Redis key
(chess:game:main) to free the seats.