Compare commits

...
10 Commits
Author SHA1 Message Date
Ratdoku Builder e0f712b39c build: restore Android toolchain and verify APK icon
Points the Android build at a portable JDK/SDK in the approved temp folder, hardens QA so export failures cannot false-pass, and confirms the rebuilt APK ships the new gouache launcher icon.
2026-12-05 22:57:33 -06:00
Ratdoku Builder a7a238e418 fix(home): fit layout without scrollbar and give Crumb a cutout
Removes the Home scroll container and tightens spacing so all controls fit at 360x640, including 1.3x text size. Creates a transparent Crumb card cutout for the guest-of-day mascot.
2026-12-05 22:45:40 -06:00
Ratdoku Builder 3cdc3567f3 fix(v0.9): polish pass before release
Clears free mode when starting campaign/daily rooms, rebuilds levels on restore, fixes free win label, makes event claims cycle-aware and event schedule local-day based, grants VIBRATE permission, validates corrupt save values, and fixes Home scrolling, Guest Book close button, event claim contrast, achievement contrast, and difficulty modal spacing. Adds QA for these paths.
2026-12-05 22:05:32 -06:00
Ratdoku Builder 25c918e6a2 feat: guest-of-day mascot and Windows export preset
The Home mascot now features a deterministic guest of the day, tap-cycles unlocked guests with a story teaser, and scales cleanly at large text sizes. Screens stay centered at 360dp on wide aspect ratios. Adds a Windows Desktop export preset.
2026-12-05 17:10:37 -06:00
Ratdoku Builder 9e2776f7c4 feat: guest stories, accessibility and cozy events
v0.9.0-alpha local build. Adds per-guest story vignettes, a scrollable Guest Book story section, live text scaling, Android haptics, a difficulty picker with descriptions, six repeating cosmetic hotel events, and isolated free play using verified symmetry variants. Save format v7 with automatic migration. QA is 9/9 including the free-play uniqueness suite.
2026-12-05 16:44:39 -06:00
Ratdoku Builder e0fd33c25e fix(profile): restore original Crumb portrait in game
The new Krea2 Crumb render is used only for the app icon. Guests keep true headshot avatars.
2026-12-04 05:56:18 -06:00
Ratdoku Builder f2a92e6be2 fix(profile): verify and correct headshots, picker and icon
Verification pass: generated true face close-ups for all avatars, gave the wallpaper picker a real height so previews show, corrected Crumb's headshot, and removed the generic paw from the icon.
2026-12-04 05:48:42 -06:00
Ratdoku Builder a54279ffd1 fix(profile): polish touch scroll, avatars and wallpaper picker
Local-only v0.8.1 build. Achievement rows pass touch drags, avatars use head crops and hide locked identities, difficulty cycles Zen/Easy/Normal, wallpaper setting opens a preview picker, Brie uses the approved render with a text-free sheet, and the app icon is regenerated in gouache style.
2026-12-04 05:37:34 -06:00
Ratdoku Builder 6d302f5cb9 feat(meowdoku): identity, gifts, achievements and wallpapers
Local-only v0.8.0 build. Adds player name/ID, achievements, claimable 7-day gift, daily share/stats, saved boards, 2048px rat-track wallpapers, difficulty/volume settings, and save v6. Not pushed or published.
2026-12-03 21:21:59 -06:00
Ratdoku Builder 5c00b35e90 feat(audio): add instrumental lounge loop and refresh Brie
Local-only v0.7.0 build. Adds a 60-second instrumental Stable Audio 3 loop with a Settings toggle and save version 5, regenerates Brie with small dark eyes and matching gouache style, and updates QA. Not pushed or published.
2026-12-03 19:45:53 -06:00
67 changed files with 2977 additions and 167 deletions

No files matched your search

