# Ratdoku A cozy rat-hotel logic puzzle. Every guest gets a room, a floor, a corridor, and a little space from the neighbours. ## Run it 1. Install **Godot 4.7 or newer** (standard edition, not .NET). 2. Open this folder in Godot (`project.godot`). 3. Press **F5**. The project uses a portrait 720×1280 canvas, scaled to a 540×960 desktop window. ## How to play - **Tap / left-click** a cell to mark it with an X. Tap an X or a guest to clear it. - **Press and hold** (mobile) or **right-click** (PC) to check a guest in. Hold or right-click a guest to check them out. - A gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed. - **Undo**, **Restart**, and **Hint** are at the bottom. - A **gold ring** around a guest means they are already checked in and cannot be moved. - Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally. - **No guessing is required.** Every room has exactly one solution. ## Each room has its own guest Every level assigns **eight distinct guests** to its eight coloured rooms. The guest is the same across the whole room, so a blue room is always one specific rat, the yellow room another, and so on. The assignment is deterministic per level, and a level never repeats a guest across two rooms. The board uses circular **head tokens** from `art/guests/heads/`. Crumb remains the host and appears on Home and in the win overlay. ## Screens - **Home** — Crumb, Check in, Guest Book, House Rules, Settings. - **Game** — board, timer, undo/restart/hint, win overlay. - **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a very faint portrait under `???` and their room number. - **Settings** — region patterns, timer, reduce motion, hold-time slider, reset progress. - **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board. ## Unlocks - **Residents** (available from the start): Miso, Hilde, Pip, Nana Fig, Biscuit. - **Room guests**: Pepper (Room 1) through Marmalade (Room 20). - **Rooms 21–30** are bonus rooms. They use the same guest cast on the board but do not unlock a new Guest Book entry. - Completing a room unlocks its guest and adds a “New guest” card to the win overlay. - Crumb is the host and has a pinned card; she is not one of the 25. ## Levels `data/levels.json` contains **30 verified 8×8 puzzles**: 20 guest rooms plus 10 bonus rooms. Every board is generated from a legal solution, split into eight connected rooms, and checked for a single solution. Each starts with three gold-ringed guests. ## Project layout ``` scenes/ Main.tscn entry point + screen navigation Home.tscn title screen Game.tscn board screen + HUD + win overlay Board.tscn custom-drawn board GuestBook.tscn gallery Settings.tscn settings Rulebook.tscn house rules + interactive tutorial scripts/ Main.gd navigation/back stack Home.gd home screen Game.gd level flow, timer, unlock flow, win overlay Board.gd drawing, input, undo, hints, per-room guests, settings Rules.gd pure win/conflict rules Levels.gd JSON level loader Guests.gd guest manifest loader SaveGame.gd autoload: settings + progress GuestBook.gd gallery, locked cards, detail sheet Settings.gd settings toggles + reset Rulebook.gd handbook content + 5×5 tutorial MiniDiagram.gd rule illustrations Palette.gd colours UI.gd button/label/panel helpers RatPortrait.gd fallback vector mascot art/ crumb.png full mascot crumb_head.png circular head token used on Home/win guests/ cards/.png 512 detail portraits thumbs/.png 256 gallery thumbnails heads/.png 256 circular board tokens source/ 1024 originals, raw renders, contact sheets (ignored by Godot/export) data/ levels.json 30 verified 8×8 puzzles guests.json 25 guest entries tutorial.json 5×5 practice puzzle tools/ generate_levels.gd headless 8×8 generator (appends new rooms) smoke_test.gd rules/board smoke test ui_test.gd settings/gallery/unlock/tutorial test screenshot.gd dev screenshots build_android.ps1 Android export helper workflows/ Krea2 guest-generation variants export_presets.cfg Android debug preset build/Ratdoku-v0.3.0-alpha.apk installable debug APK ``` ## Save data `user://ratdoku_save.json` stores completed rooms, unlocked guests, `last_room`, and settings. “Reset progress” clears rooms and unlocks but keeps settings. ## Regenerate levels ```powershell & "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe" ` --headless --path . --script res://tools/generate_levels.gd ``` The generator appends until `data/levels.json` contains 30 rooms. It keeps the existing pack and only creates the missing rooms. ## Guest art The 25 guest portraits were generated from the `Krea2_Turbo_Uncensored` ComfyUI workflow with a shared chibi/gouache prompt and per-character props. The final prompt variants are in `tools/workflows/final_guests/`. Runtime assets: - `art/guests/heads/.png` — board tokens - `art/guests/cards/.png` — detail portraits - `art/guests/thumbs/.png` — gallery thumbnails Source 1024 renders and contact sheets live in `art/guests/source/` and are excluded from the Android export. ## Android APK The current APK is: ``` build/Ratdoku-v0.3.0-alpha.apk ``` It is a **debug-signed, arm64-v8a** APK: - Package: `com.ratdoku.game` - Version: `0.3.0` (version code 3) - Min SDK: 24 (Android 7.0) - Target SDK: 36 - Size: about 41 MB - Portrait orientation To install, copy the APK to the phone, open it, and allow “Install unknown apps” for the file manager/browser. Or with a USB-connected phone and USB debugging: ```powershell & "E:\AndroidTools\sdk\platform-tools\adb.exe" install -r "build\Ratdoku-v0.3.0-alpha.apk" ``` ### Toolchain The local Android build uses: - JDK: `E:\AndroidTools\jdk-17.0.21.1+2` - Android SDK: `E:\AndroidTools\sdk` - Build tools: `35.0.0` - Godot editor settings: `export/android/android_sdk_path`, `java_sdk_path`, debug keystore. Rebuild with: ```powershell .\tools\build_android.ps1 ``` If you want a Play Store build, switch `gradle_build/export_format` to AAB, use a release keystore, and set `package/signed` appropriately. The current APK is for direct testing, not store upload. ## Tests ```powershell & "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe" ` --headless --path . --script res://tools/smoke_test.gd ``` ```powershell & "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe" ` --headless --path . --script res://tools/ui_test.gd ``` `ui_test.gd` checks settings propagation, room-1 → Pepper unlock, gallery progress, and the interactive 5×5 tutorial. Both tests reset the save when they finish. ## Current scope - 30 verified 8×8 rooms (20 guest rooms + 10 bonus) - Unique guest per room per level - Interactive 5×5 tutorial - 25 guest portraits + Crumb - Settings, gallery, rulebook, unlock flow - Installable Android debug APK - No audio yet, no daily puzzle, no release keystore/AAB yet