Cases and Projects

A case is the authored whole: the wording of every screen, the prologue, the map, the cast, the items, the culprits and the private answer. A case used to be a class that a game subclassed; it is now a project folder that the engine loads. The class is still the contract every mechanic is written against, and a loaded project supplies it. This page describes both.

1. What a case declares

The current contract is an abstract class — ContentPack — rather than an interface, and a case supplies these:

Member What it is
CaseId the case's identity. Used to refuse a save belonging to another case, so it must never change once a case has shipped.
AssetRoot where the case's pictures are resolved from.
MainGameConfig all the UI wording, per screen. A case says what its own buttons are called.
StoryNarratives the prologue, as a list of text-and-background fragments.
GalleryPieces what is already in the evidence room when the case opens.
LocationRootMap the whole map, as one tree. See Locations and travel.
InventoryItems the master list of every item the case can produce.
StarterItems and StarterItemPickLimit what the player may choose to bring, and how many.
NpcItemOffers the authored hand-overs a character may make. See Evidence and items.
CharacterGreetings an opening line per character, optionally per location.
ConcludeScenario the viable suspects, who among them is the real culprit, and their deadlines.
JudgmentTruth the private authored solution, used only by the isolated reasoning reviewer and never shown to the player.

Two of those deserve emphasis because they are what make the engine reusable at all. MainGameConfig means the engine owns no player-facing words. Every label, confirmation and epilogue comes from the case, which is why a case does not have to be a 1987 murder mystery in English. And JudgmentTruth is the only place the answer is written in prose — everything else about the solution is structure, in ConcludeScenario.

AssetRoot is new and was being added as this page was written. Treat it as part of the model but expect its exact shape to settle.

2. What a playthrough is

A case is static; a playthrough is the state. The engine keeps them strictly apart, and GameSession is the object that holds one of each — the content pack, the state, and the nullable seams for the population directory, the profile database and the chat service, so that a session can be constructed with no model at all.

The state is small and entirely about what the player has done:

  • The clock. A day counter starting at 1, and an hour of the day starting at 08:00. The displayed date is derived from them against the case's base date.
  • Who is at the station, and how many questions each has left. Plus a separate budget per location and person for street conversations.
  • The transcript, per character.
  • What has been found: evidence ids, owned item ids, claimed discoveries, verified gift receipts, claimed offers.
  • The verdict, once there is one, with the player's reasoning and the feedback on it.
  • A playthrough id, so that a closed case stays closed.

3. Saving

A save is one indented JSON document per slot — readable by a person who opens it, which was a deliberate choice. There are five fixed slots: an autosave, a case record written immediately before a verdict, and three manual slots. Writes go to a temporary file and are then moved into place, so a crash cannot truncate a save that already existed.

What is saved is facts, not presentation: evidence is stored as a set of ids, and the captions and pictures are re-walked out of the content pack on load. An author who rewrites a caption sees the new caption in an old save. The same applies to the transcript, which is stored as text and re-indexed for retrieval at load time rather than persisted as vectors — see Knowledge and retrieval.

A load is refused, with a message addressed to the player and no change to the running game, when:

  • the save's version is newer than the engine understands, or older than 1;
  • the save belongs to a different case;
  • the save names an item, person, evidence id or location the case no longer has.

That last check is what makes a case editable. The evidence and location catalogue is walked out of the content pack, so deleting a clue does not silently corrupt somebody's save — it refuses it and says which identifier went missing.

Autosaving happens exactly twice: once per in-game day on entering the hub, and once immediately before a conviction. An automatic save never throws; it records its problem instead.

A closed case stays closed. Closure writes a durable record keyed by the playthrough id before the live state changes, so every earlier checkpoint of that playthrough resolves to the final verdict. A judgement cannot be re-rolled by reloading an earlier slot. If the durable write fails, the case stays open rather than half-closed.

4. The project format

A case is a folder, and every file in it is a file the runtime reads. Nothing is a database, so a project can be diffed, merged and reviewed by somebody who has never opened the editor.

MyCase/
  case.yaml            id, title, victim, clock, budgets, deadline
  interface.yaml       the screen wording
  cast.csv             one row per person
  cast/<id>/           one folder per person, with up to nine files
  map.yaml             the place tree, travel costs, plates, hotspots, access rules
  discoveries.yaml     what is found where, and when
  evidence/<id>.md     one exhibit per file: front matter, then the transcript
  items.yaml           inventory, starter selection, offers, greetings
  knowledge/<topic>.md one world topic per file, in paragraphs
  prompts/standard.md  the shared prompt template
  prompts/keys.yaml    the global key vocabulary
  endings.yaml         the court's question, the suspects, five verdicts, the private truth
  story.yaml           the prologue and the gallery
  assets/              maps, portraits, exhibits, icons, audio
  .crimeengine/        the retrieval index and caches; never committed
  build/               published packs; never committed
  • YAML carries the structure; prose has files of its own. A dossier, a personality, a memory, an exhibit's transcript and a world topic are each one file, because they are written and reread as prose.
  • Pictures are named by paths inside the project, such as assets/Maps/Town_08.png.
  • A project that is half written still opens. Problems such as a suspect missing from the cast, or an exhibit chain with a dead end, are listed rather than thrown, so the editor can show them.
  • Publishing compiles the folder into one .cepack file and refuses by default when the project has an error. The pack's masking keeps clues out of a text search of the install folder; it is not encryption.

In Divooka, the Crime Engine toolbox opens a folder or a pack, checks it, publishes it, and plays or captures it. A compiled case from before the format existed can be converted into a project.

See also