+42
View File
@@ -2,6 +2,48 @@
All notable alpha milestones for Ratdoku.
## v0.9.0-alpha — Hotel Life (local build)
- Added three story vignettes for every guest, revealed on first meeting, 3rd visit, and 7th visit; the Guest Book detail now has a scrollable Story section.
- Added a 100/115/130% text size setting that applies live, plus an Android haptics toggle.
- Difficulty now opens a picker with plain-language Zen / Easy / Normal descriptions instead of cycling inline.
- Added six repeating cozy hotel events with a Home banner, event detail, daily-room goal, and a claimable cosmetic gift and frame.
- The Home mascot now shows a deterministic guest of the day; tapping cycles through unlocked guests with a story teaser.
- Added Free play with 30 deterministic symmetry variants of the verified boards; it never writes progress, unlocks, achievements, or guest stories.
- Save format is now v7 with guest notes and event state; existing saves migrate automatically.
- Full QA is 9/9 stages, including the free-play uniqueness suite and Android build.
## v0.8.1-alpha — UI Polish
- Fixed touch scrolling on dynamically rebuilt achievement rows.
- Avatar previews now use circular head crops instead of full-body thumbnails.
- Locked guest avatars now show `???` and room number instead of revealing name and portrait.
- Difficulty cycle is now Zen → Easy → Normal.
- Wallpaper setting opens a themed picker with real image previews and Confirm/Cancel.
- Regenerated Brie with the approved cheese-and-notebook render and a text-free character sheet.
- Added a new Krea2-generated app icon in the project's gouache style.
- Verification pass replaced the circular full-body guest crops with true face close-ups; Crumb keeps the original in-game portrait.
- Verification pass fixed the wallpaper picker panel height so all five previews are visible and scrollable.
- Verification pass removed the generic animal paw from the icon; rat-track motifs stay on the wallpapers only.
## v0.8.0-alpha — Meowdoku Lessons (local build)
- Added editable player name and generated player ID in Profile.
- Added an achievements list, a claimable 7-day gift that unlocks the Gold wallpaper, and a Share result button with daily totals and next-room countdown.
- Added save/resume for in-progress campaign and daily boards, with per-day completion times.
- Added five 2048×2048 wallpaper backgrounds with rat paw-print motifs and a cream veil for readability.
- Added Normal / Easy / Zen difficulty presets, music volume, and SFX settings.
- Save format moves to version 6. All QA stages pass.
- Not yet published to Gitea.
## v0.7.0-alpha — Hotel Tunes (local build)
- Added a 60-second instrumental-only cozy hotel lounge loop, generated with Stable Audio 3.
- Music plays across all screens and can be toggled in Settings.
- Regenerated Brie with a pearl-coat food-critic look and small dark eyes matching the cast; refreshed her thumb, card, board head, variant, and character sheet.
- Save format moves to version 5 with the new music setting.
- Not yet published to Gitea.
## v0.6.4-alpha — Polished Edges
- Daily Streak screen now shows 3-day Regular and 7-day Night Owl reward milestones with progress.
+20 -16
View File
@@ -19,7 +19,8 @@ The project uses a portrait **360×640 dp canvas**, scaled to a 540×960 desktop
- 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. All 30 rooms rotate once before repeating. Replaying the same day never counts twice. Open **Streak** for the weekly calendar, next-frame goal, and reward milestones.
- Tap **Crumb** in the top-left to open your Profile, where you can choose an avatar and a frame. Choices apply on Confirm.
- Tap **Crumb** in the top-left to open your Profile, where you can edit your name, see your ID, choose an avatar and frame, and track achievements.
- Keep a 7-day streak to claim the weekly gift, which unlocks the Gold wallpaper. Share your daily result from the Streak screen.
- 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.
@@ -41,9 +42,10 @@ The board uses circular **head tokens** from `art/guests/heads/`. Crumb remains
- **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, day-7 gift marker, and streak reward milestones.
- **Settings** — a bottom sheet over Home or the board: room patterns, timer, reduce motion, double-tap placement (on by default), hold time, music, how to play, restart/back, reset progress. Destructive actions use a themed in-app confirmation card.
- **Profile** — editable player name and generated ID, framed avatar preview, rooms completed, current and best daily streaks, tabbed Avatar / Frame pickers with Confirm / Cancel, and an achievements list. Guest portraits unlock with their Guest Book entry.
- **Daily Streak** — big current streak, best-streak pill, weekly calendar with per-day times, total dailies solved, next-daily countdown, Share result, claimable 7-day gift, and streak reward milestones.
- **Wallpapers & difficulty** — five 2048×2048 rat-track wallpapers, plus Normal / Easy / Zen difficulty presets in Settings.
- **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board.
## Unlocks
@@ -148,12 +150,12 @@ build/Ratdoku.apk
It is a **debug-signed, arm64-v8a** APK:
- Package: `com.ratdoku.game`
- Version: `0.6.4` (version code 16)
- Version: `0.9.0` (version code 20)
- Min SDK: 24 (Android 7.0)
- Target SDK: 36
- Size: about 41 MB
- Size: about 54 MB
- Portrait orientation
- Build label: `v0.6.4-alpha · build 2026-12-03`
- Build label: `v0.9.0-alpha · build 2026-12-05`
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:
@@ -202,7 +204,7 @@ Run the whole QA suite (class scan, every test script, log-error scan, optional
## Versioning and releases
The current development build is **v0.6.4-alpha** (“Polished Edges”) with the build label on Home and in Settings.
The current development build is **v0.9.0-alpha** (“Hotel Life”) with the build label on Home and in Settings.
Gitea repository:
@@ -226,14 +228,15 @@ Alpha releases (all marked prerelease, each with a debug APK and source archive)
- **v0.6.2-alpha** — transparent cutout portraits, alternate variants, and full character sheets
- **v0.6.3-alpha** — full 30-room daily rotation, visible profile actions, and reset-safe avatar/frame selection
- **v0.6.4-alpha** — streak reward milestones and cleaned Krea2 workflow prompts
- **v0.7.0-alpha** — instrumental hotel-lounge music, Music toggle, and Brie refresh
- **v0.8.0-alpha** — player ID, achievements, claimable gift, daily share/stats, board resume, wallpapers
- **v0.8.1-alpha** — touch-scroll fix, headshot avatars, locked-guest privacy, wallpaper picker, difficulty order, new icon
- **v0.9.0-alpha** — guest stories, text scaling, haptics, difficulty picker, cozy events, and free play
https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.6.4-alpha
The latest published release is v0.8.1-alpha:
https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/tag/v0.8.1-alpha
The v0.6.4-alpha APK is also at:
`https://gitea.nyxara.cc/Ahri-the-Vastaya/Ratdoku/releases/download/v0.6.4-alpha/Ratdoku-v0.6.4-alpha.apk`
`redesign-360` is the branch with the current 360dp work; it is tagged `v0.6.4-alpha`.
`redesign-360` is the branch with the current 360dp work; the local build is v0.9.0-alpha and is not published yet.
The version is set in three places: `project.godot` (`config/version`), `scripts/Version.gd` (display label), and `export_presets.cfg` (`version/name`, `version/code`).
@@ -247,7 +250,8 @@ The version is set in three places: `project.godot` (`config/version`), `scripts
- 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)
- Daily room with streaks, Profile screen, selectable avatars and frames, achievements, wallpapers, saved boards (save version 6)
- 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
- Instrumental hotel-lounge loop with a Music toggle (no lyrics), generated with Stable Audio 3
- No release keystore/AAB yet
Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

+56
View File
@@ -0,0 +1,56 @@
[
{
"id": "rainy_day",
"name": "Rainy Day",
"description": "Rain taps on the windows while the lobby fills with little puddles and borrowed towels. Miso greets every soaked guest with a warm spot by the fire.",
"duration_days": 4,
"featured_guest": "miso",
"reward_frame": "event_rain",
"gift": "Puddle Boot Cover"
},
{
"id": "tea_week",
"name": "Tea Week",
"description": "The tea room stays open all afternoon with an endless pot and a plate of nutmeg biscuits. Nutmeg quietly learns how everyone takes their cup.",
"duration_days": 5,
"featured_guest": "nutmeg",
"reward_frame": "event_tea",
"gift": "Tea Set Treat"
},
{
"id": "harvest_supper",
"name": "Harvest Supper",
"description": "Long tables, warm rolls, and the last bright vegetables of the season. Biscuit makes sure no one leaves the supper with an empty plate.",
"duration_days": 6,
"featured_guest": "biscuit",
"reward_frame": "event_harvest",
"gift": "Harvest Bread Basket"
},
{
"id": "lantern_night",
"name": "Lantern Night",
"description": "Small lanterns line the halls and the lobby glows softly after dark. Pepper keeps a watchful, gentle eye on the night shift.",
"duration_days": 3,
"featured_guest": "pepper",
"reward_frame": "event_lantern",
"gift": "Paper Lantern Charm"
},
{
"id": "book_club",
"name": "Book Club",
"description": "The library pulls up extra chairs for a slow, cosy read together. Mabel recommends just the right story and only shushes when the plot needs it.",
"duration_days": 7,
"featured_guest": "mabel",
"reward_frame": "event_book",
"gift": "Storybook Bookmark"
},
{
"id": "spring_cleaning",
"name": "Spring Cleaning",
"description": "Fresh linens, open windows, and a gentle tidying of every nook. Cocoa leaves the rooms smelling like a quiet Sunday morning.",
"duration_days": 5,
"featured_guest": "cocoa",
"reward_frame": "event_spring",
"gift": "Fresh Linen Bow"
}
]
+150 -25
View File
@@ -9,7 +9,12 @@
"personality": "Eager, a little clumsy, and knows every suitcase by name.",
"snack": "toasted sesame",
"unlock_room": 0,
"accent": "#b46a5a"
"accent": "#b46a5a",
"stories": [
"Miso skids to a halt in the lobby, breathless, and introduces you to a suitcase he has clearly been waiting all morning to meet. There are toasted sesame crumbs on his whiskers.",
"'Third visit!' Miso beams, producing a suitcase from behind the desk as if he had hidden it just for you. He insists it has always known your name.",
"By now Miso has greeted you at every door in the hotel, usually before you reach it. He presses a warm sesame seed into your paw like a tiny official welcome."
]
},
{
"id": "hilde",
@@ -21,7 +26,12 @@
"personality": "Deadpan, unflappable, and secretly the kindest rat in the hotel.",
"snack": "warm oat milk",
"unlock_room": 0,
"accent": "#c9a227"
"accent": "#c9a227",
"stories": [
"Hilde looks up from folding a sheet, says the weather is 'acceptable,' and quietly sets a saucer of warm oat milk within reach.",
"'You're back,' Hilde says, which from her is practically a fanfare. She had already turned down your corner of the bed before you asked.",
"Hilde has stopped pretending not to leave the good blanket out for you. She calls it 'inventory,' and slides the oat milk a little closer."
]
},
{
"id": "pip",
@@ -33,7 +43,12 @@
"personality": "Small, bold, and convinced he can carry anything twice his size.",
"snack": "pumpkin seed",
"unlock_room": 0,
"accent": "#8a6f4d"
"accent": "#8a6f4d",
"stories": [
"Pip marches up to you, assesses your bags with a solemn squint, and announces he can carry all of them. He starts with the smallest one, just to be fair.",
"Pip has been practicing in the corridor and now hoists your bag with a triumphant squeak. He accepts a pumpkin seed as payment with great dignity.",
"Your bags are already waiting in your room when you arrive, stacked with suspicious precision. Pip denies carrying them twice his size; he says he carried them once, very carefully."
]
},
{
"id": "nana_fig",
@@ -45,7 +60,12 @@
"personality": "Has run the front desk since before the hotel had a front door.",
"snack": "fig jam",
"unlock_room": 0,
"accent": "#7d6b8a"
"accent": "#7d6b8a",
"stories": [
"Nana Fig peers over the front desk and says she has been welcoming folks here since the door was still a curtain. She slides a little pot of fig jam across the counter.",
"'Third time,' Nana Fig says fondly, tapping the ledger. 'The curtain days were louder, but I don't say better.'",
"Nana Fig has taken to keeping your key where she can reach it without looking. She tells you the hotel's oldest stories, and the fig jam, in the same breath."
]
},
{
"id": "biscuit",
@@ -57,7 +77,12 @@
"personality": "Believes every problem can be solved with a warm roll.",
"snack": "buttered toast",
"unlock_room": 0,
"accent": "#d9a441"
"accent": "#d9a441",
"stories": [
"Biscuit appears with a flour-dusted apron and a warm roll held out like a solution. 'Everything's better,' she says, 'after the first bite.'",
"Biscuit has remembered which roll you liked and kept one warm, though she claims it was coincidence. There is buttered toast on the side, just in case.",
"The bakery is already glowing when you arrive, and Biscuit waves a roll like a greeting. She says she knew you would come back; the dough had a feeling."
]
},
{
"id": "pepper",
@@ -69,7 +94,12 @@
"personality": "Patrols the halls with a lantern and a very serious expression.",
"snack": "black pepper crackers",
"unlock_room": 1,
"accent": "#4f5d75"
"accent": "#4f5d75",
"stories": [
"Pepper steps out of the dark with his lantern, gives your paperwork a grave once-over, and nods you in. He offers a cracker as though it were an official greeting.",
"'Same hour again,' Pepper says, not quite a question. He has been leaving a cracker on the hall table on the nights you are expected.",
"Pepper's serious expression softens by exactly one whisker-twitch when he sees you. He walks you to your door and says the halls are quieter when you are about."
]
},
{
"id": "pickle",
@@ -81,7 +111,12 @@
"personality": "Grows herbs on the roof and talks to the parsley.",
"snack": "pickled cucumber",
"unlock_room": 2,
"accent": "#7e9c5a"
"accent": "#7e9c5a",
"stories": [
"Pickle comes down from the roof with soil on his paws, mid-conversation with someone he calls parsley. He offers you a crisp pickled cucumber and asks what you think of the mint.",
"Pickle wants to know if you noticed the new basil on the roof. He says he grew it for the smell, but keeps glancing at your cucumber like he is waiting for a review.",
"By now Pickle greets the parsley by name and you with a whole jar of pickles. He confides that the parsley likes you; it leaned toward the window the last time you visited."
]
},
{
"id": "nutmeg",
@@ -93,7 +128,12 @@
"personality": "Can tell your mood from how you take your tea.",
"snack": "nutmeg biscuit",
"unlock_room": 3,
"accent": "#b07d4f"
"accent": "#b07d4f",
"stories": [
"Nutmeg sets down a cup without asking how you take it, then watches your face for the verdict. A nutmeg biscuit arrives, because she has already decided you need one.",
"'You're taking it sweeter today,' Nutmeg observes, pleased with herself. She is right, and she knows she is right.",
"Nutmeg has your tea ready before you sit down and says your mood is 'excellent company' today. She slides the biscuit over with a look that brooks no argument."
]
},
{
"id": "mabel",
@@ -105,7 +145,12 @@
"personality": "Runs the hotel library and shushes only when absolutely necessary.",
"snack": "honey candy",
"unlock_room": 4,
"accent": "#5b7fa6"
"accent": "#5b7fa6",
"stories": [
"Mabel looks up from a towering stack of books, smiles, and points out the quietest chair in the house. A honey candy appears on the armrest, left there without a word.",
"Mabel has set aside a book she thinks suits you, though she only says 'filed it nearby.' She did not shush once this visit, which is her version of a celebration.",
"Mabel now keeps a honey candy in the same spot every time, and a bookmark in your book. She says a good reader is worth the fuss, then goes back to shelving very quietly."
]
},
{
"id": "mochi",
@@ -117,7 +162,12 @@
"personality": "Plays the tiny violin in the lobby at dusk.",
"snack": "sweet rice cake",
"unlock_room": 5,
"accent": "#c05b6b"
"accent": "#c05b6b",
"stories": [
"As dusk settles, Mochi lifts his tiny violin and plays a note that makes the lobby go still. He offers you a sweet rice cake and says the next one is for you.",
"Mochi has begun a little tune he calls 'the visiting one,' though he is modest about it. He plays it while you unwrap your rice cake.",
"The violin is already tuned when you come in, and Mochi grins like he had been listening for your footsteps. He says the lobby sounds better with you in it, then plays your tune again."
]
},
{
"id": "crumpet",
@@ -129,7 +179,12 @@
"personality": "Up before the sun, flour on his nose by sunrise.",
"snack": "warm crumpet",
"unlock_room": 6,
"accent": "#b57a4a"
"accent": "#b57a4a",
"stories": [
"Crumpet opens the door with flour up to his elbows, apologizing for the mess before anyone mentions it. He hands you a warm crumpet and says the day is a good one so far.",
"'You're an early one,' Crumpet says, delighted, as if you had joined a secret club. He has kept the first crumpet of the batch for you.",
"There is flour on Crumpet's nose and a crumpet on the counter with your name on the napkin. He claims he gets up early for the bread; the crumpet says otherwise."
]
},
{
"id": "waffle",
@@ -141,7 +196,12 @@
"personality": "Presses a perfect crease and never comments on the mess.",
"snack": "maple candy",
"unlock_room": 7,
"accent": "#c78f52"
"accent": "#c78f52",
"stories": [
"Waffle takes your coat with a nod and returns it with a crease so sharp it looks newly made. He says nothing about the mud on your boots, only sets a maple candy by the door.",
"Waffle has your coat ready before you ask, pressed to a fare-thee-well. He notes, very gently, that it is holding up beautifully.",
"Waffle now keeps a maple candy in your coat pocket, and never once mentions the mud. He calls the crease 'a small kindness,' which is the most he will say about it."
]
},
{
"id": "cocoa",
@@ -153,7 +213,12 @@
"personality": "Makes the linens smell like a quiet Sunday morning.",
"snack": "dark chocolate",
"unlock_room": 8,
"accent": "#6f5a4d"
"accent": "#6f5a4d",
"stories": [
"Cocoa emerges from a cloud of warm linen, and the whole hallway smells like a slow Sunday. She tucks a square of dark chocolate into your paw and tells you the sheets are ready.",
"Cocoa has set aside the softest blanket without being asked, saying only that it 'needed airing.' She knows by now which side of the bed you favor.",
"Cocoa's linens are folded in your favorite way and there is chocolate waiting on the pillow. She says a well-rested guest is a quiet triumph, and means it."
]
},
{
"id": "olive",
@@ -165,7 +230,12 @@
"personality": "Knows a good route to anywhere, and three better ones.",
"snack": "olive tapenade",
"unlock_room": 9,
"accent": "#7a6b9a"
"accent": "#7a6b9a",
"stories": [
"Olive draws you a route on a scrap of paper, then draws two more 'in case you feel adventurous.' She sets down olive tapenade and insists the long way is the nicest.",
"Olive asks where you are going, then suggests a path that was not on any map you have seen. There is tapenade waiting, because of course there is.",
"Olive has three routes ready for you before you name a destination. She confides that her favorite is the one past the kitchen, where the smells are best."
]
},
{
"id": "brie",
@@ -177,7 +247,12 @@
"personality": "Reviews the breakfast with one raised eyebrow.",
"snack": "soft cheese",
"unlock_room": 10,
"accent": "#b8a27a"
"accent": "#b8a27a",
"stories": [
"Brie takes one bite of the breakfast, raises a single eyebrow, and says only, 'Prompt.' She allows you a sliver of soft cheese from her own plate.",
"Brie's eyebrow lifts again, but this time there is a trace of a smile. She says the toast has improved since your last visit and refuses to explain how she knows.",
"Brie has begun setting a place for you at breakfast without comment. She calls the cheese 'acceptable' and slides the better piece your way."
]
},
{
"id": "basil",
@@ -189,7 +264,12 @@
"personality": "Mixes remedies for homesickness and hiccups.",
"snack": "fresh basil",
"unlock_room": 11,
"accent": "#6f8f6a"
"accent": "#6f8f6a",
"stories": [
"Basil snips a sprig of fresh basil and presses it into your paw before you have said a word. He says he makes something for homesickness, and something else for hiccups, just in case.",
"Basil asks, with great tact, whether last visit's remedy helped. He has been mixing a new one, he says, for the particular sort of tired that travel brings.",
"Basil has a little pouch ready with your name on it and a sprig of basil tucked in. He says the best remedy is often just being somewhere warm, and he is glad you are here."
]
},
{
"id": "juniper",
@@ -201,7 +281,12 @@
"personality": "Reads tea leaves, tarot cards, and the occasional receipt.",
"snack": "juniper berry",
"unlock_room": 12,
"accent": "#6b5d7a"
"accent": "#6b5d7a",
"stories": [
"Juniper peers into your tea leaves, then at a tarot card, then at a receipt she found somewhere. She declares you will stay longer than you planned, and offers a juniper berry for luck.",
"'The leaves say you'll return,' Juniper says, as though this were news to no one but you. She has been keeping a card from the deck for your next visit.",
"Juniper has your cup already brewed and a reading half-finished. She says the cards are fond of you, and the receipt she saved says the same thing, in its own way."
]
},
{
"id": "tofu",
@@ -213,7 +298,12 @@
"personality": "Checks in late, tips well, and hides in the scarf.",
"snack": "plain rice",
"unlock_room": 13,
"accent": "#c9b79c"
"accent": "#c9b79c",
"stories": [
"Tofu arrives after dark, mostly hidden in a thick scarf, and slides a generous tip across the desk without meeting anyone's eye. A small bowl of plain rice is waiting in the room.",
"Tofu checks in a little earlier this time, and the scarf sits lower on his face. He leaves the rice bowl spotless, which he seems pleased about.",
"Tofu does not hide in the scarf at all now, and tips the desk with both paws. He has started asking about the quiet hours, as if he plans to enjoy them."
]
},
{
"id": "squeak",
@@ -225,7 +315,12 @@
"personality": "Can make a pair of boots look brand new in four minutes.",
"snack": "cheese rind",
"unlock_room": 14,
"accent": "#8a6448"
"accent": "#8a6448",
"stories": [
"Squeak pats the stool and gets to work, and in four minutes your boots are unrecognizable. He accepts a cheese rind with the air of a craftsman paid fairly.",
"Squeak has been waiting for your boots, he says, because he knew they would need him again. He makes them shine and keeps a cheese rind for later.",
"Squeak now greets your boots before he greets you, which he considers only polite. He says they have become his favorite pair, and polishes them like it."
]
},
{
"id": "nib",
@@ -237,7 +332,12 @@
"personality": "Keeps the ledger, the keys, and everyone's secrets.",
"snack": "ink-black tea",
"unlock_room": 15,
"accent": "#5f6b5a"
"accent": "#5f6b5a",
"stories": [
"Nib looks up from the ledger, notes your arrival with a single neat line, and says nothing at all about the key he has already set out. He pours ink-black tea and opens a fresh page.",
"Nib's ledger shows three tidy entries for you now, though he will not say what else he has written. He pours the tea without asking, which is his way of saying he remembered.",
"Nib keeps your key in the same place and your page in the same book. He says some things are worth recording, then closes the ledger with a satisfied little click."
]
},
{
"id": "pumpernickel",
@@ -249,7 +349,12 @@
"personality": "Bakes the bread that wakes the hotel.",
"snack": "dark rye",
"unlock_room": 16,
"accent": "#5d4a3a"
"accent": "#5d4a3a",
"stories": [
"Pumpernickel pulls a dark rye loaf from the oven at an hour when the rest of the hotel is still asleep. He says the bread will wake everyone shortly, and hands you the first slice.",
"'The loaf rose early tonight,' Pumpernickel says, which he insists is your doing. He has kept the crusty end for you.",
"The smell of dark rye reaches your room before you are fully awake, and Pumpernickel is already slicing. He says the hotel has come to expect you at this hour."
]
},
{
"id": "marzipan",
@@ -261,7 +366,12 @@
"personality": "Has planned nine weddings and cried at all of them.",
"snack": "almond candy",
"unlock_room": 17,
"accent": "#d4a7a0"
"accent": "#d4a7a0",
"stories": [
"Marzipan dabs her eyes with a handkerchief and assures you she is perfectly fine; she has just seen the flowers. She offers an almond candy and says the lobby looks lovely today.",
"Marzipan has planned a small celebration for no particular reason, and cried at the centerpiece. She says you are welcome to join; there is always room for one more.",
"Marzipan keeps a candy and a handkerchief ready for you now. She says she has planned nine weddings and this visit might be her favorite, which makes her cry a little."
]
},
{
"id": "poppy",
@@ -273,7 +383,12 @@
"personality": "The fastest key-runner on the night shift.",
"snack": "poppy-seed cake",
"unlock_room": 18,
"accent": "#b65d5d"
"accent": "#b65d5d",
"stories": [
"A blur of fawn fur skids to a stop in front of you, and Poppy presents your key before you have finished asking. She is already moving when she hands over a slice of poppy-seed cake.",
"Poppy delivers your key in record time again, then slows down just long enough to ask if you would like cake. She says she has been practicing.",
"Poppy has your key waiting at the door and a slice of cake on the counter. She swears the fastest run is the one that ends with someone saying hello."
]
},
{
"id": "clover",
@@ -285,7 +400,12 @@
"personality": "Found a four-leaf clover in the lobby and never left.",
"snack": "green apple",
"unlock_room": 19,
"accent": "#6f9a5a"
"accent": "#6f9a5a",
"stories": [
"Clover holds out a four-leaf clover he found right there in the lobby, then a green apple from the same spot, or so he claims. He says luck has a way of following him, and maybe you.",
"Clover is still in the lobby, and still lucky, and now he has saved you a green apple. He says the clover has been looking forward to your return.",
"Clover has added a fifth leaf, he says, though you are not sure how. He shares the apple and says the best luck is having somewhere to come back to."
]
},
{
"id": "marmalade",
@@ -297,6 +417,11 @@
"personality": "Knows exactly how you like your toast.",
"snack": "orange marmalade",
"unlock_room": 20,
"accent": "#d08a3e"
"accent": "#d08a3e",
"stories": [
"Marmalade sets down toast done exactly to your liking, though you have never told him how you take it. He spreads orange marmalade with great concentration and says breakfast is served.",
"Marmalade has your toast ready at the precise moment you sit down. He says it is a knack, and refuses to share the secret of the marmalade.",
"Marmalade pours the tea before you ask and does the toast just so, as always. He says he has been listening, and that it has been a pleasure."
]
}
]
+33 -2
View File
@@ -32,8 +32,8 @@ architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=16
version/name="0.6.4"
version/code=20
version/name="0.9.0"
package/unique_name="com.ratdoku.game"
package/name="Ratdoku"
package/signed=true
@@ -59,3 +59,34 @@ apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PackedStringArray()
permissions/vibrate=true
[preset.1]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter="data/*.json"
exclude_filter="art/guests/source/*"
export_path="build/Ratdoku.exe"
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=true
binary_format/architecture="x86_64"
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 KiB

After

Width:  |  Height:  |  Size: 454 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 79 KiB

+1 -1
View File
@@ -12,7 +12,7 @@ config_version=5
config/name="Ratdoku"
run/main_scene="res://scenes/Main.tscn"
config/version="0.6.4-alpha"
config/version="0.9.0-alpha"
config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.png"
boot_splash/show_image=false
+6
View File
@@ -38,6 +38,12 @@ static func portrait_path(id: String) -> String:
return str(avatar.get("path", "res://art/crumb_head.png"))
static func head_path(id: String) -> String:
if id == "crumb":
return "res://art/crumb_head.png"
return "res://art/guests/heads/%s.png" % id
static func is_unlocked(id: String) -> bool:
if id == "crumb":
return true
+41
View File
@@ -167,6 +167,46 @@ func set_level(level: Dictionary) -> void:
changed.emit()
func snapshot() -> Dictionary:
return {
"level_id": level_id,
"n": n,
"cells": cells.duplicate(true),
"auto_x": auto_x.duplicate(true),
"history": history.duplicate(true),
}
func restore_state(snapshot: Dictionary) -> bool:
if snapshot.is_empty() or str(snapshot.get("level_id", "")) != level_id:
return false
var saved_cells = snapshot.get("cells")
var saved_marks = snapshot.get("auto_x")
var saved_history = snapshot.get("history")
if (
typeof(saved_cells) != TYPE_ARRAY
or typeof(saved_marks) != TYPE_ARRAY
or typeof(saved_history) != TYPE_ARRAY
or saved_cells.size() != n
or saved_marks.size() != n
):
return false
cells = saved_cells.duplicate(true)
auto_x = saved_marks.duplicate(true)
history = saved_history.duplicate(true)
for key in fixed:
cells[key.x][key.y] = RAT
conflict_cells = Rules.conflicts(cells, regions)
pending_tap_cell = Vector2i(-1, -1)
press_cell = Vector2i(-1, -1)
hold_fired = false
last_placed = Vector2i(-1, -1)
pop_time = 0.0
queue_redraw()
changed.emit()
return true
func _draw() -> void:
if regions.size() != n or n <= 0:
return
@@ -516,6 +556,7 @@ func _set_cell(cell: Vector2i, value: int) -> void:
if value == RAT:
last_placed = cell
pop_time = 0.0 if reduce_motion else 0.26
UI.haptic(false)
_after_change()
+29
View File
@@ -33,6 +33,30 @@ const DEFS := [
"id": "night", "name": "Night owl", "rooms": 0, "streak": 7,
"border": Palette.INK, "width": 4, "shadow": Palette.GOLD, "shadow_size": 8,
},
{
"id": "event_rain", "name": "Puddle boots", "rooms": 0, "streak": 0,
"border": Palette.MUTED, "width": 3, "shadow": Palette.ROSE, "shadow_size": 5,
},
{
"id": "event_tea", "name": "Tea set", "rooms": 0, "streak": 0,
"border": Palette.ORANGE, "width": 3, "shadow": Palette.GOLD, "shadow_size": 5,
},
{
"id": "event_harvest", "name": "Harvest", "rooms": 0, "streak": 0,
"border": Palette.GOLD, "width": 4, "shadow": Palette.ORANGE_DARK, "shadow_size": 6,
},
{
"id": "event_lantern", "name": "Lantern", "rooms": 0, "streak": 0,
"border": Palette.ORANGE_DARK, "width": 3, "shadow": Palette.GOLD, "shadow_size": 8,
},
{
"id": "event_book", "name": "Book club", "rooms": 0, "streak": 0,
"border": Palette.WALL, "width": 3, "shadow": Palette.PAPER, "shadow_size": 5,
},
{
"id": "event_spring", "name": "Fresh linen", "rooms": 0, "streak": 0,
"border": Palette.ROSE, "width": 3, "shadow": Palette.WHITE, "shadow_size": 6,
},
]
@@ -51,6 +75,9 @@ static func is_unlocked(id: String) -> bool:
var frame := by_id(id)
if frame.is_empty():
return false
var frame_id := str(frame.get("id", ""))
if frame_id.begins_with("event_"):
return SaveGame.claimed_event_frames().has(frame_id)
var rooms: int = SaveGame.rooms_completed()
var streak: int = SaveGame.best_streak()
return rooms >= int(frame.get("rooms", 0)) and streak >= int(frame.get("streak", 0))
@@ -60,6 +87,8 @@ static func requirement_text(id: String) -> String:
var frame := by_id(id)
if frame.is_empty():
return ""
if str(frame.get("id", "")).begins_with("event_"):
return "Event reward"
var rooms := int(frame.get("rooms", 0))
var streak := int(frame.get("streak", 0))
if rooms > 0 and streak > 0:
+197
View File
@@ -0,0 +1,197 @@
class_name FreePlay
extends RefCounted
## Deterministic free-play variants of the verified levels.json boards.
##
## Only structure-preserving maps are used:
## * a dihedral symmetry of the square (rotation / mirror) applied to every
## cell, to `solution` (row -> column) and to the `clues` coordinates;
## * a one-to-one relabeling of region ids applied to every cell of `regions`.
##
## Both maps are automorphisms of the puzzle. They keep one rat per row, column
## and region, the "no two rats touching (even diagonally)" rule, and the exact
## number of solutions: a D4 symmetry is a bijection of cells that preserves
## adjacency and region membership, and a region relabeling preserves the
## equality relation between cells. Consequently every solution of the source
## (including any alternate one) maps to exactly one solution of the variant
## and back, so the verified uniqueness is preserved rather than re-guessed.
## The source solution is transported through the same map; no new solution is
## invented.
##
## Board.gd derives each region's guest portrait from the region id and the
## level id, so relabeling region ids relabels the associated guest ids too;
## the level dictionaries carry no separate guest-id array to transform.
##
## `id` is deliberately kept from the source so that applying the inverse map
## recovers the source entry byte-for-byte at the value level.
const LEVELS_PATH := "res://data/levels.json"
const N := 8
const SYMMETRY_COUNT := 8
## Loads and parses the verified level pack. Returns only dictionary entries.
static func all_source_levels() -> Array:
if not FileAccess.file_exists(LEVELS_PATH):
push_warning("FreePlay: no level file at %s" % LEVELS_PATH)
return []
var file := FileAccess.open(LEVELS_PATH, FileAccess.READ)
if file == null:
push_warning("FreePlay: could not open %s" % LEVELS_PATH)
return []
var parsed = JSON.parse_string(file.get_as_text())
file.close()
if typeof(parsed) != TYPE_ARRAY:
push_warning("FreePlay: %s is not a JSON array" % LEVELS_PATH)
return []
var levels: Array = []
for entry in parsed:
if typeof(entry) == TYPE_DICTIONARY:
levels.append(entry)
return levels
## Deterministic parameters shared by variant() and the QA inverse check.
## source_index picks a verified level; symmetry is a D4 index; region_map is a
## permutation of 0..N-1 applied to region ids, with its inverse provided too.
static func variant_params(seed: int, index: int) -> Dictionary:
var levels := all_source_levels()
var count := levels.size()
if count == 0:
return {}
var source_index := _mod(seed + index, count)
# An explicit seed keeps results identical across runs and platforms.
var rng := RandomNumberGenerator.new()
rng.seed = seed ^ (index * 2654435761)
var symmetry := rng.randi_range(0, SYMMETRY_COUNT - 1)
var region_map: Array = []
for i in N:
region_map.append(i)
for i in range(N - 1, 0, -1):
var j := rng.randi_range(0, i)
var tmp = region_map[i]
region_map[i] = region_map[j]
region_map[j] = tmp
var inverse_map: Array = []
inverse_map.resize(N)
for i in N:
inverse_map[int(region_map[i])] = i
return {
"source_index": source_index,
"symmetry": symmetry,
"region_map": region_map,
"inverse_map": inverse_map,
}
## Maps one cell coordinate through D4 symmetry `symmetry` on an n x n board:
## 0 identity; 1 rot90 cw; 2 rot180; 3 rot270 cw;
## 4 mirror left/right; 5 mirror top/bottom;
## 6 main-diagonal flip; 7 anti-diagonal flip.
static func transform_cell(r: int, c: int, symmetry: int, n: int = N) -> Vector2i:
var last := n - 1
match symmetry:
0:
return Vector2i(r, c)
1:
return Vector2i(c, last - r)
2:
return Vector2i(last - r, last - c)
3:
return Vector2i(last - c, r)
4:
return Vector2i(r, last - c)
5:
return Vector2i(last - r, c)
6:
return Vector2i(c, r)
7:
return Vector2i(last - c, last - r)
return Vector2i(r, c)
## The inverse of each D4 element. Four of them are self-inverse.
static func inverse_symmetry(symmetry: int) -> int:
match symmetry:
1:
return 3
3:
return 1
_:
return symmetry
## Returns a variant level in exactly the same shape as a levels.json entry:
## { clues, id, n, regions, solution }, with the same float value types.
static func variant(seed: int, index: int) -> Dictionary:
var params := variant_params(seed, index)
if params.is_empty():
return {}
var levels := all_source_levels()
var source: Dictionary = levels[int(params["source_index"])]
var n := int(source.get("n", N))
var symmetry := int(params["symmetry"])
var region_map: Array = params["region_map"]
var src_regions: Array = source.get("regions", [])
var src_solution: Array = source.get("solution", [])
var src_clues: Array = source.get("clues", [])
var regions: Array = []
for r in n:
var row: Array = []
for c in n:
row.append(0.0)
regions.append(row)
# Move every cell (and its relabeled region id) to its mirrored position.
for r in n:
for c in n:
var dest := transform_cell(r, c, symmetry, n)
var old_id := int(src_regions[r][c])
var new_id: int = old_id
if old_id >= 0 and old_id < region_map.size():
new_id = int(region_map[old_id])
regions[dest.x][dest.y] = float(new_id)
# solution[row] is the rat's column; a symmetry permutes rows, so write
# each transported rat into its new row.
var solution: Array = []
solution.resize(n)
for r in n:
var c := int(src_solution[r])
var dest := transform_cell(r, c, symmetry, n)
solution[dest.x] = float(dest.y)
# Clues are [row, column] coordinates of fixed rats.
var clues: Array = []
for clue in src_clues:
var r := int(clue[0])
var c := int(clue[1])
var dest := transform_cell(r, c, symmetry, n)
clues.append([float(dest.x), float(dest.y)])
return {
"clues": clues,
"id": str(source.get("id", "")),
"n": float(n),
"regions": regions,
"solution": solution,
}
static func _mod(value: int, modulus: int) -> int:
var result := value % modulus
if result < 0:
result += modulus
return result
+1
View File
@@ -0,0 +1 @@
uid://r1xo7agldkxm
+128 -12
View File
@@ -14,6 +14,9 @@ var elapsed_ms := 0
var win_shown := false
var current_level_id := ""
var daily_mode := false
var free_mode := false
var free_seed := 0
var restoring := false
var daily_key := ""
var ui_paused := false
@@ -32,6 +35,7 @@ var win_next: Button
var new_guest_box: HBoxContainer
var new_guest_label: Label
var new_guest_portrait: TextureRect
var new_guest_story: Label
func _ready() -> void:
@@ -129,13 +133,13 @@ func _build_ui() -> void:
var undo := UI.button("Undo", false, 48)
undo.size_flags_horizontal = Control.SIZE_EXPAND_FILL
undo.add_theme_font_size_override("font_size", 17)
UI.set_font_size(undo, 17)
undo.pressed.connect(_on_undo)
actions.add_child(undo)
var hint := UI.button("Hint", true, 48)
hint.size_flags_horizontal = Control.SIZE_EXPAND_FILL
hint.add_theme_font_size_override("font_size", 17)
UI.set_font_size(hint, 17)
hint.pressed.connect(_on_hint)
actions.add_child(hint)
@@ -211,14 +215,20 @@ func _build_win_overlay() -> void:
new_guest_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
new_guest_box.add_child(new_guest_label)
new_guest_story = UI.label("", 11, Palette.MUTED)
new_guest_story.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
new_guest_story.custom_minimum_size = Vector2(0, 0)
new_guest_story.visible = false
box.add_child(new_guest_story)
var next := UI.button("Next room", true, 48)
next.add_theme_font_size_override("font_size", 17)
UI.set_font_size(next, 17)
box.add_child(next)
next.pressed.connect(_on_next)
win_next = next
var book := UI.button("Guest Book", false, 42)
book.add_theme_font_size_override("font_size", 15)
UI.set_font_size(book, 15)
box.add_child(book)
book.pressed.connect(func() -> void: guest_book_pressed.emit())
@@ -233,13 +243,15 @@ func _make_win_portrait() -> Control:
return RatPortrait.new()
func start_level(index: int, daily: bool = false, key: String = "") -> void:
func start_level(index: int, daily: bool = false, key: String = "", free: bool = false) -> void:
if levels.is_empty():
status_label.text = "No rooms yet."
status_label.add_theme_color_override("font_color", Palette.RED)
return
daily_mode = daily
# Set the mode before set_level(); it emits changed -> save_board().
free_mode = free
daily_mode = daily and not free
daily_key = key
level_index = clampi(index, 0, levels.size() - 1)
var level: Dictionary = levels[level_index]
@@ -252,7 +264,10 @@ func start_level(index: int, daily: bool = false, key: String = "") -> void:
win_shown = false
overlay.visible = false
new_guest_box.visible = false
rule_strip.visible = daily_mode or level_index < 3
new_guest_story.visible = false
var difficulty := str(SaveGame.get_setting("difficulty"))
rule_strip.visible = difficulty == "easy" or difficulty == "zen" or daily_mode or level_index < 3
timer_label.visible = bool(SaveGame.get_setting("show_timer")) and difficulty != "zen"
status_label.text = "Gold rings are already in." if level.get("clues", []).size() > 0 else DEFAULT_STATUS
status_label.add_theme_color_override("font_color", Palette.MUTED)
_refresh_legend()
@@ -264,6 +279,77 @@ func start_daily(index: int, key: String) -> void:
start_level(index, true, key)
func _load_free_levels(seed: int) -> void:
free_seed = seed
levels.clear()
for i in range(30):
var level := FreePlay.variant(seed, i)
if not level.is_empty():
levels.append(level)
## Free play uses verified, symmetry-shuffled boards. It never writes progress,
## unlocks, achievements or guest story visits.
func start_free(seed: int) -> void:
_load_free_levels(seed)
free_mode = true
daily_mode = false
daily_key = ""
start_level(0, false, "", true)
level_label.text = "Free room 1"
func snapshot() -> Dictionary:
var snap := board.snapshot()
snap["level_index"] = level_index
snap["daily_mode"] = daily_mode
snap["daily_key"] = daily_key
snap["free_mode"] = free_mode
snap["free_seed"] = free_seed
snap["elapsed_ms"] = elapsed_ms
return snap
func restore(snapshot: Dictionary) -> bool:
if snapshot.is_empty():
return false
var free := bool(snapshot.get("free_mode", false))
if free:
_load_free_levels(int(snapshot.get("free_seed", 0)))
else:
levels = Levels.load_all()
if levels.is_empty():
return false
var index := clampi(int(snapshot.get("level_index", 0)), 0, levels.size() - 1)
restoring = true
start_level(index, bool(snapshot.get("daily_mode", false)), str(snapshot.get("daily_key", "")), free)
if free:
level_label.text = "Free room %d" % (index + 1)
var ok := board.restore_state(snapshot)
restoring = false
if not ok:
return false
elapsed_ms = int(snapshot.get("elapsed_ms", 0))
started_at = Time.get_ticks_msec() - elapsed_ms
queue_redraw()
return true
func _board_mode() -> String:
if free_mode:
return "free"
return "daily" if daily_mode else "campaign"
func clear_saved_board() -> void:
SaveGame.clear_board(_board_mode())
func save_board() -> void:
if not restoring and not win_shown:
SaveGame.save_board(_board_mode(), snapshot())
func _refresh_legend() -> void:
for child in legend_row.get_children():
child.queue_free()
@@ -327,7 +413,7 @@ func _update_guest_count() -> void:
func _process(_delta: float) -> void:
timer_label.visible = bool(SaveGame.get_setting("show_timer"))
timer_label.visible = bool(SaveGame.get_setting("show_timer")) and str(SaveGame.get_setting("difficulty")) != "zen"
if ui_paused or not visible or win_shown or started_at == 0:
return
elapsed_ms = Time.get_ticks_msec() - started_at
@@ -346,7 +432,8 @@ func set_ui_paused(value: bool) -> void:
func restart_room() -> void:
start_level(level_index, daily_mode, daily_key)
clear_saved_board()
start_level(level_index, daily_mode, daily_key, free_mode)
func hide_win() -> void:
@@ -361,6 +448,7 @@ func _on_board_changed() -> void:
status_label.add_theme_color_override("font_color", Palette.MUTED)
_update_guest_count()
_update_legend()
save_board()
func _on_mistake() -> void:
@@ -372,12 +460,16 @@ func _on_solved() -> void:
if win_shown:
return
win_shown = true
UI.haptic(true)
clear_saved_board()
status_label.text = "Everyone checked in."
status_label.add_theme_color_override("font_color", Palette.INK)
_update_legend()
if daily_mode:
var extended := SaveGame.complete_daily(daily_key)
var extended := SaveGame.complete_daily(daily_key, int(elapsed_ms / 1000.0))
_record_story_visit(level_index + 1)
new_guest_story.visible = false
var streak := SaveGame.daily_streak()
var streak_text := "%d %s" % [streak, "day" if streak == 1 else "days"]
win_title.text = "Daily room complete!"
@@ -387,24 +479,46 @@ func _on_solved() -> void:
]
win_next.text = "Back to lobby"
new_guest_box.visible = false
elif free_mode:
win_title.text = "Free room complete!"
win_detail.text = "No progress saved · %s" % _format_time(elapsed_ms)
win_next.text = "Next room"
new_guest_box.visible = false
new_guest_story.visible = false
else:
win_title.text = "Everyone checked in!"
win_detail.text = "Room %d · %s" % [level_index + 1, _format_time(elapsed_ms)]
win_next.text = "Next room"
var unlocked_id := SaveGame.complete_room(current_level_id, level_index + 1)
var guest := _record_story_visit(level_index + 1)
if unlocked_id != "":
var guest := Guests.by_id(unlocked_id)
new_guest_label.text = "New guest: %s the %s" % [str(guest.get("name", "")), str(guest.get("role", ""))]
new_guest_portrait.texture = load(Guests.portrait(unlocked_id, "thumbs"))
new_guest_box.visible = true
var stories: Array = guest.get("stories", [])
if not stories.is_empty():
new_guest_story.text = str(stories[0])
new_guest_story.visible = true
else:
new_guest_box.visible = false
new_guest_story.visible = false
await get_tree().create_timer(0.45).timeout
if win_shown:
overlay.visible = true
func _record_story_visit(room_number: int) -> Dictionary:
var guest := Guests.for_room(room_number)
if guest.is_empty():
return {}
var id := str(guest.get("id", ""))
if id.is_empty() or not SaveGame.is_guest_unlocked(id):
return {}
SaveGame.record_guest_visit(id)
return guest
func _on_undo() -> void:
win_shown = false
overlay.visible = false
@@ -427,7 +541,9 @@ func _on_next() -> void:
_on_back()
return
if level_index + 1 < levels.size():
start_level(level_index + 1)
start_level(level_index + 1, false, "", free_mode)
if free_mode:
level_label.text = "Free room %d" % (level_index + 1)
else:
_on_back()
+54 -4
View File
@@ -14,6 +14,7 @@ var progress_label: Label
var status_label: Label
var scroll: ScrollContainer
var detail_layer: ColorRect
var detail_panel: PanelContainer
var detail_portrait: TextureRect
var detail_name: Label
var detail_role: Label
@@ -21,6 +22,7 @@ var detail_meta: Label
var detail_bio: Label
var detail_snack: Label
var detail_status: Label
var detail_story_box: VBoxContainer
var crumb_frame_holder: CenterContainer
var crumb_frame_id := ""
@@ -296,13 +298,23 @@ func _build_detail() -> void:
detail_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 24, 16)
panel.custom_minimum_size = Vector2(320, 0)
detail_panel = panel
var view_size := get_viewport_rect().size
panel.custom_minimum_size = Vector2(320, max(320, min(560, int(view_size.y) - 80)))
panel.mouse_filter = Control.MOUSE_FILTER_STOP
center.add_child(panel)
var outer := VBoxContainer.new()
outer.add_theme_constant_override("separation", 6)
panel.add_child(outer)
var detail_scroll := ScrollContainer.new()
detail_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
detail_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
outer.add_child(detail_scroll)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 4)
panel.add_child(box)
box.size_flags_horizontal = Control.SIZE_EXPAND_FILL
detail_scroll.add_child(box)
detail_portrait = TextureRect.new()
detail_portrait.custom_minimum_size = Vector2(180, 180)
@@ -326,10 +338,20 @@ func _build_detail() -> void:
detail_status = UI.label("", 10, Palette.MUTED)
box.add_child(detail_status)
box.add_child(UI.heading("Story", 16))
detail_story_box = VBoxContainer.new()
detail_story_box.add_theme_constant_override("separation", 6)
box.add_child(detail_story_box)
UI.pass_scroll_input(detail_story_box)
var actions := HBoxContainer.new()
outer.add_child(actions)
var close := UI.button("Close", false, 44)
close.add_theme_font_size_override("font_size", 16)
close.size_flags_horizontal = Control.SIZE_EXPAND_FILL
UI.set_font_size(close, 16)
close.pressed.connect(_try_close_detail)
box.add_child(close)
actions.add_child(close)
UI.pass_scroll_input(box)
func _show_detail(guest: Dictionary) -> void:
@@ -345,6 +367,34 @@ func _show_detail(guest: Dictionary) -> void:
detail_status.text = "Checked in · Room %d" % int(guest.get("unlock_room", 0))
if int(guest.get("unlock_room", 0)) == 0:
detail_status.text = "Resident · always in"
for child in detail_story_box.get_children():
child.queue_free()
var stories: Array = guest.get("stories", [])
var unlocked := SaveGame.is_guest_unlocked(id)
if detail_panel != null:
var h := max(320, min(560, int(get_viewport_rect().size.y) - 80))
detail_panel.custom_minimum_size.y = 340 if not unlocked else h
if not unlocked:
var hidden_line := UI.label("??? — check in from Room %d to hear their story." % int(guest.get("unlock_room", 0)), 11, Palette.MUTED)
hidden_line.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
detail_story_box.add_child(hidden_line)
else:
var visits := SaveGame.guest_visits(id)
detail_status.text += " · %d %s" % [visits, "visit" if visits == 1 else "visits"]
var count := SaveGame.story_line_count(id)
var needs := [0, 3, 7]
for i in range(stories.size()):
if i < count:
var line := UI.label(str(stories[i]), 11)
line.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
detail_story_box.add_child(line)
else:
var need := int(needs[clampi(i, 0, needs.size() - 1)])
var teaser := UI.label("??? · Unlocks after %d visits" % need, 10, Palette.MUTED)
teaser.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
detail_story_box.add_child(teaser)
_detail_opened_at = Time.get_ticks_msec()
detail_layer.visible = true
detail_layer.move_to_front()
+237 -47
View File
@@ -7,13 +7,28 @@ signal rules_pressed
signal daily_pressed
signal profile_pressed
signal streak_pressed
signal freeplay_pressed
var progress_pill: Button
var primary: Button
var hint_label: Label
var mascot_caption: Label
var daily_button: Button
var freeplay_button: Button
var streak_button: Button
var event_button: Button
var event_layer: ColorRect
var event_title: Label
var event_body: Label
var event_progress: Label
var event_claim: Button
var mascot_card: PanelContainer
var mascot_art: Control
var mascot_button: Button
var mascot_note: Label
var mascot_id := ""
var mascot_art_id := ""
var mascot_cycling := false
var avatar_holder: CenterContainer
var avatar_frame_id := ""
var avatar_portrait_id := ""
@@ -29,7 +44,8 @@ func _ready() -> void:
add_child(margin)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 6)
column.add_theme_constant_override("separation", 4)
column.size_flags_horizontal = Control.SIZE_EXPAND_FILL
margin.add_child(column)
var hub := HBoxContainer.new()
@@ -37,7 +53,7 @@ func _ready() -> void:
column.add_child(hub)
var left := CenterContainer.new()
left.custom_minimum_size = Vector2(56, 56)
left.custom_minimum_size = Vector2(48, 48)
avatar_holder = left
hub.add_child(left)
_build_avatar()
@@ -46,36 +62,55 @@ func _ready() -> void:
center.size_flags_horizontal = Control.SIZE_EXPAND_FILL
hub.add_child(center)
progress_pill = UI.button("5 / 25 guests", false, 38)
progress_pill.custom_minimum_size = Vector2(130, 38)
progress_pill.add_theme_font_size_override("font_size", 13)
progress_pill = UI.button("5 / 25 guests", false, 34)
progress_pill.custom_minimum_size = Vector2(130, 34)
UI.set_font_size(progress_pill, 13)
progress_pill.size_flags_vertical = Control.SIZE_SHRINK_CENTER
progress_pill.pressed.connect(func() -> void: guest_book_pressed.emit())
center.add_child(progress_pill)
var settings := UI.round_button("res://assets/icons/settings.svg", 48)
var settings := UI.round_button("res://assets/icons/settings.svg", 44)
settings.tooltip_text = "Settings"
settings.pressed.connect(func() -> void: settings_pressed.emit())
var right := CenterContainer.new()
right.custom_minimum_size = Vector2(52, 52)
right.custom_minimum_size = Vector2(48, 48)
right.add_child(settings)
hub.add_child(right)
column.add_child(UI.spacer(4))
column.add_child(UI.heading("Ratdoku", 46))
column.add_child(UI.label("A cozy rat hotel puzzle", 15, Palette.MUTED))
column.add_child(UI.spacer(2))
column.add_child(UI.heading("Ratdoku", 38))
column.add_child(UI.label("A cozy rat hotel puzzle", 13, Palette.MUTED))
daily_button = UI.button("Daily room", false, 40)
event_button = UI.button("Hotel event", false, 30)
event_button.custom_minimum_size = Vector2(0, 30)
UI.set_font_size(event_button, 12)
event_button.clip_text = true
event_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
event_button.pressed.connect(_open_event)
column.add_child(event_button)
daily_button = UI.button("Daily room", false, 36)
daily_button.custom_minimum_size = Vector2(0, 36)
daily_button.clip_text = true
daily_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
daily_button.add_theme_font_size_override("font_size", 13)
UI.set_font_size(daily_button, 11)
daily_button.pressed.connect(func() -> void: daily_pressed.emit())
streak_button = UI.button("Streak ›", false, 40)
streak_button.custom_minimum_size = Vector2(96, 40)
streak_button.add_theme_font_size_override("font_size", 12)
freeplay_button = UI.button("Free play", false, 36)
freeplay_button.custom_minimum_size = Vector2(0, 36)
freeplay_button.clip_text = true
freeplay_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
UI.set_font_size(freeplay_button, 11)
freeplay_button.pressed.connect(func() -> void: freeplay_pressed.emit())
streak_button = UI.button("Streak ›", false, 36)
streak_button.custom_minimum_size = Vector2(0, 36)
streak_button.clip_text = true
streak_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
UI.set_font_size(streak_button, 11)
streak_button.pressed.connect(func() -> void: streak_pressed.emit())
var daily_row := HBoxContainer.new()
daily_row.add_theme_constant_override("separation", 6)
daily_row.add_theme_constant_override("separation", 4)
daily_row.add_child(daily_button)
daily_row.add_child(freeplay_button)
daily_row.add_child(streak_button)
column.add_child(daily_row)
@@ -85,16 +120,26 @@ func _ready() -> void:
column.add_child(top_space)
var card := UI.panel(Palette.CREAM, 26, 12)
card.custom_minimum_size = Vector2(160, 160)
mascot_card = card
card.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
var mascot := _make_mascot()
mascot.custom_minimum_size = Vector2(138, 138)
var mascot := _make_mascot("crumb")
mascot_art = mascot
mascot_art.mouse_filter = Control.MOUSE_FILTER_IGNORE
card.add_child(mascot)
mascot_button = Button.new()
mascot_button.flat = true
mascot_button.mouse_filter = Control.MOUSE_FILTER_STOP
mascot_button.pressed.connect(_on_mascot_pressed)
mascot_button.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
card.add_child(mascot_button)
column.add_child(card)
_apply_mascot_scale()
mascot_caption = UI.label("Crumb, innkeeper", 12, Palette.MUTED)
mascot_caption = UI.label("Crumb, innkeeper", 11, Palette.MUTED)
column.add_child(mascot_caption)
hint_label = UI.label(UI.place_hint(), 11, Palette.MUTED)
mascot_note = UI.label("Guest of the day · tap to cycle", 9, Palette.MUTED)
column.add_child(mascot_note)
hint_label = UI.label(UI.place_hint(), 10, Palette.MUTED)
column.add_child(hint_label)
var bottom_space := Control.new()
@@ -102,8 +147,8 @@ func _ready() -> void:
bottom_space.mouse_filter = Control.MOUSE_FILTER_IGNORE
column.add_child(bottom_space)
primary = UI.button("Check in", true, 54)
primary.custom_minimum_size = Vector2(300, 54)
primary = UI.button("Check in", true, 48)
primary.custom_minimum_size = Vector2(300, 48)
primary.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
primary.pressed.connect(func() -> void: play_pressed.emit())
column.add_child(primary)
@@ -113,38 +158,119 @@ func _ready() -> void:
secondary.add_theme_constant_override("separation", 8)
column.add_child(secondary)
var book := UI.button("Guest Book", false, 46)
book.custom_minimum_size = Vector2(146, 46)
book.add_theme_font_size_override("font_size", 15)
var book := UI.button("Guest Book", false, 40)
book.custom_minimum_size = Vector2(146, 40)
UI.set_font_size(book, 15)
book.pressed.connect(func() -> void: guest_book_pressed.emit())
secondary.add_child(book)
var rules := UI.button("House Rules", false, 46)
rules.custom_minimum_size = Vector2(146, 46)
rules.add_theme_font_size_override("font_size", 15)
var rules := UI.button("House Rules", false, 40)
rules.custom_minimum_size = Vector2(146, 40)
UI.set_font_size(rules, 15)
rules.pressed.connect(func() -> void: rules_pressed.emit())
secondary.add_child(rules)
column.add_child(UI.label("No ads. No lives. Just rats.", 10, Palette.MUTED))
column.add_child(UI.label(Version.BUILD_LABEL, 9, Palette.MUTED))
column.add_child(UI.label("No ads. No lives. Just rats.", 9, Palette.MUTED))
column.add_child(UI.label(Version.BUILD_LABEL, 8, Palette.MUTED))
_build_event_layer()
SaveGame.progress_changed.connect(refresh)
SaveGame.settings_changed.connect(refresh)
refresh()
func _apply_mascot_scale() -> void:
if mascot_card == null or mascot_art == null:
return
var scale := UI.ui_scale()
var card_base := 104 if mascot_cycling else 120
var art_base := 90 if mascot_cycling else 104
var card_size := int(card_base / scale)
var art_size := int(art_base / scale)
mascot_card.custom_minimum_size = Vector2(card_size, card_size)
mascot_art.custom_minimum_size = Vector2(art_size, art_size)
mascot_button.custom_minimum_size = Vector2(card_size, card_size)
func _build_event_layer() -> void:
event_layer = ColorRect.new()
event_layer.color = Color(0.18, 0.12, 0.08, 0.62)
event_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
event_layer.mouse_filter = Control.MOUSE_FILTER_STOP
event_layer.gui_input.connect(func(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
event_layer.visible = false
)
event_layer.visible = false
add_child(event_layer)
var center := CenterContainer.new()
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
event_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 24, 16)
panel.custom_minimum_size = Vector2(min(340, max(280, int(get_viewport_rect().size.x) - 32)), 0)
center.add_child(panel)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 8)
panel.add_child(box)
event_title = UI.heading("Hotel event", 20)
box.add_child(event_title)
event_body = UI.label("", 12)
event_body.custom_minimum_size = Vector2(0, 90)
box.add_child(event_body)
event_progress = UI.label("", 11, Palette.MUTED)
box.add_child(event_progress)
event_claim = UI.button("Claim gift", true, 44)
event_claim.add_theme_color_override("font_disabled_color", Palette.INK)
event_claim.pressed.connect(_claim_event)
box.add_child(event_claim)
var close := UI.button("Close", false, 44)
close.pressed.connect(func() -> void: event_layer.visible = false)
box.add_child(close)
func _open_event() -> void:
var event := SaveGame.current_event()
if event.is_empty():
return
var id := str(event.get("id", ""))
var guest := Guests.by_id(str(event.get("featured_guest", "")))
event_title.text = str(event.get("name", "Hotel event"))
event_body.text = "%s\n\nFeatured guest: %s" % [str(event.get("description", "")), str(guest.get("name", "Crumb"))]
var progress := SaveGame.event_progress(id)
event_progress.text = "Daily rooms during this visit: %d / 3" % progress
var claimed := SaveGame.event_claimed(id)
event_claim.text = "Gift claimed ✓" if claimed else ("Claim: %s" % str(event.get("gift", "Treat")))
event_claim.disabled = claimed or not SaveGame.event_claimable(id)
event_layer.visible = true
event_layer.move_to_front()
func _claim_event() -> void:
var id := str(SaveGame.current_event().get("id", ""))
if SaveGame.claim_event(id):
event_claim.text = "Gift claimed ✓"
event_claim.disabled = true
refresh()
func refresh() -> void:
hint_label.text = UI.place_hint()
var avatar_id := SaveGame.selected_avatar()
if avatar_id == "crumb":
mascot_caption.text = "Crumb, innkeeper"
else:
var guest := Guests.by_id(avatar_id)
mascot_caption.text = "%s · %s" % [
str(guest.get("name", avatar_id)),
str(guest.get("role", "Guest"))
]
_apply_mascot_scale()
_refresh_mascot()
daily_button.text = _daily_text()
var event := SaveGame.current_event()
if event.is_empty():
event_button.text = "Hotel event"
else:
var id := str(event.get("id", ""))
var progress := SaveGame.event_progress(id)
var state := "Gift ready" if SaveGame.event_claimable(id) else (
"Gift claimed" if SaveGame.event_claimed(id) else "%d/3 daily rooms" % progress
)
event_button.text = "%s · %s" % [str(event.get("name", "Event")), state]
_refresh_avatar()
var guests := Guests.all()
var unlocked := SaveGame.unlocked_count(guests)
@@ -162,10 +288,10 @@ func refresh() -> void:
func _daily_text() -> String:
var streak := SaveGame.daily_streak()
if SaveGame.daily_completed_today():
return "Daily done · %d-day streak" % streak
return "Daily done · %dd" % streak
if streak > 0:
return "Daily room · %d-day streak" % streak
return "Daily room · start a streak"
return "Daily · %dd streak" % streak
return "Daily room"
func _build_avatar() -> void:
@@ -173,7 +299,7 @@ func _build_avatar() -> void:
var avatar := Button.new()
avatar.custom_minimum_size = Vector2(44, 44)
avatar.flat = true
avatar.icon = load(Avatars.portrait_path(SaveGame.selected_avatar()))
avatar.icon = load(Avatars.head_path(SaveGame.selected_avatar()))
avatar.expand_icon = true
avatar.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
avatar.alignment = HORIZONTAL_ALIGNMENT_CENTER
@@ -196,11 +322,75 @@ func _refresh_avatar() -> void:
_build_avatar()
func _make_mascot() -> Control:
if ResourceLoader.exists("res://art/crumb.png"):
func _make_mascot(id: String) -> Control:
var path := "res://art/guests/cards/crumb.png" if id == "crumb" else Guests.portrait(id, "cards")
if ResourceLoader.exists(path):
var texture_rect := TextureRect.new()
texture_rect.texture = load("res://art/crumb.png")
texture_rect.texture = load(path)
texture_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
texture_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
return texture_rect
return RatPortrait.new()
func _unlocked_mascot_ids() -> Array:
var out: Array = ["crumb"]
for guest in Guests.all():
var id := str(guest.get("id", ""))
if id != "crumb" and SaveGame.is_guest_unlocked(id):
out.append(id)
return out
func _mascot_guest(id: String) -> Dictionary:
if id == "crumb":
return {"name": "Crumb", "role": "Innkeeper", "stories": []}
return Guests.by_id(id)
func _on_mascot_pressed() -> void:
var ids := _unlocked_mascot_ids()
if ids.is_empty():
return
var index := ids.find(mascot_id)
mascot_cycling = true
mascot_id = str(ids[(index + 1) % ids.size()])
UI.haptic(false)
_refresh_mascot()
func _refresh_mascot() -> void:
var ids := _unlocked_mascot_ids()
if ids.is_empty():
return
if not mascot_cycling:
mascot_id = str(ids[Daily.day_number(Daily.today_key()) % ids.size()])
elif not ids.has(mascot_id):
mascot_id = str(ids[0])
if mascot_art_id != mascot_id:
for child in mascot_card.get_children():
if child != mascot_button:
mascot_card.remove_child(child)
child.queue_free()
mascot_art = _make_mascot(mascot_id)
mascot_art.mouse_filter = Control.MOUSE_FILTER_IGNORE
mascot_card.add_child(mascot_art)
mascot_button.move_to_front()
mascot_art_id = mascot_id
_apply_mascot_scale()
var guest := _mascot_guest(mascot_id)
mascot_caption.text = "%s · %s" % [
str(guest.get("name", mascot_id)),
str(guest.get("role", "Guest"))
]
if mascot_cycling:
var stories: Array = guest.get("stories", [])
if stories.is_empty():
mascot_note.text = "Always in · tap to cycle"
else:
var line := str(stories[0])
mascot_note.text = line if line.length() <= 52 else (line.substr(0, 49) + "…")
else:
mascot_note.text = "Guest of the day · tap to cycle"
+101 -6
View File
@@ -20,14 +20,37 @@ var quit_button: Button
var screens := {}
var current := "home"
var nav_stack: Array[String] = []
var music_player: AudioStreamPlayer
var background_rect: TextureRect
func _ready() -> void:
var background := ColorRect.new()
background.color = Palette.CREAM
var base := ColorRect.new()
base.color = Palette.CREAM
base.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
base.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(base)
var background := TextureRect.new()
_refresh_background_texture(background)
background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
background.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
background.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED
background.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(background)
background_rect = background
var veil := ColorRect.new()
veil.color = Color(Palette.CREAM.r, Palette.CREAM.g, Palette.CREAM.b, 0.45)
veil.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
veil.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(veil)
_setup_music()
_refresh_background()
SaveGame.settings_changed.connect(_refresh_background)
SaveGame.settings_changed.connect(_apply_ui_scale)
SaveGame.progress_changed.connect(_refresh_background)
home = HomeScene.instantiate()
_add_screen(home)
@@ -36,6 +59,7 @@ func _ready() -> void:
home.settings_pressed.connect(func() -> void: open_settings("home"))
home.rules_pressed.connect(func() -> void: show_screen("rules"))
home.daily_pressed.connect(_on_daily)
home.freeplay_pressed.connect(_on_freeplay)
home.profile_pressed.connect(func() -> void: show_screen("profile"))
home.streak_pressed.connect(func() -> void: show_screen("streak"))
@@ -64,7 +88,7 @@ func _ready() -> void:
settings_sheet = SettingsSheetScene.instantiate()
add_child(settings_sheet)
settings_sheet.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
_center_control(settings_sheet)
settings_sheet.visible = false
settings_sheet.closed.connect(close_settings)
settings_sheet.restart_requested.connect(_on_restart_requested)
@@ -85,9 +109,61 @@ func _ready() -> void:
show_screen("home", false)
func _refresh_background_texture(rect: TextureRect) -> void:
var path := "res://assets/backgrounds/%s.png" % SaveGame.theme_id()
if ResourceLoader.exists(path):
rect.texture = load(path)
else:
rect.texture = null
func _refresh_background() -> void:
if background_rect != null:
_refresh_background_texture(background_rect)
func _apply_ui_scale() -> void:
UI.apply_scale(self)
func _setup_music() -> void:
music_player = AudioStreamPlayer.new()
var stream = load("res://assets/audio/lounge_main.mp3")
stream.loop = true
music_player.stream = stream
music_player.volume_db = -14.0
add_child(music_player)
SaveGame.settings_changed.connect(_update_music)
_update_music()
func _update_music() -> void:
if music_player == null:
return
if bool(SaveGame.get_setting("music")):
var volume := clampf(float(SaveGame.get_setting("music_volume")), 0.0, 1.0)
music_player.volume_db = linear_to_db(max(0.001, volume))
if not music_player.playing:
music_player.play()
else:
music_player.stop()
## Keep the 360dp design centered on wide screens instead of stretching it.
func _center_control(control: Control) -> void:
control.anchor_left = 0.5
control.anchor_right = 0.5
control.anchor_top = 0.0
control.anchor_bottom = 1.0
control.offset_left = -180
control.offset_right = 180
control.offset_top = 0
control.offset_bottom = 0
func _add_screen(screen: Control) -> void:
add_child(screen)
screen.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
_center_control(screen)
screen.visible = false
@@ -156,6 +232,8 @@ func _on_play() -> void:
var max_index: int = max(0, game.levels.size() - 1)
var start_index: int = clampi(int(SaveGame.data.get("last_room", 0)), 0, max_index)
show_screen("game")
var saved := SaveGame.load_board("campaign")
if saved.is_empty() or not game.restore(saved):
game.start_level(start_index)
@@ -163,11 +241,28 @@ func _on_daily() -> void:
var key := Daily.today_key()
var index := Daily.level_index(game.levels.size(), key)
show_screen("game")
var saved := SaveGame.load_board("daily")
if not saved.is_empty() and str(saved.get("daily_key", "")) == key and game.restore(saved):
return
game.start_daily(index, key)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
func _on_freeplay() -> void:
show_screen("game")
var seed := int(Time.get_unix_time_from_system()) % 1000000
var saved := SaveGame.load_board("free")
if not saved.is_empty() and bool(saved.get("free_mode", false)) and game.restore(saved):
return
game.start_free(seed)
func _exit_tree() -> void:
if music_player != null:
music_player.stop()
music_player.stream = null
func _input(event: InputEvent) -> void: if event.is_action_pressed("ui_cancel"):
if _handle_back():
accept_event()
+127 -9
View File
@@ -17,6 +17,10 @@ var current_tab := "avatar"
var pending_avatar := "crumb"
var pending_frame := "plain"
var portrait_key := ""
var player_id_label: Label
var achievements_box: VBoxContainer
var rename_layer: ColorRect
var name_input: LineEdit
func _ready() -> void:
@@ -72,8 +76,20 @@ func _ready() -> void:
portrait_holder = CenterContainer.new()
content.add_child(portrait_holder)
name_label = UI.label("Crumb", 20, Palette.INK, true)
content.add_child(name_label)
var name_row := HBoxContainer.new()
name_row.add_theme_constant_override("separation", 6)
content.add_child(name_row)
name_label = UI.label("Innkeeper", 20, Palette.INK, true)
name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
name_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
name_row.add_child(name_label)
var edit_name := UI.button("Edit", false, 32)
edit_name.custom_minimum_size = Vector2(52, 32)
UI.set_font_size(edit_name, 11)
edit_name.pressed.connect(_show_rename)
name_row.add_child(edit_name)
player_id_label = UI.label("RAT-000000", 10, Palette.MUTED)
content.add_child(player_id_label)
role_label = UI.label("Innkeeper · always in", 11, Palette.MUTED)
content.add_child(role_label)
@@ -85,10 +101,15 @@ func _ready() -> void:
best_label = _stat_card(stats, "Best", "0")
var view_streak := UI.button("View daily streak ›", false, 40)
view_streak.add_theme_font_size_override("font_size", 14)
UI.set_font_size(view_streak, 14)
view_streak.pressed.connect(func() -> void: streak_pressed.emit())
content.add_child(view_streak)
content.add_child(UI.heading("Achievements", 18))
achievements_box = VBoxContainer.new()
achievements_box.add_theme_constant_override("separation", 4)
content.add_child(achievements_box)
var tabs := HBoxContainer.new()
tabs.add_theme_constant_override("separation", 6)
content.add_child(tabs)
@@ -112,6 +133,8 @@ func _ready() -> void:
status_label.custom_minimum_size = Vector2(0, 22)
content.add_child(status_label)
_build_rename_dialog()
UI.pass_scroll_input(content)
SaveGame.progress_changed.connect(refresh)
refresh()
@@ -137,13 +160,15 @@ func refresh() -> void:
streak_label.text = str(SaveGame.daily_streak())
best_label.text = str(SaveGame.best_streak())
var avatar: Dictionary = Avatars.by_id(pending_avatar)
name_label.text = str(avatar.get("name", "Crumb"))
role_label.text = "Innkeeper · always in" if pending_avatar == "crumb" else "Guest · Hotel Ratdoku"
name_label.text = SaveGame.player_name()
player_id_label.text = SaveGame.player_id()
role_label.text = "Avatar: %s" % str(avatar.get("name", "Crumb"))
status_label.text = "Pick a look, then confirm."
status_label.add_theme_color_override("font_color", Palette.MUTED)
_update_tab_styles()
_build_portrait()
_build_grid()
_build_achievements()
func _set_tab(tab: String) -> void:
@@ -167,7 +192,7 @@ func _build_portrait() -> void:
child.queue_free()
var frame := Frames.frame_panel(pending_frame, 118)
var head := TextureRect.new()
head.texture = load(Avatars.portrait_path(pending_avatar))
head.texture = load(Avatars.head_path(pending_avatar))
head.custom_minimum_size = Vector2(96, 96)
head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
@@ -203,12 +228,24 @@ func _build_grid() -> void:
var badge := Frames.frame_panel(pending_frame if current_tab == "avatar" else id, 46)
badge.mouse_filter = Control.MOUSE_FILTER_IGNORE
var head := TextureRect.new()
head.texture = load(Avatars.portrait_path(id) if current_tab == "avatar" else "res://art/crumb_head.png")
head.texture = load(Avatars.head_path(id) if current_tab == "avatar" else "res://art/crumb_head.png")
head.custom_minimum_size = Vector2(30, 30)
head.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
head.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
head.mouse_filter = Control.MOUSE_FILTER_IGNORE
badge.add_child(head)
var hidden := current_tab == "avatar" and not unlocked
if hidden:
var veil := ColorRect.new()
veil.color = Color(0.98, 0.93, 0.84, 0.82)
veil.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
veil.mouse_filter = Control.MOUSE_FILTER_IGNORE
badge.add_child(veil)
var question := UI.label("???", 12, Palette.INK)
question.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
question.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
question.mouse_filter = Control.MOUSE_FILTER_IGNORE
badge.add_child(question)
row.add_child(badge)
var text := VBoxContainer.new()
@@ -217,7 +254,8 @@ func _build_grid() -> void:
text.mouse_filter = Control.MOUSE_FILTER_IGNORE
row.add_child(text)
var name := UI.label(str(entry.get("name", "")), 12)
var display_name := "???" if (current_tab == "avatar" and not unlocked) else str(entry.get("name", ""))
var name := UI.label(display_name, 12)
name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(name)
@@ -226,8 +264,10 @@ func _build_grid() -> void:
detail = "Selected"
elif unlocked:
detail = "Unlocked"
elif current_tab == "avatar":
detail = "Room %d" % int(entry.get("room", 0))
else:
detail = Avatars.requirement_text(id) if current_tab == "avatar" else Frames.requirement_text(id)
detail = Frames.requirement_text(id)
var sub := UI.label(detail, 9, Palette.GOLD if id == selected else (Palette.MUTED if unlocked else Palette.RED))
sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(sub)
@@ -274,6 +314,84 @@ func _on_confirm() -> void:
status_label.add_theme_color_override("font_color", Palette.MUTED)
func _build_achievements() -> void:
for child in achievements_box.get_children():
child.queue_free()
var state := SaveGame.achievements()
var entries := [
["first_room", "First room checked in"],
["ten_rooms", "Ten rooms complete"],
["thirty_rooms", "All thirty rooms"],
["all_guests", "Meet every guest"],
["streak_3", "Three-day streak"],
["streak_7", "Seven-day streak"],
["daily_10", "Ten daily rooms"],
["week_gift", "Opened the week gift"],
]
for entry in entries:
var done := bool(state.get(str(entry[0]), false))
var row := UI.panel(Palette.PAPER if done else Palette.WHITE, 10, 6)
var label := UI.label(("%s · Done" if done else "%s · Locked") % str(entry[1]), 11, Palette.INK if done else Palette.MUTED)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
row.add_child(label)
achievements_box.add_child(row)
UI.pass_scroll_input(achievements_box)
func _build_rename_dialog() -> void:
rename_layer = ColorRect.new()
rename_layer.color = Color(0.18, 0.12, 0.08, 0.62)
rename_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
rename_layer.mouse_filter = Control.MOUSE_FILTER_STOP
rename_layer.gui_input.connect(func(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
rename_layer.visible = false
)
rename_layer.visible = false
add_child(rename_layer)
var center := CenterContainer.new()
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
rename_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 24, 16)
panel.custom_minimum_size = Vector2(300, 0)
center.add_child(panel)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 8)
panel.add_child(box)
box.add_child(UI.heading("Edit name", 20))
name_input = LineEdit.new()
name_input.text = SaveGame.player_name()
name_input.max_length = 18
name_input.custom_minimum_size = Vector2(260, 44)
box.add_child(name_input)
var actions := HBoxContainer.new()
actions.add_theme_constant_override("separation", 8)
box.add_child(actions)
var cancel := UI.button("Cancel", false, 44)
cancel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
cancel.pressed.connect(func() -> void: rename_layer.visible = false)
actions.add_child(cancel)
var save := UI.button("Save", true, 44)
save.size_flags_horizontal = Control.SIZE_EXPAND_FILL
save.pressed.connect(_save_name)
actions.add_child(save)
func _show_rename() -> void:
name_input.text = SaveGame.player_name()
rename_layer.visible = true
rename_layer.move_to_front()
name_input.grab_focus()
func _save_name() -> void:
SaveGame.set_player_name(name_input.text)
rename_layer.visible = false
func _card_style(color: Color) -> StyleBoxFlat:
var style := StyleBoxFlat.new()
style.bg_color = color
+2 -2
View File
@@ -76,13 +76,13 @@ func _ready() -> void:
var reset := UI.button("Reset", false, 44)
reset.custom_minimum_size = Vector2(100, 44)
reset.add_theme_font_size_override("font_size", 15)
UI.set_font_size(reset, 15)
reset.pressed.connect(_on_tutorial_reset)
controls.add_child(reset)
var hint := UI.button("Hint", true, 44)
hint.custom_minimum_size = Vector2(100, 44)
hint.add_theme_font_size_override("font_size", 15)
UI.set_font_size(hint, 15)
hint.pressed.connect(_on_tutorial_hint)
controls.add_child(hint)
+372 -16
View File
@@ -14,6 +14,14 @@ const DEFAULTS := {
"reduce_motion": false,
"hold_seconds": 0.35,
"double_tap_place": true,
"music": true,
"music_volume": 0.7,
"sfx": true,
"sfx_volume": 0.8,
"difficulty": "normal",
"theme": "cream",
"ui_scale": 1.0,
"haptics": true,
}
var data := {}
@@ -34,20 +42,32 @@ func _default_daily() -> Dictionary:
func _default_data() -> Dictionary:
return {
"version": 4,
"version": 7,
"completed_rooms": [],
"unlocked_guests": [],
"guest_notes": {},
"events": {},
"settings": DEFAULTS.duplicate(true),
"last_room": 0,
"daily": _default_daily(),
"profile_frame": "plain",
"avatar_id": "crumb",
"player_name": "Innkeeper",
"player_id": _new_player_id(),
"achievements": {},
"gift_claimed": [],
"saved_boards": {},
}
func _new_player_id() -> String:
var seed_text: String = "Ratdoku%d" % Time.get_unix_time_from_system()
return "RAT-%06X" % (absi(seed_text.hash()) % 0xFFFFFF)
func load_game() -> void:
data = _default_data()
var stored_version := 4
var stored_version := 7
if FileAccess.file_exists(PATH):
var file := FileAccess.open(PATH, FileAccess.READ)
@@ -64,6 +84,23 @@ func load_game() -> void:
for key in DEFAULTS:
if not data["settings"].has(key):
data["settings"][key] = DEFAULTS[key]
var value = data["settings"][key]
var expected = DEFAULTS[key]
var valid := true
if typeof(expected) == TYPE_BOOL:
valid = typeof(value) == TYPE_BOOL
elif typeof(expected) == TYPE_STRING:
valid = typeof(value) == TYPE_STRING
elif typeof(expected) == TYPE_FLOAT:
valid = typeof(value) == TYPE_FLOAT or typeof(value) == TYPE_INT
elif typeof(expected) == TYPE_INT:
valid = typeof(value) == TYPE_INT
if not valid:
data["settings"][key] = expected
data["settings"]["hold_seconds"] = clampf(float(data["settings"]["hold_seconds"]), 0.1, 1.0)
data["settings"]["music_volume"] = clampf(float(data["settings"]["music_volume"]), 0.0, 1.0)
data["settings"]["sfx_volume"] = clampf(float(data["settings"]["sfx_volume"]), 0.0, 1.0)
data["settings"]["ui_scale"] = clampf(float(data["settings"]["ui_scale"]), 1.0, 1.3)
var daily_defaults := _default_daily()
if typeof(data.get("daily")) != TYPE_DICTIONARY:
@@ -78,10 +115,34 @@ func load_game() -> void:
data["avatar_id"] = "crumb"
if typeof(data["daily"].get("history")) != TYPE_ARRAY:
data["daily"]["history"] = []
else:
var converted: Array = []
for entry in data["daily"]["history"]:
if typeof(entry) == TYPE_DICTIONARY:
converted.append(entry)
else:
converted.append({"date": str(entry), "seconds": 0})
data["daily"]["history"] = converted
if typeof(data.get("player_name")) != TYPE_STRING or str(data["player_name"]).strip_edges().is_empty():
data["player_name"] = "Innkeeper"
if typeof(data.get("player_id")) != TYPE_STRING or str(data["player_id"]).is_empty():
data["player_id"] = _new_player_id()
if typeof(data.get("achievements")) != TYPE_DICTIONARY:
data["achievements"] = {}
if typeof(data.get("gift_claimed")) != TYPE_ARRAY:
data["gift_claimed"] = []
if typeof(data.get("saved_boards")) != TYPE_DICTIONARY:
data["saved_boards"] = {}
if typeof(data.get("guest_notes")) != TYPE_DICTIONARY:
data["guest_notes"] = {}
if typeof(data.get("events")) != TYPE_DICTIONARY:
data["events"] = {}
var migrated := false
# Version 2 made double-tap the default; version 3 added daily streaks
# and profile frames; version 4 added avatars and streak history.
# Version 2 made double-tap the default; version 3 added daily streaks and
# profile frames; version 4 added avatars and streak history; version 5
# added music; version 6 added identity, achievements, gifts, themes,
# difficulty and saved boards; version 7 added guest notes and events.
if stored_version < 2:
data["settings"]["double_tap_place"] = true
migrated = true
@@ -89,14 +150,32 @@ func load_game() -> void:
migrated = true
if stored_version < 4:
migrated = true
if stored_version < 5:
migrated = true
if stored_version < 6:
migrated = true
if stored_version < 7:
migrated = true
if typeof(data.get("completed_rooms")) != TYPE_ARRAY:
data["completed_rooms"] = []
else:
var clean_rooms: Array = []
for value in data["completed_rooms"]:
if typeof(value) == TYPE_STRING:
clean_rooms.append(value)
data["completed_rooms"] = clean_rooms
if typeof(data.get("unlocked_guests")) != TYPE_ARRAY:
data["unlocked_guests"] = []
else:
var clean_guests: Array = []
for value in data["unlocked_guests"]:
if typeof(value) == TYPE_STRING:
clean_guests.append(value)
data["unlocked_guests"] = clean_guests
if migrated:
data["version"] = 4
data["version"] = 7
save_game()
@@ -151,15 +230,13 @@ func reset_progress() -> void:
data["completed_rooms"] = []
data["unlocked_guests"] = []
data["last_room"] = 0
data["saved_boards"] = {}
data["guest_notes"] = {}
data["events"] = {}
# Room-based unlocks can disappear after a reset; never leave a locked
# frame or guest avatar equipped.
var frame := Frames.by_id(selected_frame())
if (
frame.is_empty()
or rooms_completed() < int(frame.get("rooms", 0))
or best_streak() < int(frame.get("streak", 0))
):
if not Frames.is_unlocked(selected_frame()):
data["profile_frame"] = "plain"
if not Avatars.is_unlocked(selected_avatar()):
data["avatar_id"] = "crumb"
@@ -180,6 +257,152 @@ func rooms_completed() -> int:
return (data.get("completed_rooms") as Array).size()
## Guest story progress. Free play never calls this; only campaign/daily rooms.
func record_guest_visit(id: String) -> int:
if id.is_empty() or not is_guest_unlocked(id):
return guest_visits(id)
var notes: Dictionary = data.get("guest_notes", {})
var entry: Dictionary = notes.get(id, {})
if typeof(entry) != TYPE_DICTIONARY:
entry = {}
entry["visits"] = int(entry.get("visits", 0)) + 1
notes[id] = entry
data["guest_notes"] = notes
save_game()
return int(entry["visits"])
func guest_visits(id: String) -> int:
var notes: Dictionary = data.get("guest_notes", {})
var entry = notes.get(id, {})
return int(entry.get("visits", 0)) if typeof(entry) == TYPE_DICTIONARY else 0
func story_line_count(id: String) -> int:
if not is_guest_unlocked(id):
return 0
var visits := guest_visits(id)
if visits >= 7:
return 3
if visits >= 3:
return 2
return 1
static var _events_cache: Array = []
static func event_defs() -> Array:
if _events_cache.is_empty():
var path := "res://data/events.json"
if FileAccess.file_exists(path):
var file := FileAccess.open(path, FileAccess.READ)
if file != null:
var parsed = JSON.parse_string(file.get_as_text())
file.close()
if typeof(parsed) == TYPE_ARRAY:
_events_cache = parsed
return _events_cache
static func event_cycle_length() -> int:
var total := 0
for event in event_defs():
total += max(1, int(event.get("duration_days", 3)))
return max(1, total)
func current_event() -> Dictionary:
var defs := event_defs()
if defs.is_empty():
return {}
var day := Daily.day_number(Daily.today_key())
var cycle := day / event_cycle_length()
var position := day % event_cycle_length()
var start := 0
for event in defs:
var duration := max(1, int(event.get("duration_days", 3)))
if position < start + duration:
var out: Dictionary = (event as Dictionary).duplicate(true)
out["cycle"] = cycle
out["day_in_event"] = position - start
return out
start += duration
var out: Dictionary = (defs[defs.size() - 1] as Dictionary).duplicate(true)
out["cycle"] = cycle
out["day_in_event"] = max(0, position - start)
return out
func event_state(id: String, cycle: int) -> Dictionary:
var events: Dictionary = data.get("events", {})
var entry = events.get(id, {})
if typeof(entry) != TYPE_DICTIONARY or int(entry.get("cycle", -1)) != cycle:
return {"cycle": cycle, "progress": 0, "claimed": false, "last_date": ""}
return (entry as Dictionary).duplicate(true)
func record_daily_event_progress(date_key: String) -> void:
var event := current_event()
var id := str(event.get("id", ""))
if id.is_empty():
return
var cycle := int(event.get("cycle", 0))
var entry: Dictionary = event_state(id, cycle)
if str(entry.get("last_date", "")) == date_key:
return
entry["cycle"] = cycle
entry["last_date"] = date_key
entry["progress"] = min(3, int(entry.get("progress", 0)) + 1)
var events: Dictionary = data.get("events", {})
events[id] = entry
data["events"] = events
save_game()
func event_progress(id: String = "") -> int:
var event := current_event()
var event_id := id if not id.is_empty() else str(event.get("id", ""))
return int(event_state(event_id, int(event.get("cycle", 0))).get("progress", 0))
func event_claimable(id: String) -> bool:
var event := current_event()
var entry: Dictionary = event_state(id, int(event.get("cycle", 0)))
return int(entry.get("progress", 0)) >= 3 and not bool(entry.get("claimed", false))
func claim_event(id: String) -> bool:
var event := current_event()
var cycle := int(event.get("cycle", 0))
var entry: Dictionary = event_state(id, cycle)
if int(entry.get("progress", 0)) < 3 or bool(entry.get("claimed", false)):
return false
entry["claimed"] = true
var events: Dictionary = data.get("events", {})
events[id] = entry
data["events"] = events
save_game()
progress_changed.emit()
return true
func event_claimed(id: String) -> bool:
var event := current_event()
return bool(event_state(id, int(event.get("cycle", 0))).get("claimed", false))
func claimed_event_frames() -> Array:
var out: Array = []
var events: Dictionary = data.get("events", {})
for def in event_defs():
var id := str(def.get("id", ""))
var entry = events.get(id, {})
if typeof(entry) == TYPE_DICTIONARY and bool(entry.get("claimed", false)):
out.append(str(def.get("reward_frame", "")))
return out
func daily_data() -> Dictionary:
if typeof(data.get("daily")) != TYPE_DICTIONARY:
data["daily"] = _default_daily()
@@ -203,7 +426,7 @@ func daily_completed_today() -> bool:
return str(daily_data().get("last_completed", "")) == Daily.today_key()
func complete_daily(key: String) -> bool:
func complete_daily(key: String, seconds: int = 0) -> bool:
# Only today's room counts, and only once per local day.
if key.is_empty() or key != Daily.today_key():
return false
@@ -217,21 +440,46 @@ func complete_daily(key: String) -> bool:
daily["streak"] = streak
daily["last_completed"] = key
daily["best_streak"] = max(int(daily.get("best_streak", 0)), streak)
var entry := {"date": key, "seconds": max(0, seconds)}
var history: Array = daily.get("history", [])
if not history.has(key):
history.append(key)
var replace_at := -1
for i in range(history.size()):
var old = history[i]
var old_date := str(old.get("date", "")) if typeof(old) == TYPE_DICTIONARY else str(old)
if old_date == key:
replace_at = i
break
if replace_at >= 0:
history[replace_at] = entry
else:
history.append(entry)
while history.size() > 60:
history.pop_front()
daily["history"] = history
data["daily"] = daily
record_daily_event_progress(key)
save_game()
progress_changed.emit()
return true
func daily_history() -> Array:
func daily_entries() -> Array:
var history: Array = daily_data().get("history", [])
return history.duplicate()
return history.duplicate(true)
func daily_history() -> Array:
var out := []
for entry in daily_entries():
if typeof(entry) == TYPE_DICTIONARY:
out.append(str(entry.get("date", "")))
else:
out.append(str(entry))
return out
func total_dailies() -> int:
return daily_entries().size()
func selected_frame() -> String:
@@ -259,3 +507,111 @@ func apply_profile(avatar_id: String, frame_id: String) -> void:
data["profile_frame"] = frame_id
save_game()
progress_changed.emit()
func player_name() -> String:
return str(data.get("player_name", "Innkeeper"))
func set_player_name(value: String) -> void:
var clean := value.strip_edges().substr(0, 18)
if clean.is_empty():
clean = "Innkeeper"
data["player_name"] = clean
save_game()
progress_changed.emit()
func player_id() -> String:
return str(data.get("player_id", ""))
func achievements() -> Dictionary:
return {
"first_room": rooms_completed() >= 1,
"ten_rooms": rooms_completed() >= 10,
"thirty_rooms": rooms_completed() >= 30,
"all_guests": unlocked_count(Guests.all()) >= 25,
"streak_3": best_streak() >= 3,
"streak_7": best_streak() >= 7,
"daily_10": total_dailies() >= 10,
"week_gift": gift_claimed().has("7day"),
}
func gift_claimed() -> Array:
var claimed: Array = data.get("gift_claimed", [])
return claimed.duplicate()
func claim_gift() -> bool:
if best_streak() < 7:
return false
var claimed: Array = data.get("gift_claimed", [])
if claimed.has("7day"):
return false
claimed.append("7day")
data["gift_claimed"] = claimed
save_game()
progress_changed.emit()
return true
const THEMES := {
"cream": {"name": "Cream", "background": "fbf1df", "rooms": 0, "streak": 0},
"sage": {"name": "Sage", "background": "dce9df", "rooms": 10, "streak": 0},
"rose": {"name": "Rose", "background": "f6dfdc", "rooms": 0, "streak": 3},
"dusk": {"name": "Dusk", "background": "e4dfef", "rooms": 20, "streak": 0},
"gold": {"name": "Gold", "background": "f7e7bc", "rooms": 0, "streak": 0},
}
func theme_id() -> String:
var id := str(data.get("player_theme", get_setting("theme")))
if not THEMES.has(id) or not is_theme_unlocked(id):
return "cream"
return id
func is_theme_unlocked(id: String) -> bool:
if not THEMES.has(id):
return false
if id == "cream":
return true
if id == "gold":
return gift_claimed().has("7day")
var def: Dictionary = THEMES[id]
return (
rooms_completed() >= int(def.get("rooms", 0))
and best_streak() >= int(def.get("streak", 0))
)
func select_theme(id: String) -> void:
if not is_theme_unlocked(id):
return
data["player_theme"] = id
data["settings"]["theme"] = id
save_game()
settings_changed.emit()
progress_changed.emit()
func save_board(mode: String, snapshot: Dictionary) -> void:
var boards: Dictionary = data.get("saved_boards", {})
boards[mode] = snapshot
data["saved_boards"] = boards
save_game()
func load_board(mode: String) -> Dictionary:
var boards: Dictionary = data.get("saved_boards", {})
var snapshot = boards.get(mode, {})
return snapshot.duplicate(true) if typeof(snapshot) == TYPE_DICTIONARY else {}
func clear_board(mode: String) -> void:
var boards: Dictionary = data.get("saved_boards", {})
boards.erase(mode)
data["saved_boards"] = boards
save_game()
+318 -5
View File
@@ -10,6 +10,16 @@ var toggles := {}
var hold_slider: HSlider
var hold_value: Label
var hold_panel: PanelContainer
var music_volume_slider: HSlider
var difficulty_button: Button
var ui_scale_button: Button
var theme_button: Button
var wallpaper_layer: ColorRect
var wallpaper_grid: GridContainer
var pending_theme := "cream"
var difficulty_layer: ColorRect
var difficulty_grid: VBoxContainer
var pending_difficulty := "normal"
var game_actions: HBoxContainer
var reset_row: Control
var resume_button: Button
@@ -71,7 +81,7 @@ func _ready() -> void:
var close := UI.button("×", false, 36)
close.custom_minimum_size = Vector2(42, 36)
close.add_theme_font_size_override("font_size", 24)
UI.set_font_size(close, 24)
close.pressed.connect(_close)
header.add_child(close)
@@ -89,12 +99,25 @@ func _ready() -> void:
_add_pattern_row(list)
_add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer")
_add_toggle(list, "Reduce motion", "Stop the bob and placement pop.", "reduce_motion")
_add_toggle(list, "Haptics", "Light vibration on Android.", "haptics")
_add_toggle(list, "Double-tap to place", "Tap = mark · double-tap = check in.", "double_tap_place")
_add_toggle(list, "Music", "Play the hotel lounge loop.", "music")
_add_toggle(list, "Sound effects", "UI and completion chimes.", "sfx")
_add_slider_row(list, "Music volume", "Lounge loop loudness.", "music_volume")
ui_scale_button = UI.button("Text size: Normal", false, 40)
ui_scale_button.pressed.connect(_cycle_ui_scale)
list.add_child(ui_scale_button)
difficulty_button = UI.button("Difficulty: Normal", false, 40)
difficulty_button.pressed.connect(_open_difficulty_picker)
list.add_child(difficulty_button)
theme_button = UI.button("Wallpaper: Cream", false, 40)
theme_button.pressed.connect(_open_wallpaper_picker)
list.add_child(theme_button)
_add_hold_row(list)
list.add_child(UI.spacer(2))
var rules := UI.button("How to play", false, 44)
rules.add_theme_font_size_override("font_size", 15)
UI.set_font_size(rules, 15)
rules.pressed.connect(func() -> void: rules_requested.emit())
list.add_child(rules)
@@ -108,20 +131,23 @@ func _ready() -> void:
# label, toggle, or button.
UI.pass_scroll_input(list)
_build_wallpaper_picker()
_build_difficulty_picker()
game_actions = HBoxContainer.new()
game_actions.add_theme_constant_override("separation", 6)
column.add_child(game_actions)
var restart := UI.button("Restart", false, 40)
restart.size_flags_horizontal = Control.SIZE_EXPAND_FILL
restart.add_theme_font_size_override("font_size", 14)
UI.set_font_size(restart, 14)
restart.add_theme_color_override("font_color", Palette.RED)
restart.pressed.connect(_on_restart)
game_actions.add_child(restart)
var lobby := UI.button("Lobby", false, 40)
lobby.size_flags_horizontal = Control.SIZE_EXPAND_FILL
lobby.add_theme_font_size_override("font_size", 14)
UI.set_font_size(lobby, 14)
lobby.pressed.connect(_on_lobby)
game_actions.add_child(lobby)
@@ -225,6 +251,17 @@ func refresh() -> void:
if hold_slider != null:
hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds")))
hold_value.text = "%.2f s" % hold_slider.value
if music_volume_slider != null:
music_volume_slider.set_value_no_signal(float(SaveGame.get_setting("music_volume")))
if difficulty_button != null:
difficulty_button.text = "Difficulty: %s" % str(SaveGame.get_setting("difficulty")).capitalize()
if ui_scale_button != null:
var scale := float(SaveGame.get_setting("ui_scale"))
var size_name := "Normal" if is_equal_approx(scale, 1.0) else ("Large" if is_equal_approx(scale, 1.15) else "Extra large")
ui_scale_button.text = "Text size: %s" % size_name
if theme_button != null:
var theme: Dictionary = SaveGame.THEMES.get(SaveGame.theme_id(), {})
theme_button.text = "Wallpaper: %s" % str(theme.get("name", "Cream"))
_update_hold_availability()
@@ -280,6 +317,282 @@ func _add_toggle(parent: VBoxContainer, title: String, detail: String, key: Stri
parent.add_child(panel)
func _add_slider_row(parent: VBoxContainer, title: String, detail: String, key: String) -> void:
var panel := UI.panel(Palette.PAPER, 14, 8)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 2)
panel.add_child(column)
column.add_child(UI.label(title, 14))
column.add_child(UI.label(detail, 10, Palette.MUTED))
var slider := HSlider.new()
slider.min_value = 0.0
slider.max_value = 1.0
slider.step = 0.05
slider.value = float(SaveGame.get_setting(key))
slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
slider.value_changed.connect(func(value: float) -> void: SaveGame.set_setting(key, snapped(value, 0.05)))
column.add_child(slider)
parent.add_child(panel)
if key == "music_volume":
music_volume_slider = slider
func _cycle_ui_scale() -> void:
var order := [1.0, 1.15, 1.3]
var current := float(SaveGame.get_setting("ui_scale"))
var next_index := (order.find(current) + 1) % order.size()
SaveGame.set_setting("ui_scale", order[next_index])
refresh()
func _open_difficulty_picker() -> void:
pending_difficulty = str(SaveGame.get_setting("difficulty"))
_build_difficulty_grid()
difficulty_layer.visible = true
difficulty_layer.move_to_front()
func _build_difficulty_picker() -> void:
difficulty_layer = ColorRect.new()
difficulty_layer.color = Color(0.18, 0.12, 0.08, 0.62)
difficulty_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
difficulty_layer.mouse_filter = Control.MOUSE_FILTER_STOP
difficulty_layer.gui_input.connect(func(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
difficulty_layer.visible = false
)
difficulty_layer.visible = false
add_child(difficulty_layer)
var center := CenterContainer.new()
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
difficulty_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 24, 16)
var view_size := get_viewport_rect().size
panel.custom_minimum_size = Vector2(min(360, max(280, int(view_size.x) - 32)), max(260, min(330, int(view_size.y) - 96)))
center.add_child(panel)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 8)
panel.add_child(box)
box.add_child(UI.heading("Difficulty", 20))
var scroll := ScrollContainer.new()
scroll.custom_minimum_size = Vector2(0, 190)
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
box.add_child(scroll)
difficulty_grid = VBoxContainer.new()
difficulty_grid.add_theme_constant_override("separation", 6)
difficulty_grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.add_child(difficulty_grid)
var actions := HBoxContainer.new()
actions.add_theme_constant_override("separation", 8)
box.add_child(actions)
var cancel := UI.button("Cancel", false, 46)
cancel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
cancel.pressed.connect(func() -> void: difficulty_layer.visible = false)
actions.add_child(cancel)
var confirm := UI.button("Apply", true, 46)
confirm.size_flags_horizontal = Control.SIZE_EXPAND_FILL
confirm.pressed.connect(_apply_difficulty)
actions.add_child(confirm)
func _difficulty_detail(id: String) -> String:
if id == "zen":
return "No timer. Rule strip always shown. Take your time."
if id == "easy":
return "Timer visible. Rule strip always shown."
return "Timer visible. Rule strip only in the first rooms."
func _build_difficulty_grid() -> void:
for child in difficulty_grid.get_children():
child.queue_free()
for id in ["zen", "easy", "normal"]:
var card := Button.new()
card.custom_minimum_size = Vector2(0, 62)
card.flat = true
card.add_theme_stylebox_override("normal", _card_style(Palette.GOLD if id == pending_difficulty else Palette.PAPER))
card.add_theme_stylebox_override("hover", _card_style(Palette.PAPER_DARK))
card.pressed.connect(_select_pending_difficulty.bind(str(id)))
var column := VBoxContainer.new()
column.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
column.add_theme_constant_override("separation", 2)
column.mouse_filter = Control.MOUSE_FILTER_IGNORE
card.add_child(column)
var title := UI.label(str(id).capitalize(), 14)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
column.add_child(title)
var detail := UI.label(_difficulty_detail(str(id)), 10, Palette.MUTED)
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
column.add_child(detail)
difficulty_grid.add_child(card)
UI.pass_scroll_input(difficulty_grid)
func _select_pending_difficulty(id: String) -> void:
call_deferred("_set_pending_difficulty", id)
func _set_pending_difficulty(id: String) -> void:
pending_difficulty = id
_build_difficulty_grid()
func _apply_difficulty() -> void:
SaveGame.set_setting("difficulty", pending_difficulty)
difficulty_layer.visible = false
refresh()
func _open_wallpaper_picker() -> void:
pending_theme = SaveGame.theme_id()
_build_wallpaper_grid()
wallpaper_layer.visible = true
wallpaper_layer.move_to_front()
func _build_wallpaper_picker() -> void:
wallpaper_layer = ColorRect.new()
wallpaper_layer.color = Color(0.18, 0.12, 0.08, 0.62)
wallpaper_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
wallpaper_layer.mouse_filter = Control.MOUSE_FILTER_STOP
wallpaper_layer.gui_input.connect(func(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
wallpaper_layer.visible = false
)
wallpaper_layer.visible = false
add_child(wallpaper_layer)
var center := CenterContainer.new()
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
center.mouse_filter = Control.MOUSE_FILTER_IGNORE
wallpaper_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 24, 16)
var view_size := get_viewport_rect().size
var max_width: int = max(280, int(view_size.x) - 32)
var panel_height: int = max(320, min(470, int(view_size.y) - 96))
panel.custom_minimum_size = Vector2(min(360, max_width), panel_height)
center.add_child(panel)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 8)
panel.add_child(box)
box.add_child(UI.heading("Wallpapers", 20))
var scroll := ScrollContainer.new()
scroll.custom_minimum_size = Vector2(0, max(180, panel_height - 170))
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
box.add_child(scroll)
wallpaper_grid = GridContainer.new()
wallpaper_grid.columns = 2
wallpaper_grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
wallpaper_grid.add_theme_constant_override("h_separation", 6)
wallpaper_grid.add_theme_constant_override("v_separation", 6)
scroll.add_child(wallpaper_grid)
var actions := HBoxContainer.new()
actions.add_theme_constant_override("separation", 8)
box.add_child(actions)
var cancel := UI.button("Cancel", false, 46)
cancel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
cancel.pressed.connect(func() -> void: wallpaper_layer.visible = false)
actions.add_child(cancel)
var confirm := UI.button("Apply", true, 46)
confirm.size_flags_horizontal = Control.SIZE_EXPAND_FILL
confirm.pressed.connect(_apply_wallpaper)
actions.add_child(confirm)
func _theme_requirement(def: Dictionary) -> String:
if str(def.get("name", "")) == "Gold":
return "Open the 7-day gift"
var rooms := int(def.get("rooms", 0))
var streak := int(def.get("streak", 0))
if rooms > 0 and streak > 0:
return "%d rooms · %d-day streak" % [rooms, streak]
if rooms > 0:
return "Complete %d rooms" % rooms
if streak > 0:
return "%d-day best streak" % streak
return "Always available"
func _build_wallpaper_grid() -> void:
for child in wallpaper_grid.get_children():
child.queue_free()
for id in SaveGame.THEMES.keys():
var def: Dictionary = SaveGame.THEMES[id]
var unlocked := SaveGame.is_theme_unlocked(id)
var card := Button.new()
card.custom_minimum_size = Vector2(150, 118)
card.flat = true
card.add_theme_stylebox_override("normal", _card_style(Palette.GOLD if id == pending_theme else Palette.PAPER))
card.add_theme_stylebox_override("hover", _card_style(Palette.PAPER_DARK))
card.pressed.connect(_select_pending_theme.bind(str(id), unlocked))
var column := VBoxContainer.new()
column.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
column.add_theme_constant_override("separation", 2)
column.mouse_filter = Control.MOUSE_FILTER_IGNORE
card.add_child(column)
var preview := TextureRect.new()
preview.custom_minimum_size = Vector2(0, 68)
preview.size_flags_vertical = Control.SIZE_EXPAND_FILL
preview.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
preview.stretch_mode = TextureRect.STRETCH_SCALE
preview.mouse_filter = Control.MOUSE_FILTER_IGNORE
var path := "res://assets/backgrounds/%s.png" % str(id)
if ResourceLoader.exists(path):
preview.texture = load(path)
column.add_child(preview)
var title := UI.label(str(def.get("name", id)), 11, Palette.INK)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
column.add_child(title)
var state := "Selected" if id == pending_theme else ("Unlocked" if unlocked else _theme_requirement(def))
var sub := UI.label(state, 9, Palette.GOLD if id == pending_theme else (Palette.MUTED if unlocked else Palette.RED))
sub.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
column.add_child(sub)
if not unlocked:
card.modulate = Color(1, 1, 1, 0.72)
wallpaper_grid.add_child(card)
UI.pass_scroll_input(wallpaper_grid)
func _select_pending_theme(id: String, unlocked: bool) -> void:
if not unlocked:
return
call_deferred("_set_pending_theme", id)
func _set_pending_theme(id: String) -> void:
pending_theme = id
_build_wallpaper_grid()
func _apply_wallpaper() -> void:
SaveGame.select_theme(pending_theme)
wallpaper_layer.visible = false
refresh()
func _card_style(color: Color) -> StyleBoxFlat:
var style := StyleBoxFlat.new()
style.bg_color = color
style.corner_radius_top_left = 12
style.corner_radius_top_right = 12
style.corner_radius_bottom_left = 12
style.corner_radius_bottom_right = 12
style.content_margin_left = 6
style.content_margin_right = 6
style.content_margin_top = 6
style.content_margin_bottom = 6
return style
func _add_hold_row(parent: VBoxContainer) -> void:
var panel := UI.panel(Palette.PAPER, 14, 8)
hold_panel = panel
@@ -336,7 +649,7 @@ func _action_row(title: String, detail: String, color: Color, callback: Callable
var go := UI.button("›", false, 34)
go.custom_minimum_size = Vector2(38, 34)
go.add_theme_font_size_override("font_size", 18)
UI.set_font_size(go, 18)
go.pressed.connect(callback)
row.add_child(go)
+52
View File
@@ -8,6 +8,10 @@ var goal_label: Label
var week_row: HBoxContainer
var regular_milestone: Label
var night_milestone: Label
var stats_label: Label
var countdown_label: Label
var gift_button: Button
var gift_status: Label
func _ready() -> void:
@@ -64,6 +68,10 @@ func _ready() -> void:
goal_label = UI.label("", 12, Palette.INK)
content.add_child(goal_label)
stats_label = UI.label("", 11, Palette.MUTED)
content.add_child(stats_label)
countdown_label = UI.label("", 11, Palette.MUTED)
content.add_child(countdown_label)
content.add_child(UI.heading("This week", 18))
week_row = HBoxContainer.new()
@@ -83,6 +91,17 @@ func _ready() -> void:
gift_text.custom_minimum_size = Vector2(110, 0)
gift_row.add_child(gift_text)
gift_button = UI.button("Claim 7-day gift", true, 44)
gift_button.pressed.connect(_claim_gift)
content.add_child(gift_button)
gift_status = UI.label("", 10, Palette.MUTED)
content.add_child(gift_status)
var share := UI.button("Share result", false, 44)
UI.set_font_size(share, 14)
share.pressed.connect(_share_result)
content.add_child(share)
content.add_child(UI.heading("Streak rewards", 18))
var milestones := HBoxContainer.new()
milestones.add_theme_constant_override("separation", 6)
@@ -113,7 +132,12 @@ func refresh() -> void:
current_label.text = str(streak)
best_label.text = "Best streak: %d" % SaveGame.best_streak()
goal_label.text = Daily.goal_text(streak)
stats_label.text = "%d daily rooms solved" % SaveGame.total_dailies()
countdown_label.text = "Next room in %s" % _next_daily_countdown()
var best := SaveGame.best_streak()
var claimed := SaveGame.gift_claimed().has("7day")
gift_button.visible = best >= 7 and not claimed
gift_status.text = "Gift claimed · Gold wallpaper unlocked" if claimed else ""
regular_milestone.text = "Unlocked" if best >= 3 else "%d to go" % (3 - best)
night_milestone.text = "Unlocked" if best >= 7 else "%d to go" % (7 - best)
regular_milestone.add_theme_color_override("font_color", Palette.GOLD if best >= 3 else Palette.INK)
@@ -121,6 +145,28 @@ func refresh() -> void:
_build_week()
func _next_daily_countdown() -> String:
var date := Time.get_date_dict_from_system()
var remaining := 86400 - int(date.get("hour", 0)) * 3600 - int(date.get("minute", 0)) * 60 - int(date.get("second", 0))
return "%02d:%02d:%02d" % [remaining / 3600, (remaining % 3600) / 60, remaining % 60]
func _share_result() -> void:
var text := "Ratdoku daily: %d-day streak, best %d, %d daily rooms solved." % [
SaveGame.daily_streak(), SaveGame.best_streak(), SaveGame.total_dailies()
]
DisplayServer.clipboard_set(text)
gift_status.text = "Result copied to clipboard."
gift_status.add_theme_color_override("font_color", Palette.MUTED)
func _claim_gift() -> void:
if SaveGame.claim_gift():
gift_status.text = "Gift claimed · Gold wallpaper unlocked."
gift_status.add_theme_color_override("font_color", Palette.GOLD)
refresh()
func _build_week() -> void:
for child in week_row.get_children():
child.queue_free()
@@ -128,6 +174,9 @@ func _build_week() -> void:
var keys: Array = Daily.week_keys()
var labels: Array = Daily.weekday_labels()
var history: Array = SaveGame.daily_history()
var times := {}
for entry in SaveGame.daily_entries():
times[str(entry.get("date", ""))] = int(entry.get("seconds", 0))
var today := Daily.today_key()
for i in range(7):
var key := str(keys[i])
@@ -155,6 +204,9 @@ func _build_week() -> void:
circle.add_child(center)
center.add_child(UI.icon("res://assets/icons/star_white.svg", 20, Palette.WHITE))
chip.add_child(circle)
if done and int(times.get(key, 0)) > 0:
var secs := int(times[key])
chip.add_child(UI.label("%02d:%02d" % [secs / 60, secs % 60], 8, Palette.MUTED))
week_row.add_child(chip)
UI.pass_scroll_input(week_row)
+59 -3
View File
@@ -40,13 +40,66 @@ static func body_font() -> Font:
return _body_font
## The SaveGame autoload, fetched dynamically so helper scripts can compile
## before autoloads are registered (headless --script runs do exactly that).
static func _save_node() -> Node:
var loop := Engine.get_main_loop()
if loop is SceneTree:
return (loop as SceneTree).root.get_node_or_null("SaveGame")
return null
## User-facing UI scale (1.0 / 1.15 / 1.3), defaulting to 1.0 if missing or bad.
static func ui_scale() -> float:
var save := _save_node()
if save == null:
return 1.0
var value: Variant = save.get_setting("ui_scale")
var type := typeof(value)
if type == TYPE_FLOAT or type == TYPE_INT or type == TYPE_STRING:
var scale := float(value)
if scale > 0.0 and is_finite(scale):
return scale
return 1.0
## Font size with the UI scale applied, never below the 8 px minimum.
static func _scaled_font_size(base_size: int) -> int:
return int(max(8, round(base_size * ui_scale())))
## Light haptic feedback on Android. Strong is used for wins and unlocks.
static func haptic(strong: bool = false) -> void:
var save := _save_node()
if save == null or not bool(save.get_setting("haptics")):
return
if OS.get_name() == "Android":
Input.vibrate_handheld(55 if strong else 18)
## Sets a per-control font size while keeping it eligible for live text scaling.
static func set_font_size(control: Control, base_size: int) -> void:
control.set_meta("base_font_size", base_size)
control.add_theme_font_size_override("font_size", _scaled_font_size(base_size))
## Re-applies the saved text scale to controls that are already on screen.
static func apply_scale(root: Node) -> void:
if root is Control and root.has_meta("base_font_size"):
var base := int(root.get_meta("base_font_size"))
root.add_theme_font_size_override("font_size", _scaled_font_size(base))
for child in root.get_children():
apply_scale(child)
static func label(text: String, font_size: int = BODY, color: Color = Palette.INK, heading: bool = false) -> Label:
var l := Label.new()
l.text = text
l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
l.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
l.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
l.add_theme_font_size_override("font_size", font_size)
l.set_meta("base_font_size", font_size)
l.add_theme_font_size_override("font_size", _scaled_font_size(font_size))
l.add_theme_color_override("font_color", color)
l.add_theme_font_override("font", heading_font() if (heading or font_size >= 28) else body_font())
return l
@@ -68,8 +121,9 @@ static func button(text: String, primary: bool = false, min_height: int = BTN_H)
var b := Button.new()
b.text = text
b.custom_minimum_size = Vector2(0, min_height)
b.set_meta("base_font_size", BTN_FONT)
b.add_theme_font_override("font", heading_font())
b.add_theme_font_size_override("font_size", BTN_FONT)
b.add_theme_font_size_override("font_size", _scaled_font_size(BTN_FONT))
b.add_theme_color_override("font_color", Palette.WHITE if primary else Palette.INK)
b.add_theme_color_override("font_hover_color", Palette.WHITE if primary else Palette.INK)
b.add_theme_color_override("font_pressed_color", Palette.WHITE if primary else Palette.INK)
@@ -157,7 +211,9 @@ static func pass_scroll_input(root: Node, skip: Array = []) -> void:
## Short control hint that follows the saved placement mode.
static func place_hint() -> String:
if bool(SaveGame.get_setting("double_tap_place")):
var save := _save_node()
var double_tap := true if save == null else bool(save.get_setting("double_tap_place"))
if double_tap:
return "Tap = X · Double-tap or right-click = check in"
return "Tap = X · Hold or right-click = check in"
+4 -4
View File
@@ -1,7 +1,7 @@
class_name Version
extends RefCounted
const NUMBER := "0.6.4-alpha"
const CODENAME := "Polished Edges"
const BUILD_DATE := "2026-12-03"
const BUILD_LABEL := "v0.6.4-alpha · build 2026-12-03"
const NUMBER := "0.9.0-alpha"
const CODENAME := "Hotel Life"
const BUILD_DATE := "2026-12-05"
const BUILD_LABEL := "v0.9.0-alpha · build 2026-12-05"
+2 -2
View File
@@ -1,7 +1,7 @@
param(
[string]$Godot = "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe",
[string]$Jdk = "E:\AndroidTools\jdk-17.0.21.1+2",
[string]$Sdk = "E:\AndroidTools\sdk",
[string]$Jdk = "C:\Users\enter\AppData\Local\Temp\opencode\android-toolchain\jdk",
[string]$Sdk = "C:\Users\enter\AppData\Local\Temp\opencode\android-toolchain\sdk",
[string]$Out = "build/Ratdoku.apk"
)
+5 -2
View File
@@ -44,7 +44,8 @@ function Invoke-Godot([string[]]$arguments, [string]$name, [string]$marker) {
Add-Content -Path $logFile -Value $text
$hasMarker = $text -match [regex]::Escape($marker)
$hasError = $text -match 'ERROR:|SCRIPT ERROR:|Parse Error|FAIL:|Assertion failed'
$errorText = $text -replace 'ERROR: \d+ resources still in use at exit[^\r\n]*', ''
$hasError = $errorText -match 'ERROR:|SCRIPT ERROR:|Parse Error|FAIL:|Assertion failed'
if ($process.ExitCode -ne 0 -or -not $hasMarker -or $hasError) {
$script:failures += $name
Write-Host "FAIL $name (exit=$($process.ExitCode) marker=$hasMarker error=$hasError)"
@@ -64,6 +65,7 @@ $tests = @(
@{ File = "tools/ui_test.gd"; Marker = "UI TEST: PASS"; Name = "ui" },
@{ File = "tools/qa_core.gd"; Marker = "QA CORE: PASS"; Name = "qa-core" },
@{ File = "tools/qa_ui.gd"; Marker = "QA UI: PASS"; Name = "qa-ui" },
@{ File = "tools/qa_freeplay.gd"; Marker = "QA FREEPLAY: PASS"; Name = "qa-freeplay" },
@{ File = "tools/qa_input.gd"; Marker = "QA INPUT: PASS"; Name = "qa-input" }
)
@@ -100,7 +102,8 @@ if ($Build) {
if (Test-Path $buildErr) { $buildOutput += "`n" + (Get-Content $buildErr -Raw) }
Add-Content -Path $logFile -Value $buildOutput
$apk = Join-Path $project "build/Ratdoku.apk"
if ($buildProc.ExitCode -ne 0 -or $buildOutput -notmatch 'DONE' -or -not (Test-Path $apk)) {
$exportFailed = $buildOutput -match 'Project export for preset .* failed|ERROR: Cannot export project'
if ($buildProc.ExitCode -ne 0 -or $exportFailed -or $buildOutput -notmatch 'DONE.*export' -or -not (Test-Path $apk)) {
$script:failures += "android-build"
Write-Host "FAIL android-build"
}
+54 -5
View File
@@ -46,6 +46,7 @@ func _run() -> void:
_test_daily(save)
_test_frames(save)
_test_avatars_and_streak(save)
_test_v6_features(save)
_test_game_data(save)
_test_icons()
@@ -127,6 +128,12 @@ func _test_icons() -> void:
button.free()
small_icon.free()
if FileAccess.file_exists("res://export_presets.cfg"):
var preset_file := FileAccess.open("res://export_presets.cfg", FileAccess.READ)
var preset_text := preset_file.get_as_text()
preset_file.close()
_check(preset_text.contains("permissions/vibrate=true"), "Android preset should grant VIBRATE for haptics")
func _finish() -> void:
if failures == 0:
@@ -192,7 +199,7 @@ func _test_save_migrations(save) -> void:
# (a) No save file at all -> fresh version-4 defaults.
_remove_save(save)
save.load_game()
_check(int(save.data.get("version", 0)) == 4, "fresh save should be version 4")
_check(int(save.data.get("version", 0)) == 7, "fresh save should be version 7")
_check(bool(save.get_setting("double_tap_place")), "fresh save should default to double-tap")
_check(_is_default_daily(save, save.daily_data()), "fresh save should have default daily stats")
_check(save.selected_frame() == "plain", "fresh save should select the plain frame")
@@ -207,7 +214,7 @@ func _test_save_migrations(save) -> void:
v1.erase("profile_frame")
_write_save(save, v1)
save.load_game()
_check(int(save.data.get("version", 0)) == 4, "version 1 should migrate to version 4")
_check(int(save.data.get("version", 0)) == 7, "version 1 should migrate to version 7")
_check(bool(save.get_setting("double_tap_place")), "version 1 should migrate to double-tap")
_check(_is_default_daily(save, save.daily_data()), "version 1 missing daily should become defaults")
_check(save.selected_frame() == "plain", "version 1 missing frame should become plain")
@@ -220,7 +227,7 @@ func _test_save_migrations(save) -> void:
v2.erase("profile_frame")
_write_save(save, v2)
save.load_game()
_check(int(save.data.get("version", 0)) == 4, "version 2 should migrate to version 4")
_check(int(save.data.get("version", 0)) == 7, "version 2 should migrate to version 7")
_check(not bool(save.get_setting("double_tap_place")), "version 2 double_tap=false should stay false")
_check(_is_default_daily(save, save.daily_data()), "version 2 missing daily should become defaults")
_check(save.selected_frame() == "plain", "version 2 missing frame should become plain")
@@ -233,7 +240,7 @@ func _test_save_migrations(save) -> void:
else:
_check(false, "could not write wrong-shape save")
save.load_game()
_check(int(save.data.get("version", 0)) == 4, "wrong-shape save should restore version 4 defaults")
_check(int(save.data.get("version", 0)) == 7, "wrong-shape save should restore version 7 defaults")
_check(bool(save.get_setting("double_tap_place")), "wrong-shape save should restore double-tap default")
_check(_is_default_daily(save, save.daily_data()), "wrong-shape save should restore daily defaults")
_check(save.selected_frame() == "plain", "wrong-shape save should restore plain frame")
@@ -261,6 +268,20 @@ func _test_save_migrations(save) -> void:
_check(not bool(save.get_setting("double_tap_place")), "an explicit false should not be overwritten")
_check(bool(save.get_setting("patterns")), "unlisted settings should still be filled from DEFAULTS")
# (f) Wrong-typed settings and junk array elements are repaired.
var wrong: Dictionary = save._default_data()
wrong["version"] = 7
wrong["settings"]["haptics"] = "false"
wrong["settings"]["ui_scale"] = "large"
wrong["settings"]["hold_seconds"] = "bad"
wrong["completed_rooms"] = ["a", 5, {}]
_write_save(save, wrong)
save.load_game()
_check(typeof(save.get_setting("haptics")) == TYPE_BOOL, "wrong-typed haptics should be repaired")
_check(is_equal_approx(float(save.get_setting("ui_scale")), 1.0), "wrong-typed ui_scale should be repaired")
_check(is_equal_approx(float(save.get_setting("hold_seconds")), 0.35), "wrong-typed hold_seconds should be repaired")
_check((save.data["completed_rooms"] as Array).size() == 1, "junk room entries should be filtered")
_reset_to_clean(save)
@@ -381,7 +402,7 @@ func _test_frames(save) -> void:
_note("3. frames")
_reset_to_clean(save)
_check(frames.all().size() == 7, "there should be seven profile frames")
_check(frames.all().size() == 13, "there should be thirteen profile frames")
_check(frames.is_unlocked("plain"), "plain frame should always be unlocked")
_check(not frames.requirement_text("plain").is_empty(), "plain frame should have requirement text")
@@ -470,6 +491,34 @@ func _test_frames(save) -> void:
# 4. Level and guest data
# ---------------------------------------------------------------------------
func _test_v6_features(save) -> void:
_note("6. v6 systems")
_check(save.player_name() == "Innkeeper", "default player name should be Innkeeper")
_check(save.player_id().begins_with("RAT-"), "player ID should be generated")
save.set_player_name("Ahri")
_check(save.player_name() == "Ahri", "player name should save")
_check(bool(save.get_setting("music")), "music should default on")
_check(absf(float(save.get_setting("music_volume")) - 0.7) < 0.001, "music volume should default to 0.7")
_check(bool(save.get_setting("sfx")), "sfx should default on")
_check(save.theme_id() == "cream", "default wallpaper should be cream")
_check(not save.is_theme_unlocked("gold"), "gold wallpaper should start locked")
save.data["daily"]["best_streak"] = 7
save.save_game()
_check(save.claim_gift(), "7-day gift should be claimable")
_check(not save.claim_gift(), "7-day gift should not double claim")
_check(save.is_theme_unlocked("gold"), "gift should unlock gold wallpaper")
save.select_theme("gold")
_check(save.theme_id() == "gold", "gold wallpaper should be selectable")
var snap := {"level_id": "probe", "n": 8, "cells": [], "auto_x": [], "history": []}
save.save_board("campaign", snap)
_check(save.load_board("campaign") == snap, "board snapshot should round trip")
save.clear_board("campaign")
_check(save.load_board("campaign").is_empty(), "board snapshot should clear")
var state: Dictionary = save.achievements()
_check(bool(state.get("streak_7", false)), "achievements should reflect streak")
_reset_to_clean(save)
func _test_game_data(save) -> void:
_note("4. level/guest data")
+387
View File
@@ -0,0 +1,387 @@
extends SceneTree
## Headless QA for scripts/FreePlay.gd.
## <godot> --headless --path <project> --script res://tools/qa_freeplay.gd --quit-after 600
##
## Generates 60 variants across several seeds and checks, for each one:
## * same dictionary shape, n, id, grid dimensions and value types;
## * same multiset of region ids, same region sizes and same wall count;
## * a legal solution under the game's own Rules, with clues on that solution;
## * applying the inverse symmetry and inverse region relabeling recovers the
## verified source entry exactly.
## Exits 0 on success and 1 on failure. Prints "QA FREEPLAY: PASS" / ": FAIL".
const SEEDS := 4
const PER_SEED := 15
const TOTAL := SEEDS * PER_SEED
const EMPTY := 0
const RAT := 2 # Mirrors scripts/Rules.gd; kept local to avoid load-order issues.
var failures := 0
var checks := 0
func _init() -> void:
call_deferred("_run")
func _check(ok: bool, message: String) -> void:
checks += 1
if not ok:
failures += 1
print("FAIL: ", message)
func _run() -> void:
var freeplay = load("res://scripts/FreePlay.gd")
var rules = load("res://scripts/Rules.gd")
_check(freeplay != null, "res://scripts/FreePlay.gd could not be loaded")
_check(rules != null, "res://scripts/Rules.gd could not be loaded")
if freeplay == null or rules == null:
_finish(TOTAL)
return
var sources: Array = freeplay.all_source_levels()
_check(sources.size() == 30, "expected 30 verified source levels, got %d" % sources.size())
if sources.is_empty():
_finish(TOTAL)
return
var generated := 0
for seed in range(SEEDS):
for index in range(PER_SEED):
_test_variant(freeplay, rules, sources, seed, index)
generated += 1
_check(generated == TOTAL, "expected %d variants, generated %d" % [TOTAL, generated])
_finish(generated)
func _test_variant(freeplay, rules, sources: Array, seed: int, index: int) -> void:
var tag := "seed=%d index=%d" % [seed, index]
var params: Dictionary = freeplay.variant_params(seed, index)
var board: Dictionary = freeplay.variant(seed, index)
_check(not params.is_empty(), "%s: no variant params" % tag)
_check(not board.is_empty(), "%s: no variant produced" % tag)
if params.is_empty() or board.is_empty():
return
var src_index := int(params["source_index"])
if not (src_index >= 0 and src_index < sources.size()):
_check(false, "%s: source index %d out of range" % [tag, src_index])
return
var source: Dictionary = sources[src_index]
var n := int(source.get("n", 0))
_check(n == 8, "%s: source n is not 8" % tag)
# --- same shape as a level entry -----------------------------------------
var src_keys: Array = source.keys()
var board_keys: Array = board.keys()
src_keys.sort()
board_keys.sort()
_check(src_keys == board_keys, "%s: key set differs from source" % tag)
_check(int(board.get("n", -1)) == n, "%s: n differs from source" % tag)
_check(str(board.get("id", "")) == str(source.get("id", "")), "%s: id differs from source" % tag)
# --- region grid: dimensions, cell values, counts and walls --------------
var src_regions: Array = source.get("regions", [])
var regions: Array = board.get("regions", [])
_check(regions.size() == n, "%s: regions row count differs" % tag)
if regions.size() != n:
return
var dims_ok := true
for row in regions:
if typeof(row) != TYPE_ARRAY or (row as Array).size() != n:
dims_ok = false
_check(dims_ok, "%s: regions column count differs" % tag)
if not dims_ok:
return
var values_ok := true
for row in regions:
for value in row:
var id := int(value)
if id < 0 or id >= n:
values_ok = false
_check(values_ok, "%s: region id out of range" % tag)
var region_map: Array = params["region_map"]
var inverse_map: Array = params["inverse_map"]
# Values move under the relabeling, so compare counts mapped through it.
_check(
_relabeled_counts_match(regions, src_regions, n, region_map),
"%s: region cell counts do not match the source under the relabeling" % tag
)
_check(
_region_sizes(regions, n) == _region_sizes(src_regions, n),
"%s: per-region cell counts differ from source" % tag
)
_check(
_wall_count(regions, n) == _wall_count(src_regions, n),
"%s: wall count differs from source" % tag
)
# --- region relabeling must be one-to-one -------------------------------
var seen: Dictionary = {}
var perm_ok := region_map.size() == n and inverse_map.size() == n
for value in region_map:
var id := int(value)
if id < 0 or id >= n or seen.has(id):
perm_ok = false
seen[id] = true
for i in n:
if int(inverse_map[int(region_map[i])]) != i:
perm_ok = false
_check(perm_ok, "%s: region relabeling is not a bijection" % tag)
# --- solution and clues are still legal ---------------------------------
var solution: Array = board.get("solution", [])
var src_solution: Array = source.get("solution", [])
_check(solution.size() == n, "%s: solution length differs" % tag)
_check(src_solution.size() == n, "%s: source solution length is not n" % tag)
if solution.size() != n or src_solution.size() != n:
return
var columns: Dictionary = {}
var permutation_ok := true
for value in solution:
var c := int(value)
if c < 0 or c >= n or columns.has(c):
permutation_ok = false
columns[c] = true
_check(permutation_ok and columns.size() == n, "%s: solution is not a column permutation" % tag)
var cells: Array = []
for r in n:
var row: Array = []
for c in n:
row.append(EMPTY)
cells.append(row)
for r in n:
var c := int(solution[r])
if c >= 0 and c < n:
cells[r][c] = RAT
_check(rules.is_valid(cells, regions), "%s: variant solution is not legal" % tag)
var clues: Array = board.get("clues", [])
var src_clues: Array = source.get("clues", [])
_check(clues.size() == src_clues.size(), "%s: clue count differs from source" % tag)
var clues_ok := true
for clue in clues:
if typeof(clue) != TYPE_ARRAY or (clue as Array).size() != 2:
clues_ok = false
continue
var r := int(clue[0])
var c := int(clue[1])
if r < 0 or r >= n or c < 0 or c >= n or int(solution[r]) != c:
clues_ok = false
_check(clues_ok, "%s: clue coordinates do not match the solution" % tag)
if not clues_ok:
return
# Independent uniqueness check using the generator's own solver rules.
var solution_count := _count_solutions(regions, clues, n, 2)
_check(
solution_count == 1,
"%s: variant has %d solutions, expected exactly 1" % [tag, solution_count]
)
# --- inverse transform must recover the source exactly ------------------
var inverse_symmetry := int(freeplay.inverse_symmetry(int(params["symmetry"])))
var recovered_regions: Array = []
for r in n:
var row: Array = []
for c in n:
row.append(0.0)
recovered_regions.append(row)
for r in n:
for c in n:
var back: Vector2i = freeplay.transform_cell(r, c, inverse_symmetry, n)
var old_id := int(regions[r][c])
if old_id >= 0 and old_id < inverse_map.size():
recovered_regions[back.x][back.y] = float(int(inverse_map[old_id]))
else:
recovered_regions[back.x][back.y] = float(old_id)
var recovered_solution: Array = []
recovered_solution.resize(n)
for r in n:
var c := int(solution[r])
var back: Vector2i = freeplay.transform_cell(r, c, inverse_symmetry, n)
recovered_solution[back.x] = float(back.y)
var recovered_clues: Array = []
for clue in clues:
var back: Vector2i = freeplay.transform_cell(
int(clue[0]), int(clue[1]), inverse_symmetry, n
)
recovered_clues.append([float(back.x), float(back.y)])
var recovered := {
"clues": recovered_clues,
"id": str(board.get("id", "")),
"n": float(n),
"regions": recovered_regions,
"solution": recovered_solution,
}
_check(_same(recovered, source), "%s: inverse transform did not recover the source" % tag)
# Backtracking solver copied in behaviour from tools/generate_levels.gd:
# one rat per row/column/region, no rat in an adjacent column of an adjacent
# row, and all clue rows pinned to their clue column. Count up to `cap`.
var _solve_regions: Array = []
var _solve_n := 0
var _solve_cap := 2
var _solve_used_cols: Dictionary = {}
var _solve_used_regions: Dictionary = {}
var _solve_clue_cols: Dictionary = {}
var _solve_found: Array = []
func _count_solutions(regions: Array, clues: Array, n: int, cap: int) -> int:
_solve_regions = regions
_solve_n = n
_solve_cap = cap
_solve_found = []
_solve_used_cols = {}
_solve_used_regions = {}
_solve_clue_cols = {}
for clue in clues:
_solve_clue_cols[int(clue[0])] = int(clue[1])
_collect(0, -1, [])
return _solve_found.size()
func _collect(row: int, prev_col: int, current: Array) -> void:
if _solve_found.size() >= _solve_cap:
return
if row == _solve_n:
_solve_found.append(current.duplicate())
return
if _solve_clue_cols.has(row):
var fixed_col := int(_solve_clue_cols[row])
if _can_place(row, fixed_col, prev_col):
_place(row, fixed_col)
current.append(fixed_col)
_collect(row + 1, fixed_col, current)
current.pop_back()
_unplace(row, fixed_col)
return
for c in range(_solve_n):
if not _can_place(row, c, prev_col):
continue
_place(row, c)
current.append(c)
_collect(row + 1, c, current)
current.pop_back()
_unplace(row, c)
func _can_place(row: int, c: int, prev_col: int) -> bool:
if _solve_used_cols.has(c):
return false
var region := int(_solve_regions[row][c])
if _solve_used_regions.has(region):
return false
if row > 0 and absi(c - prev_col) < 2:
return false
return true
func _place(row: int, c: int) -> void:
_solve_used_cols[c] = true
_solve_used_regions[int(_solve_regions[row][c])] = true
func _unplace(row: int, c: int) -> void:
_solve_used_cols.erase(c)
_solve_used_regions.erase(int(_solve_regions[row][c]))
func _relabeled_counts_match(regions: Array, src_regions: Array, n: int, region_map: Array) -> bool:
var src_counts: Array = []
var var_counts: Array = []
for i in n:
src_counts.append(0)
var_counts.append(0)
for row in src_regions:
for value in row:
var id := int(value)
if id >= 0 and id < n:
src_counts[id] += 1
for row in regions:
for value in row:
var id := int(value)
if id >= 0 and id < n:
var_counts[id] += 1
for i in n:
var mapped := int(region_map[i])
if mapped < 0 or mapped >= n or int(var_counts[mapped]) != int(src_counts[i]):
return false
return true
func _region_sizes(regions: Array, n: int) -> Array:
var sizes: Array = []
for i in n:
sizes.append(0)
for row in regions:
for value in row:
var id := int(value)
if id >= 0 and id < n:
sizes[id] += 1
sizes.sort()
return sizes
func _wall_count(regions: Array, n: int) -> int:
var walls := 0
for r in n:
for c in n:
var id := int(regions[r][c])
if c + 1 < n and int(regions[r][c + 1]) != id:
walls += 1
if r + 1 < n and int(regions[r + 1][c]) != id:
walls += 1
return walls
func _same(a, b) -> bool:
if typeof(a) == TYPE_INT or typeof(a) == TYPE_FLOAT:
return (typeof(b) == TYPE_INT or typeof(b) == TYPE_FLOAT) \
and absf(float(a) - float(b)) < 0.0001
if typeof(a) != typeof(b):
return false
if typeof(a) == TYPE_ARRAY:
var left: Array = a
var right: Array = b
if left.size() != right.size():
return false
for i in left.size():
if not _same(left[i], right[i]):
return false
return true
if typeof(a) == TYPE_DICTIONARY:
var left: Dictionary = a
var right: Dictionary = b
if left.size() != right.size():
return false
for key in left.keys():
if not right.has(key) or not _same(left[key], right[key]):
return false
return true
return a == b
func _finish(generated: int) -> void:
if failures == 0:
print("generated %d variants, %d checks" % [generated, checks])
print("QA FREEPLAY: PASS")
quit(0)
else:
print("generated %d variants, %d checks, %d failures" % [generated, checks, failures])
print("QA FREEPLAY: FAIL")
quit(1)
+1
View File
@@ -0,0 +1 @@
uid://du7jjtkjkhx8f
+14
View File
@@ -249,6 +249,20 @@ func _test_board_modes(save) -> void:
"switching to double-tap should clear a held press")
_check(not board.hold_fired, "switching to double-tap should clear hold_fired")
# Board snapshot round-trip for save/resume.
var snap_cell := _find_empty(board)
if snap_cell.x >= 0:
save.set_setting("double_tap_place", false)
_mouse_button(board, snap_cell, true)
_mouse_button(board, snap_cell, false)
var snap := board.snapshot()
board.set_level(levels[1])
board.set_level(level)
var restored := board.restore_state(snap)
_check(restored, "board snapshot should restore")
_check(str(board.cells) == str(snap.get("cells")), "restored cells should match snapshot")
_check(str(board.history) == str(snap.get("history")), "restored history should match snapshot")
board.free()
+175 -3
View File
@@ -6,6 +6,7 @@ extends SceneTree
var failures := 0
var frames
var avatars
func _init() -> void:
@@ -39,6 +40,8 @@ func _run() -> void:
# autoloads are registered when this script is launched with --script.
frames = load("res://scripts/Frames.gd")
_check(frames != null, "Frames script missing")
avatars = load("res://scripts/Avatars.gd")
_check(avatars != null, "Avatars script missing")
_test_screen_cycle(main)
await _test_settings(main, save)
@@ -46,6 +49,7 @@ func _run() -> void:
await _test_daily(main, save)
await _test_campaign(main, save)
await _test_guest_book(main)
await _test_v09(main, save)
await _test_back(main)
await _test_reset_fallback(main, save)
_restore_defaults(save)
@@ -63,13 +67,13 @@ func _test_reset_fallback(main, save) -> void:
save.save_game()
save.progress_changed.emit()
await process_frame
_check(main.home.mascot_caption.text.find("Pepper") >= 0, "Home caption should follow the chosen avatar")
_check(main.home.avatar_portrait_id == "pepper", "Home avatar button should follow the chosen avatar")
save.reset_progress()
await process_frame
_check(save.selected_frame() == "plain", "reset should clear a room-locked frame")
_check(save.selected_avatar() == "crumb", "reset should clear a locked guest avatar")
_check(main.home.mascot_caption.text.find("Crumb") >= 0, "Home caption should return to Crumb")
_check(main.home.avatar_portrait_id == "crumb", "Home avatar button should return to Crumb")
func _test_screen_cycle(main) -> void:
@@ -104,8 +108,37 @@ func _test_settings(main, save) -> void:
_check(not main.settings_sheet.game_actions.visible, "home settings should hide game actions")
var toggles: Dictionary = main.settings_sheet.toggles
_check(toggles.has("patterns") and toggles.has("double_tap_place"), "settings toggles missing")
_check(toggles.has("patterns") and toggles.has("double_tap_place") and toggles.has("music"), "settings toggles missing")
_check(toggles["patterns"].mouse_filter == Control.MOUSE_FILTER_PASS, "settings rows should pass swipes")
_check(main.music_player != null and main.music_player.stream != null, "music player should have a stream")
save.set_setting("music", false)
_check(not main.music_player.playing, "music should stop when disabled")
save.set_setting("music", true)
_check(main.music_player.playing, "music should play when enabled")
_check(main.settings_sheet.music_volume_slider != null, "music volume slider missing")
_check(main.settings_sheet.difficulty_button.text.find("Difficulty") >= 0, "difficulty control missing")
main.settings_sheet.difficulty_button.pressed.emit()
_check(main.settings_sheet.difficulty_layer.visible, "difficulty picker should open")
_check(main.settings_sheet.difficulty_grid.get_child_count() == 3, "difficulty picker should show all modes")
_check(main.settings_sheet.difficulty_grid.get_child(0).mouse_filter == Control.MOUSE_FILTER_PASS, "difficulty cards should pass swipes")
main.settings_sheet._set_pending_difficulty("zen")
main.settings_sheet._apply_difficulty()
_check(str(save.get_setting("difficulty")) == "zen", "difficulty should apply Zen")
_check(not main.settings_sheet.difficulty_layer.visible, "difficulty picker should close after apply")
save.set_setting("difficulty", "normal")
_check(toggles.has("haptics"), "haptics toggle missing")
main.settings_sheet._cycle_ui_scale()
_check(is_equal_approx(float(save.get_setting("ui_scale")), 1.15), "text size should cycle")
_check(main.settings_sheet.ui_scale_button.text.find("Large") >= 0, "text size label should update")
save.set_setting("ui_scale", 1.0)
_check(main.background_rect.texture != null, "wallpaper texture should load")
main.settings_sheet._open_wallpaper_picker()
_check(main.settings_sheet.wallpaper_layer.visible, "wallpaper picker should open")
_check(main.settings_sheet.wallpaper_grid.get_child_count() == 5, "wallpaper picker should show all themes")
_check(main.settings_sheet.wallpaper_grid.get_child(0).mouse_filter == Control.MOUSE_FILTER_PASS, "wallpaper cards should pass swipes")
main.settings_sheet._set_pending_theme("cream")
main.settings_sheet._apply_wallpaper()
_check(not main.settings_sheet.wallpaper_layer.visible, "wallpaper picker should close after apply")
# Changes made through SaveGame must be reflected after an explicit refresh.
save.set_setting("patterns", false)
@@ -241,6 +274,15 @@ func _test_profile(main, save) -> void:
if profile == null:
return
_check(profile.player_id_label.text.begins_with("RAT-"), "profile should show player ID")
_check(profile.achievements_box.get_child_count() == 8, "profile should list achievements")
_check(profile.achievements_box.get_child(0).mouse_filter == Control.MOUSE_FILTER_PASS, "achievement rows should pass swipes")
profile._show_rename()
profile.name_input.text = "Ahri"
profile._save_name()
_check(save.player_name() == "Ahri", "name edit should save")
save.set_player_name("Innkeeper")
profile._set_tab("frame")
await process_frame
var expected: int = frames.all().size()
@@ -311,6 +353,13 @@ func _test_profile(main, save) -> void:
profile._set_tab("avatar")
await process_frame
_check(profile.frame_grid.get_child_count() > 10, "avatar tab should list portraits")
var locked_index := -1
for i in avatars.all().size():
if str(avatars.all()[i].get("id", "")) == "pepper":
locked_index = i
if locked_index >= 0 and locked_index < profile.frame_grid.get_child_count():
var labels = profile.frame_grid.get_child(locked_index).find_children("*", "Label", true, false)
_check(labels.size() > 0 and str(labels[0].text) == "???", "locked avatar should hide its name")
for i in range(profile.frame_grid.get_child_count()):
_check(
profile.frame_grid.get_child(i).mouse_filter == Control.MOUSE_FILTER_PASS,
@@ -326,6 +375,10 @@ func _test_profile(main, save) -> void:
var night_text := "Unlocked" if best >= 7 else "%d to go" % (7 - best)
_check(main.streak.regular_milestone.text == regular_text, "regular milestone should match best streak")
_check(main.streak.night_milestone.text == night_text, "night owl milestone should match best streak")
_check(main.streak.stats_label.text.find("daily rooms solved") >= 0, "streak should show total dailies")
_check(main.streak.countdown_label.text.find("Next room") >= 0, "streak should show next-daily countdown")
main.streak._share_result()
_check(main.streak.gift_status.text.find("clipboard") >= 0, "share result should confirm copy")
_check(main.streak.current_label.text == str(save.daily_streak()), "streak number should match the save")
main.show_screen("profile", false)
@@ -423,6 +476,110 @@ func _solve_board(game, label: String) -> void:
await process_frame
func _test_v09(main, save) -> void:
main.show_screen("home", false)
await process_frame
_check(int(save.data.get("version", 0)) == 7, "save should migrate to v7")
_check(save.data.has("guest_notes") and save.data.has("events"), "v7 save keys should exist")
var stories_ok := true
for guest in Guests.all():
var stories: Array = guest.get("stories", [])
if stories.size() != 3:
stories_ok = false
break
for line in stories:
if str(line).strip_edges().is_empty():
stories_ok = false
_check(stories_ok, "every guest should have three story lines")
save.data["guest_notes"] = {}
save.data["unlocked_guests"] = []
save.data["completed_rooms"] = []
save.save_game()
_check(save.story_line_count("pepper") == 0, "locked guest story should stay hidden")
save.data["unlocked_guests"] = ["pepper"]
save.save_game()
_check(save.story_line_count("pepper") == 1, "new guest should reveal the intro")
for i in range(3):
save.record_guest_visit("pepper")
_check(save.story_line_count("pepper") == 2, "third visit should reveal the second line")
for i in range(4):
save.record_guest_visit("pepper")
_check(save.story_line_count("pepper") == 3, "seventh visit should reveal the final line")
main.show_screen("home", false)
await process_frame
var mascot_before := str(main.home.mascot_id)
_check(not mascot_before.is_empty(), "Home should show a featured guest")
_check(main.home.mascot_note.text.find("Guest of the day") >= 0, "Home should label the daily guest")
main.home.mascot_button.pressed.emit()
await process_frame
_check(main.home.mascot_cycling, "tapping the mascot should start cycling")
_check(str(main.home.mascot_id) != mascot_before, "tapping should show another guest")
main.show_screen("guest_book", false)
await process_frame
main.guest_book._show_detail(Guests.by_id("pepper"))
await process_frame
_check(main.guest_book.detail_story_box.get_child_count() >= 3, "guest detail should show the story")
main.guest_book.detail_layer.visible = false
var events: Array = save.event_defs()
_check(events.size() == 6, "six hotel events should load")
var event: Dictionary = save.current_event()
_check(not event.is_empty(), "current event should resolve")
var id := str(event.get("id", ""))
_check(not id.is_empty() and int(event.get("duration_days", 0)) >= 3, "current event should be well formed")
save.data["events"] = {}
save.save_game()
_check(save.event_progress(id) == 0, "event progress should start at zero")
save.record_daily_event_progress("2026-12-01")
save.record_daily_event_progress("2026-12-01")
save.record_daily_event_progress("2026-12-02")
save.record_daily_event_progress("2026-12-03")
_check(save.event_progress(id) == 3, "a daily room should count once per day")
_check(save.event_claimable(id), "event gift should be claimable")
_check(save.claim_event(id), "event gift should claim")
_check(save.claimed_event_frames().has(str(event.get("reward_frame", ""))), "event frame should unlock")
var cycle := int(event.get("cycle", 0))
save.data["events"] = {}
save.data["events"][id] = {"cycle": cycle - 1, "claimed": true, "progress": 3, "last_date": "old"}
save.save_game()
_check(not save.event_claimed(id), "event claim should reset on a new cycle")
save.data["completed_rooms"] = []
save.data["unlocked_guests"] = []
save.data["guest_notes"] = {}
save.save_game()
var campaign_board = save.load_board("campaign").duplicate(true)
main.show_screen("game", false)
await process_frame
main.game.start_free(1234)
await process_frame
_check(main.game.free_mode, "free play should start")
_check(main.game.levels.size() == 30, "free play should build 30 variants")
_check(bool(main.game.snapshot().get("free_mode", false)), "free snapshot should record the mode")
_check(save.load_board("campaign") == campaign_board, "free play should not overwrite the campaign board")
main.game._on_solved()
await process_frame
_check(save.rooms_completed() == 0, "free play should not write campaign progress")
_check(save.guest_visits("pepper") == 0, "free play should not write guest stories")
_check(main.game.win_next.text == "Next room", "free win should offer the next room")
main.game._on_undo()
# Returning to campaign after free play must clear the mode and record progress.
main.show_screen("home", false)
await process_frame
main.game.start_level(0, false, "")
await process_frame
_check(not main.game.free_mode, "campaign start should clear free mode")
_check(not bool(main.game.snapshot().get("free_mode", false)), "campaign snapshot should not be free")
main.game._on_solved()
await process_frame
_check(save.rooms_completed() == 1, "campaign win after free play should record progress")
main.game._on_undo()
func _restore_defaults(save) -> void:
save.reset_progress()
save.data["daily"] = save._default_daily()
@@ -433,6 +590,21 @@ func _restore_defaults(save) -> void:
save.set_setting("reduce_motion", false)
save.set_setting("hold_seconds", 0.35)
save.set_setting("double_tap_place", true)
save.set_setting("music", true)
save.set_setting("music_volume", 0.7)
save.set_setting("sfx", true)
save.set_setting("sfx_volume", 0.8)
save.set_setting("difficulty", "normal")
save.set_setting("ui_scale", 1.0)
save.set_setting("haptics", true)
save.data["avatar_id"] = "crumb"
save.data["guest_notes"] = {}
save.data["events"] = {}
save.set_player_name("Innkeeper")
save.data["achievements"] = {}
save.data["gift_claimed"] = []
save.data["saved_boards"] = {}
save.select_theme("cream")
save.save_game()
_check(save.rooms_completed() == 0, "save progress should be restored")
_check(save.daily_data() == save._default_daily(), "save daily should be restored")
+3 -3
View File
@@ -216,12 +216,12 @@ func _test_daily_and_frames(save, main) -> void:
func _test_save_defaults(save) -> void:
# A fresh save starts in double-tap mode at version 4.
# A fresh save starts in double-tap mode at version 7.
var abs_path := ProjectSettings.globalize_path(save.PATH)
if FileAccess.file_exists(save.PATH):
DirAccess.remove_absolute(abs_path)
save.load_game()
_check(int(save.data.get("version", 0)) == 4, "fresh saves should be version 4")
_check(int(save.data.get("version", 0)) == 7, "fresh saves should be version 7")
_check(bool(save.get_setting("double_tap_place")), "fresh saves should default to double-tap")
# A version 1 save with hold selected migrates to double-tap once.
@@ -233,7 +233,7 @@ func _test_save_defaults(save) -> void:
file.close()
save.load_game()
_check(int(save.data.get("version", 0)) == 4, "version 1 saves should migrate to version 4")
_check(int(save.data.get("version", 0)) == 7, "version 1 saves should migrate to version 7")
_check(bool(save.get_setting("double_tap_place")), "version 1 saves should migrate to double-tap")
@@ -0,0 +1,306 @@
{
"52:7": {
"inputs": {
"text": "",
"clip": [
"52:26",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"52:12": {
"inputs": {
"samples": [
"52:3",
0
],
"vae": [
"52:25",
2
]
},
"class_type": "VAEDecodeAudio",
"_meta": {
"title": "VAE Decode Audio"
}
},
"52:11": {
"inputs": {
"batch_size": 1,
"seconds": [
"52:36",
0
]
},
"class_type": "EmptyLatentAudio",
"_meta": {
"title": "Empty Latent Audio"
}
},
"52:3": {
"inputs": {
"seed": 880314725,
"steps": 8,
"cfg": 1,
"sampler_name": "lcm",
"scheduler": "simple",
"denoise": 1,
"model": [
"52:25",
0
],
"positive": [
"52:6",
0
],
"negative": [
"52:7",
0
],
"latent_image": [
"52:11",
0
]
},
"class_type": "KSampler",
"_meta": {
"title": "KSampler"
}
},
"52:29": {
"inputs": {
"clip_name": "qwen3.5_2b_bf16.safetensors",
"type": "stable_diffusion",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "Load CLIP"
}
},
"52:6": {
"inputs": {
"text": [
"52:34",
0
],
"clip": [
"52:26",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"52:34": {
"inputs": {
"switch": [
"52:35",
0
],
"on_false": [
"52:31",
0
],
"on_true": [
"52:28",
0
]
},
"class_type": "ComfySwitchNode",
"_meta": {
"title": "If/Else Switch"
}
},
"52:41": {
"inputs": {
"expression": "a",
"values.a": [
"52:36",
0
]
},
"class_type": "ComfyMathExpression",
"_meta": {
"title": "Math Expression"
}
},
"52:42": {
"inputs": {
"source": [
"52:41",
1
]
},
"class_type": "PreviewAny",
"_meta": {
"title": "Preview as Text"
}
},
"52:39": {
"inputs": {
"find": "USER_INPUT",
"string": [
"52:38",
0
],
"replace": [
"52:31",
0
]
},
"class_type": "StringReplace",
"_meta": {
"title": "Text Replace (USER INPUT)"
}
},
"52:28": {
"inputs": {
"max_length": 256,
"sampling_mode": "on",
"thinking": false,
"use_default_template": true,
"mtp": "auto",
"clip": [
"52:29",
0
],
"prompt": [
"52:40",
0
],
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"sampling_mode.min_p": 0.05,
"sampling_mode.repetition_penalty": 1.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.seed": 0
},
"class_type": "TextGenerateV2",
"_meta": {
"title": "Generate Text"
}
},
"52:31": {
"inputs": {
"value": "Instrumental-only cozy hotel lounge music: soft piano, brushed drums, upright bass, gentle vibraphone, warm dusty synth pad, light vinyl texture and a slow relaxed groove, cosy and nostalgic. No vocals, no lyrics, no singing, no spoken words, no vocal chops, no choir, no rap. BPM: 82. Length: 60 seconds."
},
"class_type": "PrimitiveStringMultiline",
"_meta": {
"title": "User: short description (USER_INPUT in template)"
}
},
"52:43": {
"class_type": "PrimitiveString",
"inputs": {
"value": "Music"
},
"_meta": {
"title": "Music category"
}
},
"52:49": {
"inputs": {
"json_string": "{\n \"Music\": \"You are an expert musician and musicologist and prompt engineer. Transform the user's input into a detailed, vivid music prompt for a full instrumental track.\\n\\n1. Start with the genre or style and optional adjectives (e.g., upbeat, dreamy, aggressive).\\n2. List the main instruments that define the track.\\n3. Add supporting elements or layers such as pads, harmonics, effects, or field recordings.\\n4. Include rhythm or percussion elements like drums, hi-hats, congas, brushes, or polyrhythms.\\n5. Integrate mood and energy naturally in the sentence (e.g., \\\"creating suspenseful tension\\\" or \\\"bright and uplifting\\\").\\n6. Specify the BPM.\\n7. Specify the track length as an integer in seconds. Use ranges: energetic/dance 120-180s, pop/rock 180-210s, cinematic/ambient 240-300s.\\n8. Combine all elements into one natural, fluid sentence. Avoid semicolons.\\n\\nTemplate:\\nGenre/Style with main instruments, supporting instruments/layers, and rhythm/percussion creating mood/energy. BPM: X. Length: Y seconds\\n\\nExamples:\\n- Jazz ballad with smooth saxophone lead, piano chords, upright bass, brushed drums, and soft strings that swing gently for a warm and cozy evening. BPM: 85. Length: 180 seconds\\n- EDM festival track with pulsing synth leads, plucked arpeggios, layered pads, side-chained bass, punchy kick and snare, and hi-hat rolls creating bright, energetic, and uplifting dance energy. BPM: 128. Length: 150 seconds\\n- Lo-fi hip-hop chill track with mellow electric piano, soft vinyl crackle, subtle synth pads, low-pass filtered drums, percussion loops, and soft plucked bass for a relaxed, dreamy vibe. BPM: 75. Length: 150 seconds\\n- Heavy metal anthem with distorted electric guitars, bass guitar, double bass drums, and cymbal crashes with fast palm-muted riffs creating intense, aggressive energy. BPM: 160. Length: 180 seconds\\n- Melancholic piano piece with soft piano lead, string pads, subtle atmospheric synths, and minimal brush percussion evoking a reflective rainy-day feeling. BPM: 60. Length: 240 seconds\\n- Suspenseful electronic thriller with pulsing bass synth, arpeggiated lead synth, cinematic pads, glitchy percussion, and high string stabs creating dark and tense energy. BPM: 100. Length: 200 seconds\\n- Dreamy ambient soundscape with layered pads, soft bell textures, gentle drones, and wind and water field recordings for ethereal and spacious meditation. BPM: 40. Length: 300 seconds\\n- Fingerpicking acoustic guitar solo with harmonics, subtle reverb, occasional shaker and soft stomp percussion, and soft pad layers for warm intimate storytelling. BPM: 70. Length: 120 seconds\\n- Synthwave 80s retro track with arpeggiated synth leads, analog pads, electric bass, punchy electronic drums, gated reverb snares, and atmospheric FX for nostalgic and vibrant energy. BPM: 110. Length: 180 seconds\\n- Tribal percussion ensemble with congas, djembes, bongos, shakers, and frame drums layered with deep synthetic sub-bass in complex polyrhythms. BPM: 100. Length: 140 seconds\\n- 1920s swing jazz with brass section, upright bass, piano, brushed drums, banjo, clarinet, and soft strings that swing lively for energetic dance vibes. BPM: 110. Length: 180 seconds\\n- Futuristic electronic sci-fi track with pulsing bass synth, evolving lead synths, layered pads, glitch percussion, robotic FX, and sub-bass for tense cinematic energy. BPM: 125. Length: 200 seconds\\n- Ambient underwater soundscape with flowing water textures, soft piano motifs, synth drones, distant bells, and underwater reverb for spacious meditative immersion. BPM: 45. Length: 300 seconds\\n- Horror cinematic track with dissonant strings, eerie piano stabs, cinematic percussion including taiko and low toms, and synth FX producing suspenseful creepy tension. BPM: 90. Length: 240 seconds\\n- Reggae track with offbeat guitar, warm basslines, snare, kick, congas, and horn stabs giving laid-back groovy energy. BPM: 85. Length: 150 seconds\\n- Blues track with soulful electric guitar solos, walking bass, piano, and shuffle drums creating expressive and emotive storytelling. BPM: 90. Length: 180 seconds\\n- Latin salsa with congas, timbales, horns, piano montunos, bass, and layered percussion for vibrant danceable energy. BPM: 120. Length: 210 seconds\\n- Afrobeat track with electric guitar stabs, horns, layered percussion, congas, shakers, bass groove, and synth pads for vibrant rhythmic energy. BPM: 105. Length: 200 seconds\\n- Indie rock track with electric guitar riffs, bass, live drum kit, layered synths, and subtle strings for energetic yet emotional feel. BPM: 110. Length: 180 seconds\\n- Funk groove with slap bass, electric guitar chords, brass stabs, drums, congas, and rhythmic keyboards creating high-energy danceable rhythm. BPM: 105. Length: 180 seconds\\n- Drum and bass track with fast breakbeat drums, deep sub-bass, sharp synth leads, pads, and atmospheric FX for high-energy club motion. Line truncated
"key": [
"52:43",
0
]
},
"class_type": "JsonExtractString",
"_meta": {
"title": "Extract Text from JSON"
}
},
"52:40": {
"inputs": {
"find": "AUDIO_LENGTH",
"string": [
"52:39",
0
],
"replace": [
"52:42",
0
]
},
"class_type": "StringReplace",
"_meta": {
"title": "Text Replace (AUDIO LENGTH)"
}
},
"52:38": {
"inputs": {
"string": "SYSTEM_PROMPTS\n\nInput: USER_INPUT\nTarget audio length: AUDIO_LENGTH seconds.\nOutput:",
"find": "SYSTEM_PROMPTS",
"replace": [
"52:49",
0
]
},
"class_type": "StringReplace",
"_meta": {
"title": "Text Replace (PROMPT TEMPLATE)"
}
},
"52:35": {
"inputs": {
"value": true
},
"class_type": "PrimitiveBoolean",
"_meta": {
"title": "Boolean (Enable_Reprompt)"
}
},
"52:36": {
"inputs": {
"value": 60.0
},
"class_type": "PrimitiveFloat",
"_meta": {
"title": "Float (Duration)"
}
},
"52:25": {
"inputs": {
"ckpt_name": "stable_audio_3_medium.safetensors"
},
"class_type": "CheckpointLoaderSimple",
"_meta": {
"title": "Load Checkpoint"
}
},
"52:26": {
"inputs": {
"clip_name": "t5gemma_b_b_ul2.safetensors",
"type": "stable_audio",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "Load CLIP"
}
},
"57": {
"inputs": {
"filename_prefix": "music/lounge_main",
"format": "mp3",
"audio": [
"52:12",
0
],
"format.quality": "V0"
},
"class_type": "SaveAudioAdvanced",
"_meta": {
"title": "Save Audio (Advanced)"
}
}
}