Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions games/graveyard_keeper_2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# graveyard_keeper_2

Steam appid: `4358690`. Status: **proven** (day, graveyard quality, church quality, happiness); reputation and citizens hidden.

## Save locations

- Windows: `%USERPROFILE%\AppData\LocalLow\Lazy Bear Games\Graveyard Keeper 2\<slot>.info` and `<slot>.dat`
- Steam Deck / Proton: `steamapps/compatdata/4358690/pfx/drive_c/users/steamuser/AppData/LocalLow/Lazy Bear Games/Graveyard Keeper 2/`

The reader uses `ddsaves._common.proton_user(4358690)` to walk every Steam library and picks the newest `*.info`.
The JSON sidecar gives day, time and the zone qualities. The sibling `.dat` (13 MB, uncompressed) is scanned once for
the single typed variable `happiness`; nothing else in it is interpreted and it is never written. Steam Cloud syncs
both files, so a Deck shows the same card as the PC.

## What the card shows

- `day` — in-game day (fact id `day`, label `facts.graveyard_keeper_2.day`).
- `graveyard_quality` — the game's "Graveyard Quality" value, labelled "Graveyard" (declared non-monotonic: it can fall).
- `church_quality` — the game's "Church Quality" value, labelled "Church" (declared non-monotonic).
- `happiness` — the town happiness shown with the thumbs-up icon in the HUD (declared non-monotonic: it is spent).
Only the current value is shown; the HUD's `/20` cap is not stored in the save, so it is not displayed.
- `observed_at` — the save timestamp from `saveDateTime`.

## What stays hidden

- `villageRep`: the sidecar value stayed 17 while the HUD reputation went from 0 to 10 between saves, so its meaning is
unknown and it is never displayed.
- `townCitizens`: matched the HUD (20) but was constant across all eight stages, so it stays unproven.

See `proof.md` for the stage table.

## Checks

```bash
python tools/run_game_tests.py graveyard_keeper_2
python tools/gate/check_cards.py graveyard_keeper_2
```
18 changes: 18 additions & 0 deletions games/graveyard_keeper_2/icons.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"day": {
"subject": "a small sun above a horizon line, as on a calendar day marker",
"reference": "the in-game day counter shown next to the clock HUD"
},
"graveyard_quality": {
"subject": "a small stylised skull, as the game's own graveyard-quality marker",
"reference": "the skull sprite next to the Graveyard Quality value in the graveyard HUD/inspection panel"
},
"church_quality": {
"subject": "a small chapel outline with a cross on the roof",
"reference": "the Church Quality value shown in the church inspection panel"
},
"happiness": {
"subject": "a small thumbs-up hand",
"reference": "the town happiness icon (sprite `happiness`) next to the x/y counter in the HUD"
}
}
36 changes: 36 additions & 0 deletions games/graveyard_keeper_2/proof.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Evidence record — Graveyard Keeper 2

Status: **proven (4 fields shown)**. Saves are the contributor's own, one playthrough, Steam builds 1.011.1 (stages 1–4)
and 1.012.9 (stages 5–8), Proton on Linux (stages 1–4 are the Steam Cloud copies on a Steam Deck, 5–8 the PC's rolling
backups). Each stage folder holds the slot's `Steam_1.info` (JSON sidecar) and `Steam_1.dat` (binary world state,
uncompressed: entropy 3.7 bits/byte, UTF-16 field names of the C# serializer).

| field | s1 | s2 | s3 | s4 | s5 | s6 | s7 | s8 | game-visible evidence | source | decision |
|---|---|---|---|---|---|---|---|---|---|---|---|
| day (.info) | 110 | 111 | 113 | 114 | 116 | 117 | 117 | 117 | HUD day counter | number | proven, shown |
| saved_at (.info) | 20:53 | 21:08 | 21:26 | 21:32 (11-09) | 21:56 | 21:58 | 22:02 | 22:09 (11-26) | save slot timestamp | — | proven, observed_at |
| graveyardQuality (.info) | 28 | 28 | 28 | 28 | 23 | 23 | 23 | 23 | "Graveyard Quality" panel; player read 23 at s7/s8; equals `wz_graveyard` in the .dat | label from game strings | proven, shown, **nonmonotonic** |
| churchQuality (.info) | 36 | 36 | 36 | 36 | 36 | 36 | 29 | 29 | "Church Quality" panel; player read 29 at s7/s8; equals `wz_church` in the .dat | label from game strings | proven, shown, **nonmonotonic** |
| happiness (.dat) | 0 | 3 | 3 | 0 | 5 | 5 | 5 | 10 | HUD thumbs-up counter: player read 0/20 at s4, 5/20 at s5–s7, 10/20 at s8 | game identifier `happiness` / `town_happiness` | proven, shown, **nonmonotonic** |
| villageRep (.info) | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | never matched the HUD; `repValue: false`; equals `village_REP` in the .dat (an NPC-style reputation) | — | **hidden** |
| townCitizens (.info) | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | player read 20 (matches) | — | unproven (constant) |

