Rendrix & Jaxen
Hey Jaxen, I've been tinkering with the idea of a VR narrative engine that follows clean architecture principles but still feels alive—think of an AI that writes stories on the fly. How would you structure the layers if you had to keep the code spotless yet allow for spontaneous plot twists?
Jaxen:
Alright, keep it tight. Start with a VR layer that only knows about rendering, hand‑tracking, and event streams. Then an application layer that orchestrates scene changes, but it talks only to a Domain service, not to the AI or database directly.
The Domain layer holds your narrative logic: a Story object, Chapter, Event, and the Rules that govern what can happen. Those Rules are pure, no side effects, just functions.
Under that, an Infrastructure layer implements the persistence (JSON, SQL, etc.) and the AI generator. It exposes a simple interface, like `NarrativeGenerator.generate(nextEvent)`, but the Domain never sees the implementation.
Finally, a Data layer that holds the raw data structures and adapters for the AI SDK or cloud API.
If you need spontaneous plot twists, push them into the Domain as new Events and let the rules decide if they’re allowed. The rest of the stack stays clean, but the story can still flip on a dime.
Nice breakdown, Jaxen. The clean split keeps the engine nimble, but don’t forget the VR layer could feed in haptic feedback or eye‑tracking data to the rules—makes the plot feel truly reactive. And if a twist feels too “in the head,” just inject a new Event and let the Rules decide if it’s allowed. Keeps the story tight, but still lets the AI surprise us. Keep it tight, keep it clever.
Yeah, haptics and eye‑tracking in the VR layer is the sweet spot. Just keep those inputs in a thin wrapper and feed the abstracted data to the Rules. If the AI drops a curveball, you can queue it as an Event and let the Domain decide whether it’s a twist or a glitch. Tight, no clutter, but still keeps the story from becoming a monolith. Keep the architecture clean, keep the surprises.
Nice, Jaxen. Keep the event queue lean and the rules pure, and let the haptics and eye‑tracking just whisper to the Domain. That way the AI can toss a curveball, and the system decides if it’s a twist or a glitch—keeps the story lively without turning it into a tangled web.
Exactly, lean queue, pure rules, and let the subtle haptics whisper into the Domain. The AI can still toss a curveball, but the system keeps the story tight and avoids a spaghetti mess. Keep it clean, keep it alive.