# 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 **360×640 dp canvas**, scaled to a 540×960 desktop window. On a tall phone it expands vertically instead of stretching the UI. ## How to play - **Tap / left-click** a cell to mark it with an X. Tap an X or a guest to clear it. - **Double-tap** a cell to check a guest in or out. **Double-tap is on by default.** - Prefer holding? Turn off **Double-tap to place** in Settings, then **press and hold** (mobile) or **right-click** (PC) to check a guest in. Right-click keeps working in both modes. - In hold mode, a gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed. - On Android, the system back button acts like the in-app back arrow: it closes overlays first, then navigates back. On Home it asks before quitting. - **Undo** and **Hint** are at the bottom. **Restart room** and **Back to lobby** live in the in-level settings sheet. - The **Daily room** changes each day and tracks a streak. Replaying the same day never counts twice. Open **Streak** for the weekly calendar and next goal. - Tap **Crumb** in the top-left to open your Profile, where you can choose an avatar and a frame. Choices apply on Confirm. - 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. ### Pattern mode and the room legend - **Pattern mode is on by default.** Each room carries a distinct motif — paw, cheese, key, bed, bell, leaf, fish, star — drawn over the colour. Turn it off in Settings for flat colours. - A **room legend** above the board shows the eight guests for the level, one per region colour. Solved rooms get a gold ring. - The **gear in the top-right opens settings over the puzzle**, so patterns, timer, motion, and placement mode can change without leaving the room. **Resume** is the primary action; restarting is deliberately secondary. ## Screens - **Home** — top hub with framed Crumb avatar, guest progress, and settings; daily room card; Continue/Check in; Guest Book; House Rules. - **Game** — top bar, rule strip for the first three rooms, room legend, board, timer, undo/hint, in-level settings, 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. Tapping a card opens a detail sheet; swiping anywhere in the gallery scrolls it, including over cards. - **Settings** — a bottom sheet over Home or the board: room patterns, timer, reduce motion, double-tap placement (on by default), hold time, how to play, restart/back, reset progress. Destructive actions use a themed in-app confirmation card. - **Profile** — framed avatar preview, rooms completed, current and best daily streaks, and tabbed Avatar / Frame pickers with Confirm / Cancel. Guest portraits unlock with their Guest Book entry. - **Daily Streak** — big current streak, best-streak pill, weekly calendar, next-frame goal, and a visual day-7 gift marker. - **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 SettingsSheet.tscn bottom-sheet settings Rulebook.tscn house rules + interactive tutorial scripts/ Main.gd navigation/back stack + sheet routing Home.gd top hub + home screen Game.gd level flow, legend, rule strip, timer, win overlay Board.gd rounded tiles, motifs, input, undo, hints, per-room guests 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 SettingsSheet.gd shared settings sheet Rulebook.gd handbook content + 5×5 tutorial MiniDiagram.gd rule illustrations Palette.gd colours UI.gd 360dp tokens, fonts, buttons, icons Version.gd version/build label RatPortrait.gd fallback vector mascot assets/ fonts/ Fredoka + Nunito (OFL) icons/ Lucide SVG icon set 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.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.apk ``` It is a **debug-signed, arm64-v8a** APK: - Package: `com.ratdoku.game` - Version: `0.6.1` (version code 13) - Min SDK: 24 (Android 7.0) - Target SDK: 36 - Size: about 41 MB - Portrait orientation - Build label: `v0.6.1-alpha · build 2026-12-03` 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 "E:\Ahri\Documents\Ratdoku\Development\build\Ratdoku.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 the double-tap default and save migrations, daily streak math and level selection, avatar and frame selection, settings propagation, hold/double-tap placement, tap-vs-drag guards in the Guest Book, scroll pass-through over cards and rules rows, the close guard, room-1 → Pepper unlock, gallery progress, navigation, and the interactive 5×5 tutorial. Both tests reset the save when they finish. Run the whole QA suite (class scan, every test script, log-error scan, optional screenshots, optional APK build) with: ```powershell .\tools\qa_all.ps1 -Screenshots -Build ``` `qa_all.ps1` fails if any suite is missing, a script does not print its PASS marker, or Godot logs any `ERROR` / `SCRIPT ERROR`. The `qa_core.gd`, `qa_ui.gd`, and `qa_input.gd` suites cover save migrations, daily and frame data, navigation and win overlays, and all input gestures. ## Versioning and releases The current development build is **v0.6.1-alpha** (“Back Button”) with the build label on Home and in Settings. Gitea repository: `https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku` Alpha releases (all marked prerelease, each with a debug APK and source archive): - **v0.1.0-alpha** — first playable 20-room prototype - **v0.2.0-alpha** — Guest Book, Settings, House Rules, 25 guests - **v0.3.0-alpha** — 30 rooms, unique guest per room, Android APK - **v0.4.0-alpha** — 360dp redesign, pattern motifs, room legend, in-level settings - **v0.4.1-alpha** — Guest Book tap/scroll guards, close guard, double-tap placement - **v0.4.2-alpha** — finger scrolling works over Guest Book cards, House Rules rows, and Settings rows - **v0.4.3-alpha** — double-tap placement is the default, with a one-time migration for older saves - **v0.5.0-alpha** — daily room with streaks, Profile screen, and selectable profile frames - **v0.5.1-alpha** — profile frame selection crash fix, QA suites, and log-guarded test runner - **v0.5.2-alpha** — themed reset/restart confirmation and no Godot boot splash - **v0.5.3-alpha** — high-resolution UI icons that stay sharp on high-density screens - **v0.6.0-alpha** — selectable guest avatars with tabbed picker and a Daily Streak screen with weekly goal - **v0.6.1-alpha** — Android back button navigates the app instead of closing it https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.6.1-alpha The v0.6.1-alpha APK is also at: `https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.6.1-alpha/Ratdoku-v0.6.1-alpha.apk` `redesign-360` is the branch with the current 360dp work; it is tagged `v0.6.1-alpha`. The version is set in three places: `project.godot` (`config/version`), `scripts/Version.gd` (display label), and `export_presets.cfg` (`version/name`, `version/code`). ## Current scope - 30 verified 8×8 rooms (20 guest rooms + 10 bonus) - Unique guest per room per level - 360dp layout, Fredoka/Nunito typography, Lucide icons - Playful rounded tiles, 8 pattern motifs, room legend - In-level settings sheet with patterns/timer/motion/placement mode/restart/lobby - Interactive 5×5 tutorial - 25 guest portraits + Crumb - Settings, gallery, rulebook, unlock flow - Daily room with streaks, Profile screen, selectable avatars and frames (save version 4) - Installable Android debug APK - No Godot boot splash; the app opens straight to the cream-themed game - No audio yet, no release keystore/AAB yet