Non-monotonic declarations: the two quality values are state values recomputed from the current graves / church
(28 → 23 across the 1.011.1 → 1.012.9 update, 36 → 29 within one session). Happiness is a spendable town resource: the
game's own texts say "spend <sprite name=\"happiness\"> to get what you want" and it dropped 3 → 0 between s3 and s4.
`read()` declares all three in `nonmonotonic` with the reason, so the gate reports them for human review.

How `happiness` is read: the `.dat` stores typed variables as `\x01 <u32 len> <utf-16 name> \x1f\x01 \x05\0\0\0 "value" <f32>`.
The reader scans for that exact byte pattern with the name `happiness`; the value must occur exactly once with one value,
otherwise the field is `None` and hidden. Nothing else in the `.dat` is interpreted, and the file is never written.

The HUD shows happiness as `x/20`. No variable in the `.dat` carries that cap (no `happiness_max`, no `happiness_cap`;
`townCitizens` happens to be 20 but is not proven to be the denominator), so the card shows only the current value.

Label strings in the game's `resources.assets`: `Graveyard Quality`, `Church Quality` (EN), `Качество кладбища`,
`Качество церкви` (RU), `Friedhofsqualität`, `Kirchenqualität` (DE); the card uses the shorter nouns `Graveyard` / `Church`
(`Кладбище` / `Церковь`), which are game strings too. Happiness has no text label in the HUD (icon only);
its identifier in the game data is `happiness` / `town_happiness`, so the fact label is the plain word "Happiness".

Stages are the game's rolling backups of one slot (`_backup_3` oldest → `Steam_1` newest), copied into the ignored
`stages/` folder (`.info` + `.dat` per stage, ~13 MB each).
173 changes: 173 additions & 0 deletions games/graveyard_keeper_2/reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
"""Graveyard Keeper 2 (appid 4358690): read-only, stdlib reader for the save metadata sidecar.

Each slot writes two files next to each other: ``<slot>.dat`` (binary Unity/C# world state,
~13 MB, uncompressed, UTF-16 field names) and ``<slot>.info`` (small JSON written by the game).
The ``.info`` sidecar gives day, time and the two zone qualities. One typed variable is read
from the ``.dat`` by a byte scan: ``happiness``, the town happiness shown with the thumbs-up
icon in the HUD. Nothing else in the ``.dat`` is interpreted.

Proof (7 stages of one playthrough, see proof.md): ``day`` grows 110 -> 117 and ``saveDateTime``
with it. ``graveyardQuality`` (28 -> 23) and ``churchQuality`` (36 -> 29) change between stages and
match the HUD values the player sees; both are state values the game recomputes, so they are
declared ``nonmonotonic``. ``happiness`` (0 -> 3 -> 0 -> 5 -> 10) is a spendable town resource
and is declared ``nonmonotonic`` too. ``villageRep`` and ``townCitizens`` stay hidden.
"""
from __future__ import annotations
import json
import math
import os
import struct
from datetime import datetime
from pathlib import Path

try:
from ddsaves._common import proton_user, newest, read_bytes
except ImportError: # pragma: no cover - the proof gate always exposes plugin/py_modules
proton_user = None

def newest(paths):
best = None
for p in paths:
if p.is_file() and (best is None or p.stat().st_mtime > best.stat().st_mtime):
best = p
return best

def read_bytes(path):
return Path(path).read_bytes()

APPID = 4358690
SUB = "AppData/LocalLow/Lazy Bear Games/Graveyard Keeper 2"
INFO_GLOB = "*.info"
TIME_FORMAT = "%m/%d/%Y %I:%M:%S %p"
DAT_MAX_BYTES = 64 * 1024 * 1024


def _utf16(text: str) -> bytes:
return text.encode("utf-16-le")


def _dat_variable(dat_path, name: str):
"""Return the float value of a typed variable ``{type: <name>, value: <f32>}`` in the .dat.

The serializer writes ``\x01 <u32 len> <utf-16 name> \x1f\x01 \x05\0\0\0 "value" <f32>``.
Returns None when the file is missing, too large, the name is absent or ambiguous.
"""
try:
if not dat_path.is_file() or dat_path.stat().st_size > DAT_MAX_BYTES:
return None
blob = read_bytes(dat_path)
except OSError:
return None
needle = struct.pack("<I", len(name)) + _utf16(name) + b"\x1f\x01\x05\x00\x00\x00" + _utf16("value")
values = set()
start = 0
while True:
at = blob.find(needle, start)
if at < 0:
break
start = at + len(needle)
if start + 4 <= len(blob):
values.add(struct.unpack_from("<f", blob, start)[0])
if len(values) != 1:
return None
value = values.pop()
return value if math.isfinite(value) else None


def _empty() -> dict:
return {"place": None, "chapter": None, "objective": None, "progress": {},
"facts": [], "proven": [], "unproven": [], "fact_sources": {}}


