OpenGameAgent is a small C# agent runtime for games. Preserve a compact, understandable core while supporting structured game input, safe actions, game time, multiple actors, and engine/server placement.
This repository is a framework, not a game, world editor, content marketplace, or universal entity schema.
src/OpenGameAgent.Kernel: engine-neutral stateful model/tool loop.src/OpenGameAgent: game coordinates, runtime composition, actions, sessions, transcript compaction, memory, skills, scheduling, mailboxes, and media contracts.src/OpenGameAgent.Persistence: crash-tolerant local-file implementations.src/OpenGameAgent.DevTools: bounded trace recording, observation-only playback, and offline evaluation.src/OpenGameAgent.Providers.OpenAICompatible: streaming chat-completions transport.src/OpenGameAgent.Providers.MediaHttp: generic remote or local media-generation transport.src/OpenGameAgent.Providers.OpenAI.Images: official OpenAI image generation/edit transport.src/OpenGameAgent.Providers.Volcengine.Images: Volcengine Ark/Seedream image generation/edit transport.src/OpenGameAgent.Media: media model routing plus persistent generated-asset lifecycle contracts.src/OpenGameAgent.Client: engine-compatible JSON/SSE service client.src/OpenGameAgent.Runtime.Protocol: optional versioned, transport-neutral Session/Run/Turn/Item contract.src/OpenGameAgent.Runtime.Hosting: optional in-process Runtime projection and bounded replay journal.src/OpenGameAgent.Models.Credentials.Windows: optional Windows CurrentUser DPAPI credential persistence.src/OpenGameAgent.Server: optional C# .NET 8 host.engines/godot: Godot .NET package and tests.engines/unity: Unity UPM package and tests.engines/unreal: native Unreal Engine C++ plugin for the remote JSON/SSE placement.examples: buildable integration examples.tools/OpenGameAgent.DevTools.Cli: local trace inspection and CI evaluation CLI.tests: focused unit and integration tests.
- Shared projects remain
netstandard2.1; the server and tests use .NET 8. - Engine SDK types never enter
src. - Input and context are bounded JSON and must not assume natural language.
- Keep floating-point JSON values; do not coerce game data to strings or integers.
- Game code owns rules, permissions, authoritative state, and final mutations.
- Model output is untrusted. Validate schemas and revalidate in game handlers.
- Never infer that cancellation or timeout means a write did not commit.
- Side effects need stable operation IDs and an explicit recovery answer.
- Same-actor ordering and bounded cross-actor concurrency must remain deterministic.
- Narrative scheduling and memory follow game time. Operational leases may use real time.
- Skills are instructions and metadata, not executable code loaders.
- Bound every externally controlled payload, collection, queue, callback, loop, timeout, and concurrency path.
- Do not add provider credentials, private research, proprietary game data, local absolute paths, or generated engine state.
- Keep public source and comments self-contained; explain decisions in terms of OpenGameAgent behavior.
dotnet restore OpenGameAgent.sln
dotnet build OpenGameAgent.sln -c Release --no-restore
dotnet test OpenGameAgent.sln -c Release --no-build --no-restore
dotnet format OpenGameAgent.sln --verify-no-changes --no-restorePackage gates:
./engines/godot/test-package.ps1 -GodotSharpDir <GodotSharp/Api/Debug>
./engines/unity/test-package.ps1 -UnityManagedDir <Unity/Editor/Data/Managed/UnityEngine>
./engines/unreal/test-package.ps1Real-editor gates are in docs/engine-integration.md.
- Kernel changes require success, validation, provider-failure, cancellation, limit, and event-order tests where relevant.
- State-changing tool changes require duplicate, uncertain-outcome, and recovery tests.
- Persistence changes require restart, corruption, atomic-write, and concurrency coverage proportional to the change.
- Generated-asset changes require duplicate submission, uncertain generation/import, restart, resource-integrity, and authoritative receipt coverage.
- Model/tool loop changes require direct-answer, tool-continuation, provider-failure, and bounded-limit tests.
- Actor or tool concurrency changes require deterministic ordering and saturation tests.
- Wire/client/server changes require JSON and SSE integration tests.
- Engine changes require package compilation and the relevant real-editor smoke test before release.
- Product, version, or compatibility changes must update both root READMEs.
Prefer a small composable interface over a new subsystem. Add game-specific behavior as an example or adapter unless multiple unrelated game designs require the same semantics.