Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Latest commit

 

History

History
32 lines (21 loc) · 2.43 KB

File metadata and controls

32 lines (21 loc) · 2.43 KB

Unity and the ZPL Engine (architecture)

This document is for Unity engineers deciding how to integrate ZPL AIN / stability analysis. It describes F1 — architecture only. A thin C# client package (F2) is a separate mandate.

Server authoritative (required)

  • AIN runs on the ZPL Engine over HTTPS. The engine holds API keys, quotas, and rate limits.
  • Unity does not embed the mathematical engine, WASM rebuilds of proprietary cores, or copied zpl-core logic. That matches product policy (trade secret, server-side certification).
  • Unity is a consumer of the same public HTTP API documented in openapi.yaml.

Typical integration pattern

  1. Secrets: Keep ZPL_API_KEY on a game server or backend you control (same as any mobile game with a paid API). Avoid shipping long-lived keys in client builds players can extract.
  2. Transport: Server uses HttpClient (or UnityWebRequest on a headless worker) → POST /compute with JSON body (d, bias, samples). There is no matrix parameter — d is the matrix dimension.
  3. Gameplay: Clients receive derived results only (e.g. ain, ain_status, tokens_used as allowed by your UX). Do not log raw engine internals.

When Unity talks to the engine directly (prototypes / tools)

  • Use HttpClient or UnityWebRequest against https://engine.zeropointlogic.io (or your proxy).
  • Set browser-like User-Agent and the ADR 0002 headers (X-ZPL-Client, X-ZPL-Client-Version) once your channel slug is registered (e.g. sdk-csharp reserved for a future package, or a custom slug for an internal tool).
  • Respect timeouts and retries; surface “data unavailable” if the API fails — no fabricated scores.

OpenAPI and codegen (F2 preview)

  • OpenAPI-driven C# generation is optional; see OPENAPI_GENERATOR.md. Review generated code before shipping.
  • F2 (C# SDK package) is backlog until explicitly approved — do not treat generated stubs as a supported product without that mandate.

Related

  • ADR 0001 — future usage_log attribution on the engine (Alex / Rust).
  • ADR 0002X-ZPL-Client registry shared across SDKs and channels.
  • games/README.md — docs comune jocuri (Godot/Unreal snippets, catalog demo, gap-uri vs acest fișier în games/UNITY_ENGINE_GAP.md).