Compare commits

..
Author SHA1 Message Date
Ratdoku Builder f6fd807e9a v0.3.0-alpha: thirty rooms and unique guests
30 verified rooms with a unique guest head token per room, plus the level generator and tests.
2026-12-02 10:33:33 -06:00
16 changed files with 3051 additions and 1132 deletions

No files matched your search

+8
View File
@@ -2,6 +2,14 @@
All notable alpha milestones for Ratdoku.
## v0.3.0-alpha — Thirty Rooms & Unique Guests
- 30 verified 8×8 rooms: 20 guest rooms plus 10 bonus rooms.
- Unique guest head token per room on the board, deterministic per level.
- Rooms 21–30 reuse the 25-guest cast on the board without unlocking new Guest Book entries.
- Android debug APK rebuilt at version `0.3.0` (version code 3).
- Includes the level generator and smoke/UI tests under `tools/`.
## v0.2.0-alpha — Guest Book & House Rules
- 20 verified 8×8 rooms and the 25-guest cast.
+105 -12
View File
@@ -1,9 +1,7 @@
# Ratdoku — v0.2.0-alpha "Guest Book & House Rules"
# Ratdoku
A cozy rat-hotel logic puzzle. Every guest gets a room, a floor, a corridor, and a little space from the neighbours.
This alpha has **20 rooms**, 25 guests, the Guest Book, Settings, and House Rules. Every rat on the board still uses the shared Crumb head token; per-room guest tokens arrived in v0.3.
## Run it
1. Install **Godot 4.7 or newer** (standard edition, not .NET).
@@ -15,17 +13,24 @@ The project uses a portrait 720×1280 canvas, scaled to a 540×960 desktop windo
## How to play
- **Tap / left-click** a cell to mark it with an X. Tap an X or a guest to clear it.
- **Press and hold** (mobile) or **right-click** (PC) to check a guest in.
- **Press and hold** (mobile) or **right-click** (PC) to check a guest in. Hold or right-click a guest to check them out.
- A gold ring fills while you hold; at the hold threshold (default 0.35 s) the guest is placed.
- **Undo**, **Restart**, and **Hint** are at the bottom.
- A **gold ring** around a guest means they are already checked in and cannot be moved.
- Win when every room, floor, and corridor has exactly one rat and no two rats touch — even diagonally.
- **No guessing is required.** Every room has exactly one solution.
## Each room has its own guest
Every level assigns **eight distinct guests** to its eight coloured rooms. The guest is the same across the whole room, so a blue room is always one specific rat, the yellow room another, and so on. The assignment is deterministic per level, and a level never repeats a guest across two rooms.
The board uses circular **head tokens** from `art/guests/heads/`. Crumb remains the host and appears on Home and in the win overlay.
## Screens
- **Home** — Crumb, Check in, Guest Book, House Rules, Settings.
- **Game** — board, timer, undo/restart/hint, win overlay with the newly unlocked guest.
- **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a faint portrait under `???` and their room number.
- **Game** — board, timer, undo/restart/hint, win overlay.
- **The Guest Book** — 25 guests: five residents unlocked from the start, the other 20 unlocked one per room. Locked cards show a very faint portrait under `???` and their room number.
- **Settings** — region patterns, timer, reduce motion, hold-time slider, reset progress.
- **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board.
@@ -33,12 +38,13 @@ The project uses a portrait 720×1280 canvas, scaled to a 540×960 desktop windo
- **Residents** (available from the start): Miso, Hilde, Pip, Nana Fig, Biscuit.
- **Room guests**: Pepper (Room 1) through Marmalade (Room 20).
- **Rooms 21–30** are bonus rooms. They use the same guest cast on the board but do not unlock a new Guest Book entry.
- Completing a room unlocks its guest and adds a “New guest” card to the win overlay.
- Crumb is the host and has a pinned card; she is not one of the 25.
## Levels
`data/levels.json` contains **20 verified 8×8 puzzles**. Every board is generated from a legal solution, split into eight connected rooms, and checked for a single solution. Each starts with three gold-ringed guests.
`data/levels.json` contains **30 verified 8×8 puzzles**: 20 guest rooms plus 10 bonus rooms. Every board is generated from a legal solution, split into eight connected rooms, and checked for a single solution. Each starts with three gold-ringed guests.
## Project layout
@@ -55,7 +61,7 @@ scripts/
Main.gd navigation/back stack
Home.gd home screen
Game.gd level flow, timer, unlock flow, win overlay
Board.gd drawing, input, undo, hints, settings
Board.gd drawing, input, undo, hints, per-room guests, settings
Rules.gd pure win/conflict rules
Levels.gd JSON level loader
Guests.gd guest manifest loader
@@ -69,25 +75,112 @@ scripts/
RatPortrait.gd fallback vector mascot
art/
crumb.png full mascot
crumb_head.png circular head token
crumb_head.png circular head token used on Home/win
guests/
cards/<id>.png 512 detail portraits
thumbs/<id>.png 256 gallery thumbnails
heads/<id>.png 256 circular board tokens
source/ 1024 originals, raw renders, contact sheets (ignored by Godot/export)
data/
levels.json 20 verified 8×8 puzzles
levels.json 30 verified 8×8 puzzles
guests.json 25 guest entries
tutorial.json 5×5 practice puzzle
tools/
generate_levels.gd headless 8×8 generator (appends new rooms)
smoke_test.gd rules/board smoke test
ui_test.gd settings/gallery/unlock/tutorial test
screenshot.gd dev screenshots
build_android.ps1 Android export helper
workflows/ Krea2 guest-generation variants
export_presets.cfg Android debug preset
build/Ratdoku-v0.3.0-alpha.apk installable debug APK
```
## Save data
`user://ratdoku_save.json` stores completed rooms, unlocked guests, `last_room`, and settings. “Reset progress” clears rooms and unlocks but keeps settings.
## Regenerate levels
```powershell
& "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe" `
--headless --path . --script res://tools/generate_levels.gd
```
The generator appends until `data/levels.json` contains 30 rooms. It keeps the existing pack and only creates the missing rooms.
## Guest art
The 25 guest portraits were generated from the `Krea2_Turbo_Uncensored` ComfyUI workflow with a shared chibi/gouache prompt and per-character props. The final prompt variants are in `tools/workflows/final_guests/`.
Runtime assets:
- `art/guests/heads/<id>.png` — board tokens
- `art/guests/cards/<id>.png` — detail portraits
- `art/guests/thumbs/<id>.png` — gallery thumbnails
Source 1024 renders and contact sheets live in `art/guests/source/` and are excluded from the Android export.
## Android APK
`build/Ratdoku-v0.2.0-alpha.apk` is a debug-signed, arm64-v8a build:
The current APK is:
```
build/Ratdoku-v0.3.0-alpha.apk
```
It is a **debug-signed, arm64-v8a** APK:
- Package: `com.ratdoku.game`
- Version: `0.2.0` (version code 2)
- Version: `0.3.0` (version code 3)
- Min SDK: 24 (Android 7.0)
- Target SDK: 36
- Size: about 41 MB
- Portrait orientation
To install, copy the APK to the phone, open it, and allow “Install unknown apps” for the file manager/browser. Or with a USB-connected phone and USB debugging:
```powershell
& "E:\AndroidTools\sdk\platform-tools\adb.exe" install -r "build\Ratdoku-v0.3.0-alpha.apk"
```
### Toolchain
The local Android build uses:
- JDK: `E:\AndroidTools\jdk-17.0.21.1+2`
- Android SDK: `E:\AndroidTools\sdk`
- Build tools: `35.0.0`
- Godot editor settings: `export/android/android_sdk_path`, `java_sdk_path`, debug keystore.
Rebuild with:
```powershell
.\tools\build_android.ps1
```
If you want a Play Store build, switch `gradle_build/export_format` to AAB, use a release keystore, and set `package/signed` appropriately. The current APK is for direct testing, not store upload.
## Tests
```powershell
& "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe" `
--headless --path . --script res://tools/smoke_test.gd
```
```powershell
& "C:\Program Files (x86)\Steam\steamapps\common\Godot Engine\godot.windows.opt.tools.64.exe" `
--headless --path . --script res://tools/ui_test.gd
```
`ui_test.gd` checks settings propagation, room-1 → Pepper unlock, gallery progress, and the interactive 5×5 tutorial. Both tests reset the save when they finish.
## Current scope
- 30 verified 8×8 rooms (20 guest rooms + 10 bonus)
- Unique guest per room per level
- Interactive 5×5 tutorial
- 25 guest portraits + Crumb
- Settings, gallery, rulebook, unlock flow
- Installable Android debug APK
- No audio yet, no daily puzzle, no release keystore/AAB yet
+2211 -1111
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -9,7 +9,7 @@ custom_features=""
export_filter="all_resources"
include_filter="data/*.json"
exclude_filter="art/guests/source/*"
export_path="build/Ratdoku-v0.2.0-alpha.apk"
export_path="build/Ratdoku-v0.3.0-alpha.apk"
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
@@ -32,8 +32,8 @@ architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=2
version/name="0.2.0"
version/code=3
version/name="0.3.0"
package/unique_name="com.ratdoku.game"
package/name="Ratdoku"
package/signed=true
+1 -1
View File
@@ -12,7 +12,7 @@ config_version=5
config/name="Ratdoku"
run/main_scene="res://scenes/Main.tscn"
config/version="0.2.0-alpha"
config/version="0.3.0-alpha"
config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.png"
-5
View File
@@ -249,11 +249,6 @@ func _draw_x(rect: Rect2, color: Color) -> void:
func _assign_region_rats() -> void:
# v0.2.0-alpha: no per-room guest tokens yet. Leave the table empty so every
# rat on the board falls back to the shared Crumb head token.
if true:
return
region_rats.clear()
region_textures.clear()
+25
View File
@@ -0,0 +1,25 @@
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]$Out = "build/Ratdoku.apk"
)
$ErrorActionPreference = "Stop"
$project = Split-Path $PSScriptRoot -Parent
$env:JAVA_HOME = $Jdk
$env:ANDROID_HOME = $Sdk
$env:ANDROID_SDK_ROOT = $Sdk
$env:Path = "$Jdk\bin;$Sdk\platform-tools;$Sdk\build-tools\35.0.0;$env:Path"
New-Item -ItemType Directory -Force -Path (Join-Path $project "build") | Out-Null
Write-Host "Exporting $Out ..."
& $Godot --headless --path $project --export-debug "Android" $Out
$apk = Join-Path $project $Out
if (Test-Path $apk) {
Get-Item $apk | Select-Object FullName, Length, LastWriteTime
} else {
throw "Export did not produce $apk"
}
+359
View File
@@ -0,0 +1,359 @@
extends SceneTree
## Headless puzzle generator.
## Run from the project folder:
## <godot> --headless --script res://tools/generate_levels.gd
##
## Writes data/levels.json.
##
## How it works:
## 1. Pick a legal solution (one rat per row and column, none touching).
## 2. Grow eight connected rooms around those eight rats.
## 3. Ask the solver for alternate solutions.
## 4. If the board is ambiguous, pin down a few of the intended rats as
## "already checked in" clues until the solution is unique.
##
## Clues are capped at three. If a board needs more than that, it is rejected
## and we start over. A later version can replace clues with room-shape
## refinement, but for the prototype this keeps every puzzle provably unique.
const N := 8
const COUNT := 30
const MAX_CLUES := 3
const OUT := "res://data/levels.json"
const DIRS := [Vector2i(1, 0), Vector2i(-1, 0), Vector2i(0, 1), Vector2i(0, -1)]
var _n := 0
var _regions: Array = []
var _cap := 2
var _found: Array = []
var _used_cols := {}
var _used_regions := {}
var _clue_cols := {}
func _init() -> void:
var rng := RandomNumberGenerator.new()
rng.seed = 20261201
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path("res://data"))
var levels: Array = []
var attempts := 0
var rejected_ambiguous := 0
var rejected_shape := 0
# Append to an existing pack instead of replacing it.
if FileAccess.file_exists(OUT):
var existing := FileAccess.open(OUT, FileAccess.READ)
if existing != null:
var parsed = JSON.parse_string(existing.get_as_text())
existing.close()
if typeof(parsed) == TYPE_ARRAY:
levels = parsed
var starting_count := levels.size()
print("Existing levels: %d, target: %d" % [starting_count, COUNT])
while levels.size() < COUNT and attempts < 60000:
attempts += 1
var sol := _sample_solution(rng)
if sol.is_empty():
continue
var regs := _grow_regions(sol, rng)
if regs.is_empty():
continue
if not _shape_ok(regs, sol):
rejected_shape += 1
continue
var clues = _find_clue_set(regs, sol, MAX_CLUES)
if clues == null:
rejected_ambiguous += 1
continue
if typeof(clues) != TYPE_ARRAY:
rejected_ambiguous += 1
continue
levels.append({
"id": "room-%02d" % (levels.size() + 1),
"n": N,
"regions": regs,
"solution": sol,
"clues": clues,
})
if levels.size() % 5 == 0:
print("Accepted %d rooms after %d attempts." % [levels.size(), attempts])
var file := FileAccess.open(OUT, FileAccess.WRITE)
if file == null:
push_error("Could not write %s" % OUT)
quit(1)
return
file.store_string(JSON.stringify(levels, "\t"))
file.close()
print("Generated %d levels in %d attempts -> %s" % [levels.size(), attempts, OUT])
print("New rooms this run: %d" % (levels.size() - starting_count))
print("Rejects: shape=%d ambiguous=%d" % [rejected_shape, rejected_ambiguous])
quit()
func _sample_solution(rng: RandomNumberGenerator) -> Array:
for attempt in range(600):
var cols := []
for i in N:
cols.append(i)
_shuffle(cols, rng)
var ok := true
for i in range(N - 1):
if abs(int(cols[i + 1]) - int(cols[i])) < 2:
ok = false
break
if ok:
return cols
return []
func _grow_regions(sol: Array, rng: RandomNumberGenerator) -> Array:
var regions := []
for r in N:
var row := []
for c in N:
row.append(-1)
regions.append(row)
var sizes := []
for i in N:
sizes.append(1)
for r in N:
regions[r][int(sol[r])] = r
var remaining := N * N - N
var guard := 0
while remaining > 0 and guard < 4000:
guard += 1
var order := []
for i in N:
order.append(i)
_shuffle(order, rng)
for region in order:
var candidates := _frontier(regions, region)
if candidates.is_empty():
continue
var pick: Vector2i = candidates[rng.randi_range(0, candidates.size() - 1)]
regions[pick.x][pick.y] = region
sizes[region] += 1
remaining -= 1
# Fill any enclosed pocket with its smallest neighbouring region.
var progress := true
while remaining > 0 and progress:
progress = false
for r in N:
for c in N:
if int(regions[r][c]) != -1:
continue
var neighbours := {}
for d in DIRS:
var nr: int = r + d.x
var nc: int = c + d.y
if nr >= 0 and nr < N and nc >= 0 and nc < N and int(regions[nr][nc]) >= 0:
neighbours[int(regions[nr][nc])] = true
if neighbours.is_empty():
continue
var best := -1
var best_size := 9999
for reg in neighbours.keys():
if int(sizes[reg]) < best_size:
best_size = int(sizes[reg])
best = int(reg)
regions[r][c] = best
sizes[best] += 1
remaining -= 1
progress = true
if remaining != 0:
return []
return regions
func _frontier(regions: Array, region: int) -> Array:
var out: Array[Vector2i] = []
for r in N:
for c in N:
if int(regions[r][c]) != region:
continue
for d in DIRS:
var nr: int = r + d.x
var nc: int = c + d.y
if nr >= 0 and nr < N and nc >= 0 and nc < N and int(regions[nr][nc]) == -1:
var cell := Vector2i(nr, nc)
if not out.has(cell):
out.append(cell)
return out
func _sizes(regions: Array) -> Array:
var sizes := []
for i in N:
sizes.append(0)
for r in N:
for c in N:
var region := int(regions[r][c])
if region >= 0:
sizes[region] += 1
return sizes
func _shape_ok(regions: Array, sol: Array) -> bool:
var sizes := _sizes(regions)
var total := 0
for s in sizes:
if int(s) < 3 or int(s) > 18:
return false
total += int(s)
var mean := float(total) / float(N)
for s in sizes:
if float(s) / mean > 2.4:
return false
var seeds := {}
for r in N:
var reg := int(regions[r][int(sol[r])])
if seeds.has(reg):
return false
seeds[reg] = true
return seeds.size() == N
func _find_clue_set(regions: Array, sol: Array, max_clues: int) -> Variant:
# Prefer zero clues, then one, then two, then three.
if _find_solutions(regions, [], 2).size() == 1:
return []
if max_clues >= 1:
for r1 in N:
var one := [[r1, int(sol[r1])]]
if _find_solutions(regions, one, 2).size() == 1:
return one
if max_clues >= 2:
for r1 in N:
for r2 in range(r1 + 1, N):
var two := [[r1, int(sol[r1])], [r2, int(sol[r2])]]
if _find_solutions(regions, two, 2).size() == 1:
return two
if max_clues >= 3:
for r1 in N:
for r2 in range(r1 + 1, N):
for r3 in range(r2 + 1, N):
var three := [[r1, int(sol[r1])], [r2, int(sol[r2])], [r3, int(sol[r3])]]
if _find_solutions(regions, three, 2).size() == 1:
return three
return null
func _find_solutions(regions: Array, clues: Array, cap: int) -> Array:
_regions = regions
_n = N
_cap = cap
_found = []
_used_cols = {}
_used_regions = {}
_clue_cols = {}
for clue in clues:
_clue_cols[int(clue[0])] = int(clue[1])
_collect(0, -1, [])
return _found
func _collect(row: int, prev_col: int, current: Array) -> void:
if _found.size() >= _cap:
return
if row == _n:
_found.append(current.duplicate())
return
if _clue_cols.has(row):
var fixed_col := int(_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(_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 _used_cols.has(c):
return false
var region := int(_regions[row][c])
if _used_regions.has(region):
return false
if row > 0 and abs(c - prev_col) < 2:
return false
return true
func _place(row: int, c: int) -> void:
_used_cols[c] = true
_used_regions[int(_regions[row][c])] = true
func _unplace(row: int, c: int) -> void:
_used_cols.erase(c)
_used_regions.erase(int(_regions[row][c]))
func _same_solution(a: Array, b: Array) -> bool:
for i in N:
if int(a[i]) != int(b[i]):
return false
return true
func _alternate(solutions: Array, intended: Array) -> Array:
for candidate in solutions:
var same := true
for i in N:
if int(candidate[i]) != int(intended[i]):
same = false
break
if not same:
return candidate
return []
func _shuffle(arr: Array, rng: RandomNumberGenerator) -> void:
for i in range(arr.size() - 1, 0, -1):
var j := rng.randi_range(0, i)
var tmp = arr[i]
arr[i] = arr[j]
arr[j] = tmp
+1
View File
@@ -0,0 +1 @@
uid://oy3sanp8disa
+84
View File
@@ -0,0 +1,84 @@
extends SceneTree
## Development helper: boots the game, saves one screenshot per screen, quits.
## Run without --headless:
## <godot> --path . --script res://tools/screenshot.gd
func _init() -> void:
call_deferred("_run")
func _run() -> void:
var err := change_scene_to_file("res://scenes/Main.tscn")
if err != OK:
print("Could not load Main.tscn: ", err)
quit(1)
return
await process_frame
await process_frame
await RenderingServer.frame_post_draw
_save("res://screenshots/home.png")
var main = current_scene
_reset_save()
main.show_screen("guest_book")
await _settle()
_save("res://screenshots/guest_book.png")
main.show_screen("settings")
await _settle()
_save("res://screenshots/settings.png")
main.show_screen("rules")
await _settle()
_save("res://screenshots/rules.png")
var scrolls = main.rulebook.find_children("*", "ScrollContainer", true, false)
if scrolls.size() > 0:
scrolls[0].scroll_vertical = 1400
await _settle()
_save("res://screenshots/rules_tutorial.png")
main.show_screen("game")
main.game.start_level(0)
await _settle()
_save("res://screenshots/game.png")
var game = main.game
for i in range(12):
if game.win_shown:
break
game.board.hint()
await process_frame
await create_timer(0.8).timeout
await RenderingServer.frame_post_draw
_save("res://screenshots/win.png")
_reset_save()
quit()
func _reset_save() -> void:
var save = root.get_node_or_null("SaveGame")
if save != null:
save.reset_progress()
func _settle() -> void:
await process_frame
await process_frame
await RenderingServer.frame_post_draw
func _save(path: String) -> void:
var image := root.get_texture().get_image()
if image == null:
print("No viewport image yet.")
return
var absolute := ProjectSettings.globalize_path(path)
DirAccess.make_dir_recursive_absolute(absolute.get_base_dir())
image.save_png(absolute)
print("Saved %s (%dx%d)" % [absolute, image.get_width(), image.get_height()])
+1
View File
@@ -0,0 +1 @@
uid://dew8388i54gfs
+165
View File
@@ -0,0 +1,165 @@
extends SceneTree
## Headless smoke test for the rules and the board's public-ish operations.
## <godot> --headless --path . --script res://tools/smoke_test.gd
var solved_flag := false
func _init() -> void:
call_deferred("_run")
func _run() -> void:
var levels: Array = Levels.load_all()
if levels.is_empty():
print("FAIL: no levels")
quit(1)
return
var board := Board.new()
root.add_child(board)
board.size = Vector2(640, 640)
board.solved.connect(_on_solved)
var all_ok := true
for i in levels.size():
var level: Dictionary = levels[i]
board.set_level(level)
solved_flag = false
var fixed_count: int = board.fixed.size()
var seen := {}
for r in board.n:
var c := int(level["solution"][r])
var cell := Vector2i(r, c)
if board.fixed.has(cell):
continue
# Check the guest in directly.
board._toggle_rat(cell)
seen[cell] = true
var valid: bool = Rules.is_valid(board.cells, board.regions)
var rats: int = Rules.count_rats(board.cells)
var conflicts: int = board.conflict_cells.size()
if not valid or rats != board.n or conflicts != 0 or not solved_flag:
all_ok = false
print("FAIL %s: valid=%s rats=%d/%d conflicts=%d solved=%s fixed=%d" % [
level["id"], valid, rats, board.n, conflicts, solved_flag, fixed_count
])
# Undo / restart / hint on the first level.
var first: Dictionary = levels[0]
board.set_level(first)
var before: int = Rules.count_rats(board.cells)
var target := _first_empty_solution(board, first)
if target.x >= 0:
board._toggle_rat(target)
var placed: int = Rules.count_rats(board.cells)
board.undo()
var undone: int = Rules.count_rats(board.cells)
if placed != before + 1 or undone != before:
all_ok = false
print("FAIL undo: before=%d placed=%d undone=%d" % [before, placed, undone])
board.set_level(first)
if target.x >= 0:
board._toggle_rat(target)
board.restart()
if Rules.count_rats(board.cells) != board.fixed.size():
all_ok = false
print("FAIL restart: rats=%d fixed=%d" % [Rules.count_rats(board.cells), board.fixed.size()])
board.set_level(first)
solved_flag = false
var guard := 0
while guard < 12:
guard += 1
if not board.hint():
break
if not solved_flag:
all_ok = false
print("FAIL hint: board not solved after %d hints" % guard)
# Coordinate mapping: the centre of a cell must map back to that cell.
board.size = Vector2(640, 640)
board._update_layout()
var mapped: Vector2i = board._pos_to_cell(board._cell_rect(3, 4).get_center())
if mapped != Vector2i(3, 4):
all_ok = false
print("FAIL mapping: expected (3,4), got %s" % str(mapped))
# Tap marks X, right-click checks in, and hold checks in without a tap.
board.set_level(first)
board._update_layout()
var tap_cell := _find_empty_cell(board)
if tap_cell.x >= 0:
_left_click(board, tap_cell, true)
_left_click(board, tap_cell, false)
if int(board.cells[tap_cell.x][tap_cell.y]) != Board.X:
all_ok = false
print("FAIL tap: expected X, got %d" % int(board.cells[tap_cell.x][tap_cell.y]))
_right_click(board, tap_cell)
if int(board.cells[tap_cell.x][tap_cell.y]) != Board.RAT:
all_ok = false
print("FAIL right-click: expected RAT, got %d" % int(board.cells[tap_cell.x][tap_cell.y]))
board.set_level(first)
board._update_layout()
var hold_cell := _find_empty_cell(board)
if hold_cell.x >= 0:
_left_click(board, hold_cell, true)
board._process(board.hold_seconds + 0.05)
if int(board.cells[hold_cell.x][hold_cell.y]) != Board.RAT:
all_ok = false
print("FAIL hold: expected RAT, got %d" % int(board.cells[hold_cell.x][hold_cell.y]))
_left_click(board, hold_cell, false)
if int(board.cells[hold_cell.x][hold_cell.y]) != Board.RAT:
all_ok = false
print("FAIL hold release: guest was removed")
print("SMOKE TEST: %s" % ("PASS" if all_ok else "FAIL"))
quit(0 if all_ok else 1)
func _on_solved() -> void:
solved_flag = true
func _find_empty_cell(board: Board) -> Vector2i:
for r in board.n:
for c in board.n:
var cell := Vector2i(r, c)
if board.fixed.has(cell):
continue
if int(board.cells[r][c]) == Board.EMPTY and not board.auto_x[r][c]:
return cell
return Vector2i(-1, -1)
func _left_click(board: Board, cell: Vector2i, pressed: bool) -> void:
var event := InputEventMouseButton.new()
event.button_index = MOUSE_BUTTON_LEFT
event.pressed = pressed
event.position = board._cell_rect(cell.x, cell.y).get_center()
board._gui_input(event)
func _right_click(board: Board, cell: Vector2i) -> void:
var event := InputEventMouseButton.new()
event.button_index = MOUSE_BUTTON_RIGHT
event.pressed = true
event.position = board._cell_rect(cell.x, cell.y).get_center()
board._gui_input(event)
func _first_empty_solution(board: Board, level: Dictionary) -> Vector2i:
for r in board.n:
var cell := Vector2i(r, int(level["solution"][r]))
if not board.fixed.has(cell):
return cell
return Vector2i(-1, -1)
+1
View File
@@ -0,0 +1 @@
uid://dfbmnhb4buk40
+85
View File
@@ -0,0 +1,85 @@
extends SceneTree
## Headless UI/save integration test.
## <godot> --headless --path . --script res://tools/ui_test.gd
var failures := 0
func _init() -> void:
call_deferred("_run")
func _check(condition: bool, message: String) -> void:
if not condition:
failures += 1
print("FAIL: ", message)
func _run() -> void:
var err := change_scene_to_file("res://scenes/Main.tscn")
if err != OK:
print("FAIL: could not load Main")
quit(1)
return
await process_frame
await process_frame
var main = current_scene
var save = root.get_node_or_null("SaveGame")
_check(save != null, "SaveGame autoload missing")
if save == null:
quit(1)
return
save.reset_progress()
main.game.start_level(0)
await process_frame
save.set_setting("patterns", false)
_check(not main.game.board.show_patterns, "patterns setting did not reach Board")
save.set_setting("patterns", true)
_check(main.game.board.show_patterns, "patterns setting did not restore")
save.set_setting("show_timer", false)
main.show_screen("game")
await process_frame
_check(not main.game.timer_label.visible, "show_timer setting did not hide timer")
save.set_setting("show_timer", true)
save.set_setting("hold_seconds", 0.50)
_check(abs(main.game.board.hold_seconds - 0.50) < 0.001, "hold_seconds did not reach Board")
save.set_setting("hold_seconds", 0.35)
var unlocked: String = save.complete_room("room-01", 1)
_check(unlocked == "pepper", "room 1 should unlock Pepper")
_check(save.is_guest_unlocked("pepper"), "Pepper should be unlocked")
_check(save.is_guest_unlocked("miso"), "Miso should be unlocked as a resident")
main.show_screen("guest_book")
await process_frame
await process_frame
_check(main.guest_book != null, "Guest Book missing")
if main.guest_book != null and main.guest_book.progress_label != null:
_check(main.guest_book.progress_label.text.find("6 of 25") >= 0, "Guest Book progress should be 6 of 25")
main.show_screen("rules")
await process_frame
var tutorial_board = main.rulebook.tutorial_board
_check(tutorial_board != null, "Tutorial board missing")
if tutorial_board != null:
for i in range(8):
tutorial_board.hint()
await process_frame
_check(Rules.is_valid(tutorial_board.cells, tutorial_board.regions), "Tutorial puzzle did not solve")
save.reset_progress()
save.set_setting("patterns", true)
save.set_setting("show_timer", true)
save.set_setting("reduce_motion", false)
save.set_setting("hold_seconds", 0.35)
print("UI TEST: ", "PASS" if failures == 0 else "FAIL (%d)" % failures)
quit(0 if failures == 0 else 1)
+1
View File
@@ -0,0 +1 @@
uid://ccl6uk1425kix
+1
View File
@@ -0,0 +1 @@
{"id":"08988737-a544-4ab1-99fb-22d67b7c36e3","revision":0,"last_node_id":52,"last_link_id":85,"nodes":[{"id":29,"type":"SaveImage","pos":[521.2820256118092,-86.65135385501759],"size":[879.953125,1019.953125],"flags":{},"order":5,"mode":0,"inputs":[{"localized_name":"images","name":"images","type":"IMAGE","link":44},{"localized_name":"filename_prefix","name":"filename_prefix","type":"STRING","widget":{"name":"filename_prefix"},"link":null}],"outputs":[{"localized_name":"images","name":"images","type":"IMAGE","links":null}],"properties":{"Node name for S&R":"SaveImage","cnr_id":"comfy-core","ver":"0.25.0"},"widgets_values":["Krea2_turbo"],"widgets_values_named":{"filename_prefix":"Krea2_turbo"}},{"id":30,"type":"b0e5ca93-2731-42b9-8e0a-d28ea851ff81","pos":[-140,-110],"size":[559.953125,1009.953125],"flags":{},"order":4,"mode":0,"inputs":[{"label":"prompt","name":"value","type":"STRING","widget":{"name":"value"},"link":null},{"label":"prompt_enhance","name":"value_1","type":"BOOLEAN","widget":{"name":"value_1"},"link":null},{"label":"LLM_max_token","name":"max_length","type":"INT","widget":{"name":"max_length"},"link":null},{"label":"LLM_thinking_mode","name":"thinking","shape":7,"type":"BOOLEAN","widget":{"name":"thinking"},"link":null},{"label":"width","name":"width_1","type":"INT","widget":{"name":"width_1"},"link":84},{"label":"height","name":"height_1","type":"INT","widget":{"name":"height_1"},"link":85},{"label":"seed","name":"seed_1","type":"INT","widget":{"name":"seed_1"},"link":null},{"label":"enable_lora","name":"value_3","type":"BOOLEAN","widget":{"name":"value_3"},"link":null},{"label":"lora_name","name":"lora_name_1","type":"COMBO","widget":{"name":"lora_name_1"},"link":null},{"label":"lora_strength","name":"strength_model_1","type":"FLOAT","widget":{"name":"strength_model_1"},"link":null},{"label":"lora_trigger_word","name":"string_b_1","type":"STRING","widget":{"name":"string_b_1"},"link":null},{"label":"unet_name","name":"unet_name_1","type":"COMBO","widget":{"name":"unet_name_1"},"link":null},{"label":"clip_name","name":"clip_name_1","type":"COMBO","widget":{"name":"clip_name_1"},"link":null},{"label":"vae_name","name":"vae_name_1","type":"COMBO","widget":{"name":"vae_name_1"},"link":null}],"outputs":[{"localized_name":"IMAGE","name":"IMAGE","type":"IMAGE","links":[44]}],"properties":{"cnr_id":"comfy-core","ver":"0.25.0","previewExposures":[{"name":"$$canvas-image-preview","sourceNodeId":"3","sourcePreviewName":"$$canvas-image-preview"}]},"widgets_values":["A cozy children's-book character illustration of Crumb, a round dumbo-eared fancy rat innkeeper. Plump pear-shaped body, soft fawn-and-cream hooded fur, huge low-set round ears, tiny pink paws, long delicate whiskers, bright curious eyes, one small notch in her left ear. She wears a tiny flour-dusted linen apron with a cheese-wedge pocket and holds a little clipboard. Standing three-quarter view, full body, centered, friendly slightly flustered expression. Hand-painted gouache texture, visible soft brush strokes, warm cream, ochre and dusty rose palette, gentle rim light, soft contact shadow, plain warm cream background, clean sticker-like silhouette, no text, no logo, 1:1.\n\n",false,512,false,1024,1024,107158940777715,true,"krea2_refusal_compact.safetensors",0.8,"","krea2_turbo_int8_convrot.safetensors","qwen3vl_4b_fp8_scaled.safetensors","qwen_image_vae.safetensors"],"widgets_values_named":{"value":"A cozy children's-book character illustration of Crumb, a round dumbo-eared fancy rat innkeeper. Plump pear-shaped body, soft fawn-and-cream hooded fur, huge low-set round ears, tiny pink paws, long delicate whiskers, bright curious eyes, one small notch in her left ear. She wears a tiny flour-dusted linen apron with a cheese-wedge pocket and holds a little clipboard. Standing three-quarter view, full body, centered, friendly slightly flustered expression. Hand-painted gouache texture, visible soft brush strokes, warm cream, ochre and dusty rose palette, gentle rim light, soft contact shadow, plain warm cream background, clean sticker-like silhouette, no text, no logo, 1:1.\n\n","value_1":false,"max_length":512,"thinking":false,"width_1":1024,"height_1":1024,"seed_1":107158940777715,"value_3":true,"lora_name_1":"krea2_refusal_compact.safetensors","strength_model_1":0.8,"string_b_1":"","unet_name_1":"krea2_turbo_int8_convrot.safetensors","clip_name_1":"qwen3vl_4b_fp8_scaled.safetensors","vae_name_1":"qwen_image_vae.safetensors"}},{"id":47,"type":"MarkdownNote","pos":[-1200,970],"size":[689.953125,509.953125],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[],"title":"LoRA Trigger Words and Settings","properties":{},"widgets_values":["## Model Links\n\n- [Hugging Face:Comfy-Org/Krea-2](https://huggingface.co/Comfy-Org/Krea-2)\n- [ModelScope:Comfy-Org/Krea-2](https://modelscope.cn/models/Comfy-Org/Krea-2)\n\nDownload the style LoRAs used in this workflow from [Comfy-Org/Krea-2/loras](https://huggingface.co/Comfy-Org/Krea-2/tree/main/loras).Line truncated