def _candidate_dirs() -> list:
out = []
if os.environ.get("USERPROFILE"):
out.append(Path(os.environ["USERPROFILE"]) / SUB)
if proton_user is not None:
out.extend(p / SUB for p in proton_user(APPID))
return out


def find(path_or_dir=None):
if path_or_dir is not None:
p = Path(path_or_dir)
if p.is_file():
return p
if p.is_dir():
return newest(p.glob(INFO_GLOB)) or newest(p.rglob(INFO_GLOB))
return None
for folder in _candidate_dirs():
found = newest(folder.glob(INFO_GLOB))
if found:
return found
return None


def _parse_time(text):
try:
return datetime.strptime(str(text), TIME_FORMAT).timestamp()
except (TypeError, ValueError):
return None


def read(path_or_dir=None) -> dict:
path = find(path_or_dir)
if path is None:
return _empty()
try:
info = json.loads(read_bytes(path).decode("utf-8"))
except (OSError, ValueError, UnicodeDecodeError):
return _empty()
if not isinstance(info, dict):
return _empty()
day = info.get("day")
if not isinstance(day, int) or isinstance(day, bool):
return _empty()
saved_at = _parse_time(info.get("saveDateTime"))
happiness = _dat_variable(path.with_suffix(".dat"), "happiness")
if happiness is not None and happiness == int(happiness):
happiness = int(happiness)
progress = {
"happiness": happiness,
"day": day,
"saved_at": saved_at,
"is_autosave": info.get("isAutoSave") is True,
"game_save_version": info.get("gameSaveVersion"),
"graveyard_quality": info.get("graveyardQuality"),
"church_quality": info.get("churchQuality"),
"village_rep": info.get("villageRep"),
"town_citizens": info.get("townCitizens"),
}
facts = [{"id": "day", "icon": "day", "value": str(day)}]
fact_sources = {"day": "day"}
proven = ["day", "saved_at"]
unproven = ["village_rep", "town_citizens", "is_autosave", "game_save_version"]
for field in ("graveyard_quality", "church_quality", "happiness"):
value = progress[field]
if isinstance(value, int) and not isinstance(value, bool):
facts.append({"id": field, "icon": field, "value": str(value)})
fact_sources[field] = field
proven.append(field)
else:
unproven.append(field)
out = _empty()
out.update({
"progress": progress,
"facts": facts,
"proven": proven,
"unproven": unproven,
"fact_sources": fact_sources,
"nonmonotonic": {
"graveyard_quality": "sum of the current graves' quality; falls when graves decay, are reworked or removed (28 -> 23 observed across stages 4 -> 5)",
"church_quality": "current church state, recomputed by the game; fell 36 -> 29 within one session (stages 6 -> 7)",
"happiness": "town happiness is a spendable resource (<sprite name=\"happiness\"> in the game's own texts); 3 -> 0 observed between stages 3 and 4",
},
"observed_at": saved_at if saved_at is not None else path.stat().st_mtime,
"source_path": str(path),
})
return out


if __name__ == "__main__":
import sys
print(json.dumps(read(sys.argv[1] if len(sys.argv) > 1 else None), ensure_ascii=False, indent=2))
37 changes: 37 additions & 0 deletions games/graveyard_keeper_2/stages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"appid": 4358690,
"stages": [
{
"path": "stages/stage1_day110",
"note": "Steam_1_backup_3 (.info + .dat), 2026-11-09 20:53, day 110, game 1.011.1"
},
{
"path": "stages/stage2_day111",
"note": "Steam_1_backup_2, 2026-11-09 21:08, day 111"
},
{
"path": "stages/stage3_day113",
"note": "Steam_1_backup_1, 2026-11-09 21:26, day 113"
},
{
"path": "stages/stage4_day114",
"note": "Steam_1, 2026-11-09 21:32, day 114 (Steam Cloud copy from the Deck)"
},
{
"path": "stages/stage5_day116",
"note": "Steam_1_backup_3, 2026-11-26 21:56, day 116, game 1.012.9"
},
{
"path": "stages/stage6_day117",
"note": "Steam_1_backup_2, 2026-11-26 21:58, day 117"
},
{
"path": "stages/stage7_day117",
"note": "Steam_1_backup_1, 2026-11-26 22:02, day 117, church quality changed"
},
{
"path": "stages/stage8_day117",
"note": "Steam_1, 2026-11-26 22:09, day 117, happiness changed"
}
]
}
2 changes: 2 additions & 0 deletions games/graveyard_keeper_2/stages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
19 changes: 19 additions & 0 deletions games/graveyard_keeper_2/tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Graveyard Keeper 2 needs no name table: the card shows only numbers read from the .info sidecar.

Kept for the contribution layout. If a future version displays named places or items, generate
data/graveyard_keeper_2.<lang>.json from the game's own localisation here.
"""
import argparse
from pathlib import Path


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("game_files", type=Path, nargs="?")
parser.add_argument("--language", choices=("en", "ru", "uk"), default="en")
parser.parse_args()
print("graveyard_keeper_2: no name table required (numeric facts only)")


if __name__ == "__main__":
main()
Loading