Files
lingua-engine/README.md
T
EmilandClaude Sonnet 5 f6d9ea896f Close M1: real triangle, engine.input, screenshot-to-file capture
All three plugins M1 called for now exist over Silk.NET, and the
milestone's actual claim is proven against a live GL context, not
just argued: edit a plugin's code, rebuild just it, reload it while a
real window stays open, see the change with no app restart. Verified
directly this time — two PNGs of the same running window, before and
after a live reload (orange triangle -> green, same process, same
window, same GL context throughout) — not by analogy to the earlier
clear-color version.

engine.render, upgraded from clear-color to real geometry:
- Vertex/fragment shaders compiled and linked at Configure() time,
  with real error checking (GetShader/GetProgram *Status + InfoLog on
  failure) rather than trusting hand-typed GLSL to just work.
- VAO/VBO for a hardcoded triangle; Shutdown() deletes all three GL
  objects rather than leaking them across reloads.
- unsafe confined to Configure() (VertexAttribPointer takes a raw
  offset pointer) via a narrow, documented override of
  Directory.Build.props' default — native graphics interop, not the
  kernel data structures docs/kernel-contract.md §7 was written
  against.

engine.input: publishes IEngineInput (keyboard state) via Silk.NET.Input.
Reuses Silk.NET's own Key enum rather than inventing one, same call as
IEngineWindow.Native. Loads and constructs cleanly against a real
window; nothing reacts to it yet since there's no gameplay code to.

IScreenCapture (new, engine.render): reads the frame back via
ReadPixels and writes a PNG. No SixLabors.ImageSharp — checked its
license first and it isn't MIT/Apache (revenue-gated), which would
have been a real surprise for downstream users of an MIT engine.
PngWriter is a from-scratch encoder instead: ZLibStream (BCL, .NET 6+)
for the one genuinely hard part, a correctly zlib-wrapped DEFLATE
stream; chunk framing and CRC32 are small enough to get right and to
verify by actually decoding files this wrote (done repeatedly, by
hand, across this session).

Engine.Host: "screenshot <path>" joins "r <plugin-id>" as a live
stdin command, plus a non-interactive --screenshot/--screenshot-after-
frames pair that captures once and exits — for scripts and agents that
can't easily hold a pipe open into a long-running process.

Real bug found and fixed in PluginHost, not specific to any one
environment: loading a Contracts assembly into the Default ALC never
set up resolution for ITS OWN dependencies. engine.windowing's and
engine.render's Contracts both need Silk.NET packages and loaded fine
anyway, by accident — Engine.Host references those two Contracts
projects directly (to drive the windowed loop and screenshot capture),
so their dependencies were already sitting in Engine.Host's own output
directory. engine.input's Contracts has no such lucky coincidence and
failed with a real FileNotFoundException. Fixed by hooking
AssemblyLoadContext.Default.Resolving with an AssemblyDependencyResolver
per loaded Contracts path — mirroring what PluginLoadContext already
does for collectible ALCs, applied to the one path that never had it.
Hooked once per process via a static list/flag, not per PluginHost
instance, specifically to avoid a PluginHost instance becoming
unreclaimable through its own event subscription.

Not covered by automated tests, deliberately, same reasoning as the
windowing/render pass: opening a real window and reading back a real
framebuffer both need a real display. Verified by hand instead,
documented above and in commit history rather than asserted.

README status: M1 done, not "in progress."

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N1qPfzq8TDCUMFMV3UwV5N
2026-09-02 04:42:54 +03:00

59 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Lingua Engine
A modular, plugin-first game engine built around one idea: the kernel is a
shared language, not a shared implementation. Everything the engine can do —
rendering, physics, audio, even the editor itself — is a plugin that speaks
that language. The kernel only defines the vocabulary plugins use to
understand each other.
Built for Linux and Windows, in C#/.NET, with two goals that shape every
design decision:
- **Fast iteration.** No Unity-style domain reload. Plugins hot-reload their
compiled code without resetting game state, because state never lives in
plugin code to begin with — see [`docs/kernel-contract.md`](docs/kernel-contract.md).
- **A small, frozen kernel.** Everything else — including the parts most
engines treat as core — is a plugin, versioned and replaceable per project.
## How this gets built
Most of the code here — kernel and plugins alike — is written by an LLM
coding agent rather than by hand. That's not incidental: it's a design
input. It's why the object model is `GameObject`/`Component` instead of a
hand-rolled ECS, why registration is verbose and explicit instead of
convention-based, and why the engine has a headless, scriptable
introspection surface no classic editor bothers with — see
[`docs/kernel-contract.md`](docs/kernel-contract.md#7-written-by-an-agent-not-a-human).
## Status
**M0 done.** The kernel — `World` (`GameObject`/`Component`, type-indexed
queries), `Schedule` (stage execution, conflict batching, debug-mode access
enforcement), `PluginHost` (two-ALC load/unload, verified leak-free over
200 cycles), and a headless CLI (`engine run --headless ... --dump`) — all
exist and are tested. The full agent loop from
[`docs/kernel-contract.md#7`](docs/kernel-contract.md#7-written-by-an-agent-not-a-human)
runs end to end.
**M1 done.** `engine.windowing`, `engine.render` (a real shader-drawn
triangle, not just a clear color), and `engine.input` all exist over
Silk.NET. The milestone's actual claim — edit a plugin's code, rebuild just
it, reload it while a real window stays open, see the change with no app
restart — is proven against a live GL context: two PNGs of the *same*
running window, before and after a live reload, orange triangle then green,
same process the whole time. `IScreenCapture` (`engine.render`) reads the
frame back from the GPU and writes it to a file with a hand-rolled PNG
encoder — no `SixLabors.ImageSharp` (its license isn't MIT/Apache) and no
desktop screenshot tool, so this is checkable without a screen at all,
exactly the introspection story `docs/kernel-contract.md#7` argues for.
No physics yet — see the build order (M0M4) in
[`docs/kernel-contract.md`](docs/kernel-contract.md) for what's next.
Design and implementation are argued over in the same place: the doc is
still the thing to disagree with before code changes to match.
## License
[MIT](LICENSE)