Skip to content

Port server game engine to client-side C##1

Draft
a7c wants to merge 1 commit intomainfrom
feature/client-side-game-engine
Draft

Port server game engine to client-side C##1
a7c wants to merge 1 commit intomainfrom
feature/client-side-game-engine

Conversation

@a7c
Copy link
Copy Markdown
Collaborator

@a7c a7c commented Mar 14, 2026

Summary

  • Adds a pure C# game engine (GameEngine/) that replaces the Python FastAPI + WebSocket + LangGraph backend, making direct Anthropic API calls (Claude Haiku) from the client
  • Ports the state machine, goal system, action system, and prompt assembly from python_response_curator/ to C# — includes terminal test harness with mock, interactive, and automated modes
  • Adds GameManager.cs Unity MonoBehaviour that wraps the engine, loads data from StreamingAssets, and feeds responses into the existing WebSocketManager/Yarn dialogue pipeline

What changed

  • GameEngine/ — Standalone .NET 8 class library: Models/ (GameState, GameSession, ActionDefinition, DrafterOutput), Systems/ (ActionSystem, GoalSystem, StateLoader), LLM/ (AnthropicClient, PromptBuilder, EvalContext), Data/ (states, characters, prompts)
  • Assets/Scripts/GameEngine/ — Same pure C# sources compiled by Unity
  • Assets/Scripts/GameManager.cs — Singleton wrapper wiring engine to Yarn/UI
  • Assets/Scripts/WebSocketManager.csHandleResponse() visibility changed from private to public (1 word)
  • Assets/StreamingAssets/GameData/ — State JSONs, character JSONs, prompt templates
  • Assets/csc.rsp — Enables C# 10 for Unity compiler
  • .gitignore — Excludes config.json (API key), .NET build artifacts

What is NOT changed

  • python_response_curator/ is untouched — it remains as reference
  • Existing Unity scripts (CodonTracker, AudioManager, etc.) are unchanged
  • No Oak Story states/actions ported — only protein synthesis flow

Test plan

  • dotnet build succeeds for both GameEngine and TestHarness projects
  • dotnet run -- --mock passes full state machine flow: intro → protein selection → lab transition → reflection → farewell
  • dotnet run -- --config config.json interactive mode with real Claude API
  • dotnet run -- --config config.json --auto automated end-to-end
  • Unity Editor: attach GameManager to scene, verify compilation
  • Unity playthrough: avatar selection → intro dialogue → protein lab → reflection → farewell

🤖 Generated with Claude Code

Replaces the Python FastAPI + WebSocket + LangGraph backend with a pure C#
game engine that runs entirely client-side. The engine makes direct Anthropic
API calls (Claude Haiku) instead of routing through the server, eliminating
deployment complexity and latency.

New GameEngine/ (.NET 8 class library):
- State machine, goal system, action system ported from testing_8.py/actions.py
- Direct Anthropic API client replacing LangGraph pipeline
- Prompt builder with eval context assembly from reflexion.py
- Terminal test harness with mock, interactive, and automated modes

Unity integration (Assets/Scripts/):
- GameManager.cs singleton wraps GameSession, loads from StreamingAssets
- GameEngine/ pure C# sources compiled by Unity
- WebSocketManager.HandleResponse made public for local response injection
- csc.rsp enables C# 10 for Unity compiler compatibility
- State/character/prompt data in StreamingAssets/GameData/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@a7c a7c marked this pull request as draft March 14, 2026 22:37
@a7c
Copy link
Copy Markdown
Collaborator Author

a7c commented Mar 14, 2026

Porting from this version of python_response_curator: https://github.com/a7c/python_response_curator/tree/79fdae4b9bd587dab3935fa3d31f1d8c52d7ce39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant