diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ff623c8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,29 @@ +# Normalize line endings; Unity is happiest with LF for its YAML text assets. +* text=auto eol=lf +*.cs text diff=csharp eol=lf + +# Unity YAML text assets — mergeable with UnityYAMLMerge +*.unity merge=unityyamlmerge eol=lf +*.prefab merge=unityyamlmerge eol=lf +*.asset merge=unityyamlmerge eol=lf +*.meta merge=unityyamlmerge eol=lf +*.mat merge=unityyamlmerge eol=lf +*.anim merge=unityyamlmerge eol=lf +*.controller merge=unityyamlmerge eol=lf + +# Common binary asset types (mark binary so git doesn't mangle them) +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.psd binary +*.fbx binary +*.obj binary +*.wav binary +*.mp3 binary +*.ogg binary +*.dll binary +*.a binary +*.so binary + +# NOTE: no Git LFS yet. Add it (and move large binaries to LFS) once real art/audio lands. diff --git a/.gitignore b/.gitignore index 4e649ae..631f2a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Secrets — never commit +# ---- Secrets — never commit ---- .env .env.* !.env.example @@ -11,32 +11,64 @@ credentials/ .aws/ .ssh/ -# Dependencies / build artifacts +# ---- Unity ---- +# Generated / cache folders (must not be committed) +[Ll]ibrary/ +[Tt]emp/ +[Oo]bj/ +[Bb]uild/ +[Bb]uilds/ +[Ll]ogs/ +[Uu]ser[Ss]ettings/ +[Mm]emoryCaptures/ +[Rr]ecordings/ +.consulo/ +# Asset meta data should only be ignored when the corresponding asset is also ignored +!/[Aa]ssets/**/*.meta +# Unity3D-generated IDE/solution files +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db +# Unity3D build/crash files +sysinfo.txt +*.apk +*.aab +*.unitypackage +*.app +crashlytics-build.properties +# Visual Studio / Rider +.vs/ +.idea/ +ExportedObj/ +.gradle/ + +# ---- Editor / OS noise ---- +.DS_Store +Thumbs.db +.vscode/ +*.swp +*.swo + +# ---- Claude local settings (per-machine) ---- +.claude/settings.local.json + +# ---- Misc dependencies / build artifacts (non-Unity tooling) ---- node_modules/ __pycache__/ *.py[cod] .venv/ venv/ -env/ dist/ -build/ -target/ -*.egg-info/ - -# Editor / OS noise -.DS_Store -Thumbs.db -.vscode/ -.idea/ -*.swp -*.swo - -# Logs / caches *.log .cache/ -.pytest_cache/ -.mypy_cache/ -.ruff_cache/ -coverage/ -.coverage -.nyc_output/ diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..efe9797 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "unity": { + "type": "http", + "url": "http://172.27.208.1:8080/mcp" + } + } +} diff --git a/.mcp.json.example b/.mcp.json.example new file mode 100644 index 0000000..7d9d2a2 --- /dev/null +++ b/.mcp.json.example @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "unity": { + "type": "http", + "url": "http://:8080/mcp" + } + } +} diff --git a/CLAUDE.md b/CLAUDE.md index 1e8cbd8..5e4d742 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,7 +12,7 @@ A ~25-player "friendslop" party game: teams cobble a janky physics robot from th ## Project-specific notes - **Engine: Unity.** Decided after a netcode/prior-art study (see `DESIGN.md` → *Tech direction*). The physics-party genre is overwhelmingly Unity; the defining risk is networked physics at ~25-player scale. -- **The Unity project lives on the Windows host** (like the UE projects on `F:\`), because the editor must run on Windows. This WSL-side repo is the **project home**: durable memory, the full design record (`DESIGN.md`), build-plans (`docs/`), and any ops/bridge scripts. The Unity project's own files (`Assets/`, `ProjectSettings/`, `Packages/`) get version-controlled separately once created — decide git-on-`F:\` vs symlink then. +- **Everything lives at `F:\jankenstein`** (= `/mnt/f/jankenstein` from WSL; `~/claude/projects/jankenstein` is a symlink to it). One unified folder: the git repo, the design docs, **and** the Unity project (`Assets/`, `Packages/`, `ProjectSettings/`) all together, because the Unity Editor must run on Windows. Git runs from WSL over `/mnt/f` (`core.filemode false` set). Unity-aware `.gitignore`/`.gitattributes` are in place (no Git LFS yet — add when real binary assets land). - **`DESIGN.md`** is the complete design record carried over from the idea's `plan.md` (control feel v0.1, weapon archetypes, lobby math, tech direction). `memory.md` is the distilled decisions + live TODOs; `DESIGN.md` is the deep detail. - **Current focus:** a throwaway **networked prototype** — Unity **Netcode for GameObjects (NGO) + Relay**, host-authoritative, friends join by code. Milestone 1 = one shared bot, each player drives one tread. See `docs/prototype-plan.md`. This prototype's netcode is **not** the final architecture (server-auth vs Photon Quantum is still deferred). -- **Claude-in-editor:** plan to stand up a Unity MCP server (CoplayDev/unity-mcp or IvanMurzak/Unity-MCP) host-side, bridged to WSL the same way the UE servers are (HTTP + non-loopback bind + host IP). Not set up yet. +- **Claude-in-editor (Unity MCP):** config is seeded — `.mcp.json` registers a `unity` HTTP server at `http://172.27.208.1:8080/mcp`; full runbook in `docs/mcp-setup.md`. Server = CoplayDev/unity-mcp run in **HTTP mode host-side**, reached across the WSL boundary by the Windows host IP (same shape as the UE nwiro/ChiR24 servers). Requires the Unity Editor open + the package installed + the bridge (0.0.0.0 bind or `netsh portproxy` on :8080). Verify with `mcp__unity__*` tools. Editor must be running for the tools to work; re-check the gateway IP if it stops connecting. diff --git a/docs/mcp-setup.md b/docs/mcp-setup.md new file mode 100644 index 0000000..e905762 --- /dev/null +++ b/docs/mcp-setup.md @@ -0,0 +1,48 @@ +# Unity MCP setup — Claude (WSL) driving the Unity Editor (Windows) + +**Goal:** let Claude Code (running in WSL) control the Unity Editor (running on the Windows host) via MCP — the same pattern our UE projects already use (nwiro / ChiR24): the MCP server runs **host-side over HTTP**, and Claude in WSL connects across the WSL↔Windows boundary by its host IP. + +**Server:** [CoplayDev/unity-mcp](https://github.com/CoplayDev/unity-mcp) ("MCP for Unity", MIT, ~12k★). Chosen because it's the most popular/maintained and — critically — supports an **HTTP transport** (`url: http://host:8080/mcp`), which bridges the WSL boundary cleanly instead of a same-machine stdio assumption. + +> The in-editor **"Configure All Detected Clients"** button will *not* find WSL's `claude` (it looks on Windows), so we configure Claude manually via the committed `.mcp.json` (already in this repo) pointed at the Windows host IP. + +## Current values (this machine) + +- **Windows host IP as seen from WSL:** `172.27.208.1` (the WSL default gateway; confirm with `ip route show default`). This can change across WSL restarts — if MCP stops connecting, re-check it and update `.mcp.json`. +- **MCP HTTP port:** `8080` (CoplayDev default). If something else on Windows already uses 8080, change it in the Unity panel and in `.mcp.json`. +- **`.mcp.json`** (committed) → `{"unity": {"type":"http","url":"http://172.27.208.1:8080/mcp"}}` +- **`.claude/settings.local.json`** (local) pre-enables the `unity` server. + +## One-time setup (do on Windows, in the Unity Editor) + +1. **Create/open the Unity project** at `F:\jankenstein` (Unity LTS). This repo already lives there — Unity will add `Assets/`, `Packages/`, `ProjectSettings/` alongside the existing files. +2. **Install the package:** `Window → Package Manager → + → Add package from git URL…` + ``` + https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main + ``` +3. **Open** `Window → MCP for Unity`. Switch the transport to **HTTP** and **Start** the server (listens on `:8080`). Note the exact port shown. +4. **Make it reachable from WSL.** The HTTP server binds loopback by default, so pick one: + - **(a)** If the panel exposes a non-loopback / `0.0.0.0` / "listen on all interfaces" option, enable it. Then WSL reaches it directly at `http://172.27.208.1:8080/mcp`. + - **(b)** Otherwise add a Windows port-proxy + firewall rule (admin PowerShell) — same trick pair-o-dox uses for nwiro: + ```powershell + netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8080 connectaddress=127.0.0.1 connectport=8080 + New-NetFirewallRule -DisplayName "Unity MCP 8080" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8080 + ``` + Remove later with `netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=8080`. + +## Connect from WSL (Claude Code) + +1. Make sure the Unity Editor is **running with the project open** and the MCP server is **Started** (step 3 above) — the tools only work while the editor is live. +2. Run Claude from this folder (`/mnt/f/jankenstein`, or the symlink `~/claude/projects/jankenstein`). The committed `.mcp.json` + `.claude/settings.local.json` register/enable the `unity` server. +3. **Restart the Claude session** after any transport or `.mcp.json` change so it re-reads the config. +4. **Verify:** Claude should see `mcp__unity__*` tools. Quick smoke test: ask it to read the open scene / list GameObjects. If it fails: + - `curl -s http://172.27.208.1:8080/mcp` from WSL — no response ⇒ the bridge (step 4) isn't up or the IP changed. + - Confirm the editor is open and the server Started. + - Re-check the gateway IP (`ip route show default`). + +## Gotchas + +- **Editor must be open** with the project loaded — MCP drives the live editor, it doesn't launch it. +- **IP drift:** the WSL gateway IP (`172.27.208.1`) can change on WSL restart; update `.mcp.json` if so. +- **HTTP↔stdio toggling** in the Unity panel requires a Claude restart to pick up. +- This is **editor tooling**, unrelated to the game's own netcode (NGO + Relay) — different layer entirely. diff --git a/memory.md b/memory.md index 0f016a5..a7f6fa2 100644 --- a/memory.md +++ b/memory.md @@ -2,6 +2,8 @@ Durable memory for this project. Read at session start, update before session end. Date format: `YYYY-MM-DD`. Deep design detail lives in `DESIGN.md` (the full record carried over from the idea's `plan.md`); this file is the distilled decisions + live work. +> **Location:** this project lives at **`/mnt/f/jankenstein`** (Windows `F:\jankenstein`) so the Unity Editor (Windows-only) and the git repo/docs share one folder. `~/claude/projects/jankenstein` is a **symlink** to it. Work from either path. + ## Decisions & rationale - **Concept (locked).** ~25-player friendslop build-brawl: teams build a janky physics robot from themed scrap; **each teammate pilots one functional part** (pillar #6 — "you build your control scheme, not a robot"); death → free-roaming ragdoll **gremlin**. 8 design pillars in `DESIGN.md`. @@ -14,8 +16,9 @@ Durable memory for this project. Read at session start, update before session en ## Open questions / TODOs - [ ] **Build Milestone 1** — networked shared bot, each player one tread (see `docs/prototype-plan.md`). The immediate work. -- [ ] **Create the Unity project** on the Windows host + decide its version control (git-on-`F:\` vs symlink into this repo). -- [ ] **Stand up a Unity MCP server** (CoplayDev/unity-mcp or IvanMurzak) host-side, WSL-bridged, so Claude can help drive the editor. +- [x] **Project location decided** — unified on `F:\jankenstein` (git + Unity + docs together), symlinked from `~/claude/projects/jankenstein`. Unity `.gitignore`/`.gitattributes` in place. +- [ ] **Create the Unity project** in `F:\jankenstein` (Unity LTS) and add the **NGO + Relay + Lobby** packages. +- [ ] **Stand up the Unity MCP** — config is seeded (`.mcp.json`, `docs/mcp-setup.md`); remaining host-side steps: install the CoplayDev package, Start it in HTTP mode, open the WSL bridge (0.0.0.0 bind or portproxy on :8080), then verify `mcp__unity__*` tools connect from WSL. - [ ] **Netcode architecture (deferred, the real risk)** — dedicated server-authoritative state sync (Robocraft 2 blueprint) vs Photon Quantum lockstep (Stumble Guys precedent). Decide *after* the fun is proven + the 25-player physics spike. Netcode target ≈ 25–30 primary rigid bodies + gremlins/debris. - [ ] **The 25-player physics/netcode spike** — two ~30-joint bots colliding at arena scale, ≥100 ms latency, min-spec. The make-or-break gate before scaling up. - [ ] Remaining **design** questions (detail in `DESIGN.md`): build-coupling tightness, hidden per-player agenda, at-scale voting, part taxonomy, scavenge-contest rules, art style, progression (cosmetic-only), final name (working title JANKENSTEIN; alts BODGEBOTS / SCRAPYARD SCRUM / CLANKERS / RUSTBUCKETS / JALOPY WARS). @@ -25,6 +28,7 @@ Durable memory for this project. Read at session start, update before session en ### 2026-07-10 - **Promoted from `ideas/jankenstein` to a real project.** Scaffolded the WSL-side project home (this repo): filled `CLAUDE.md`, seeded this `memory.md` from the idea's `plan.md`, carried the full design record over as `DESIGN.md`, added `docs/prototype-plan.md`. Idea folder archived to `archive/ideas/jankenstein`. - Decided to build a **basic networked prototype first** (user wants to test the coordination feel with real friends — local split-screen won't capture the social/voice-chat core). Stack: **Unity NGO + Relay**, host-authoritative, throwaway netcode. Milestone 1 = one shared bot, each player one tread. +- **Consolidated the project onto `F:\jankenstein`** (Unity Editor must run on Windows; user wants one unified folder). Moved the git repo there (remote intact), symlinked `~/claude/projects/jankenstein` → `/mnt/f/jankenstein`, added a Unity-aware `.gitignore` + `.gitattributes` (no LFS yet). Seeded the **Unity MCP** config: `.mcp.json` (`unity` HTTP server → `172.27.208.1:8080/mcp`), `.claude/settings.local.json` (enables it), and `docs/mcp-setup.md` (full host-side + WSL-bridge runbook). **Next:** create the Unity project in `F:\jankenstein`, install the MCP package, start it in HTTP mode + open the WSL bridge, then verify the `unity` tools connect. ## External references @@ -33,3 +37,4 @@ Durable memory for this project. Read at session start, update before session en - Wiki (orientation): http://192.168.1.249:6876/projects/jankenstein - Idea-phase history: `~/claude/archive/ideas/jankenstein/` (original brainstorm `plan.md` + session logs). - Netcode prior art (Rocket League GDC talk, Fall Guys/Robocraft/Stumble Guys case studies, Gaffer On Games) — cited in `DESIGN.md` → References. +- **Unity MCP setup runbook:** `docs/mcp-setup.md`. Server = CoplayDev/unity-mcp in **HTTP mode host-side**; Claude (WSL) connects at `http://172.27.208.1:8080/mcp` (`.mcp.json` committed). Bridge pattern mirrors the UE servers (host-side HTTP + host-IP). Not yet stood up — needs the editor + package installed.