v0.2.0-alpha: Guest Book and House Rules

Adds the Guest Book, Settings, House Rules, and guest unlocks on the 20-room board. Rats still use the shared Crumb token.
This commit is contained in:
Ratdoku Builder committed 2026-12-02 10:32:45 -06:00
1 parent f4b4a773f3
commit e532f2a0cb
19 files changed
+905 -34

No files matched your search

+9
View File
@@ -2,6 +2,15 @@
All notable alpha milestones for Ratdoku.
## v0.2.0-alpha — Guest Book & House Rules
- 20 verified 8×8 rooms and the 25-guest cast.
- Guest Book gallery with five residents unlocked from the start and one guest unlocked per room.
- Settings screen: region patterns, timer, reduce motion, hold-time slider, reset progress.
- House Rules screen with illustrated rules, controls, tips, FAQ, and a 5×5 practice board.
- Win overlay shows the newly unlocked guest.
- Rats still use the shared Crumb head token; per-room guest tokens were not in this build.
## v0.1.0-alpha — First playable
- 20 verified 8×8 rooms.
+51 -27
View File
@@ -1,8 +1,8 @@
# Ratdoku — v0.1.0-alpha "First playable"
# Ratdoku — v0.2.0-alpha "Guest Book & House Rules"
A cozy rat-hotel logic puzzle. Every guest gets a room, a floor, a corridor, and a little space from the neighbours.
This is the reconstructed first playable alpha: **20 rooms**, the Crumb head token on the board, and the core Home → Game loop. The Guest Book, Settings, and House Rules screens did not exist yet.
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
@@ -21,49 +21,73 @@ The project uses a portrait 720×1280 canvas, scaled to a 540×960 desktop windo
- 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.
Every rat uses Crumb's head token in this alpha; per-room guest tokens arrived with the Guest Book.
## 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.
- **Settings** — region patterns, timer, reduce motion, hold-time slider, reset progress.
- **House Rules** — four illustrated rules, controls, tips, FAQ, and an interactive 5×5 practice board.
## Unlocks
- **Residents** (available from the start): Miso, Hilde, Pip, Nana Fig, Biscuit.
- **Room guests**: Pepper (Room 1) through Marmalade (Room 20).
- 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**, each starting with three gold-ringed guests.
`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.
## Project layout
```
scenes/
Main.tscn entry point + screen navigation
Home.tscn title screen
Game.tscn board screen + HUD + win overlay
Board.tscn custom-drawn board
Main.tscn entry point + screen navigation
Home.tscn title screen
Game.tscn board screen + HUD + win overlay
Board.tscn custom-drawn board
GuestBook.tscn gallery
Settings.tscn settings
Rulebook.tscn house rules + interactive tutorial
scripts/
Main.gd navigation/back stack
Home.gd home screen
Game.gd level flow, timer, win overlay
Board.gd drawing, input, undo, hints
Rules.gd pure win/conflict rules
Levels.gd JSON level loader
Guests.gd guest manifest loader
SaveGame.gd autoload: settings + progress
Palette.gd colours
UI.gd button/label/panel helpers
RatPortrait.gd fallback vector mascot
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
Rules.gd pure win/conflict rules
Levels.gd JSON level loader
Guests.gd guest manifest loader
SaveGame.gd autoload: settings + progress
GuestBook.gd gallery, locked cards, detail sheet
Settings.gd settings toggles + reset
Rulebook.gd handbook content + 5×5 tutorial
MiniDiagram.gd rule illustrations
Palette.gd colours
UI.gd button/label/panel helpers
RatPortrait.gd fallback vector mascot
art/
crumb.png, crumb_head.png
guests/{cards,thumbs,heads}/<id>.png
crumb.png full mascot
crumb_head.png circular head token
guests/
cards/<id>.png 512 detail portraits
thumbs/<id>.png 256 gallery thumbnails
heads/<id>.png 256 circular board tokens
data/
levels.json 20 verified 8×8 puzzles
guests.json 25 guest entries
tutorial.json 5×5 practice puzzle
levels.json 20 verified 8×8 puzzles
guests.json 25 guest entries
tutorial.json 5×5 practice puzzle
```
## Save data
`user://ratdoku_save.json` stores completed rooms, `last_room`, and settings.
`user://ratdoku_save.json` stores completed rooms, unlocked guests, `last_room`, and settings. “Reset progress” clears rooms and unlocks but keeps settings.
## Android APK
`build/Ratdoku-v0.1.0-alpha.apk` is a debug-signed, arm64-v8a build:
`build/Ratdoku-v0.2.0-alpha.apk` is a debug-signed, arm64-v8a build:
- Package: `com.ratdoku.game`
- Version: `0.1.0` (version code 1)
- Version: `0.2.0` (version code 2)
- Portrait orientation
+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.1.0-alpha.apk"
export_path="build/Ratdoku-v0.2.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=1
version/name="0.1.0"
version/code=2
version/name="0.2.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.1.0-alpha"
config/version="0.2.0-alpha"
config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.png"
+12
View File
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/GuestBook.gd" id="1_guestbook"]
[node name="GuestBook" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_guestbook")
+12
View File
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/Rulebook.gd" id="1_rulebook"]
[node name="Rulebook" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_rulebook")
+12
View File
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/Settings.gd" id="1_settings"]
[node name="Settings" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_settings")
+1 -1
View File
@@ -249,7 +249,7 @@ func _draw_x(rect: Rect2, color: Color) -> void:
func _assign_region_rats() -> void:
# v0.1.0-alpha: no per-room guest tokens yet. Leave the table empty so every
# 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
+36 -2
View File
@@ -1,6 +1,7 @@
extends Control
signal back_pressed
signal guest_book_pressed
const BoardScene = preload("res://scenes/Board.tscn")
const DEFAULT_STATUS := "One guest per room, floor and corridor.\nTap = X · Hold or right-click = check in."
@@ -18,6 +19,9 @@ var timer_label: Label
var status_label: Label
var win_detail: Label
var overlay: ColorRect
var new_guest_box: HBoxContainer
var new_guest_label: Label
var new_guest_portrait: TextureRect
func _ready() -> void:
@@ -130,10 +134,32 @@ func _build_win_overlay() -> void:
box.add_child(win_detail)
box.add_child(UI.label("Sweet dreams, little guests.", 18, Palette.MUTED))
new_guest_box = HBoxContainer.new()
new_guest_box.alignment = BoxContainer.ALIGNMENT_CENTER
new_guest_box.add_theme_constant_override("separation", 8)
new_guest_box.visible = false
box.add_child(new_guest_box)
new_guest_portrait = TextureRect.new()
new_guest_portrait.custom_minimum_size = Vector2(64, 64)
new_guest_portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
new_guest_portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
new_guest_box.add_child(new_guest_portrait)
new_guest_label = UI.label("", 14, Palette.INK)
new_guest_label.custom_minimum_size = Vector2(250, 0)
new_guest_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
new_guest_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
new_guest_box.add_child(new_guest_label)
var next := UI.button("Next room", true, 56)
box.add_child(next)
next.pressed.connect(_on_next)
var book := UI.button("Guest Book", false, 46)
box.add_child(book)
book.pressed.connect(func() -> void: guest_book_pressed.emit())
func _make_win_portrait() -> Control:
if ResourceLoader.exists("res://art/crumb_head.png"):
@@ -147,7 +173,7 @@ func _make_win_portrait() -> Control:
func start_level(index: int) -> void:
if levels.is_empty():
status_label.text = "No rooms found — check data/levels.json."
status_label.text = "No rooms yet — run tools/generate_levels.gd in Godot."
status_label.add_theme_color_override("font_color", Palette.RED)
return
@@ -161,6 +187,7 @@ func start_level(index: int) -> void:
elapsed_ms = 0
win_shown = false
overlay.visible = false
new_guest_box.visible = false
if level.get("clues", []).size() > 0:
status_label.text = "Gold-ringed guests are already checked in.\nTap = X · Hold or right-click = check in."
else:
@@ -203,7 +230,14 @@ func _on_solved() -> void:
status_label.add_theme_color_override("font_color", Palette.INK)
win_detail.text = "Room %d · %s" % [level_index + 1, _format_time(elapsed_ms)]
SaveGame.complete_room(current_level_id, level_index + 1)
var unlocked_id := SaveGame.complete_room(current_level_id, 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
else:
new_guest_box.visible = false
await get_tree().create_timer(0.45).timeout
if win_shown:
+254
View File
@@ -0,0 +1,254 @@
extends Control
signal back_pressed
var grid: GridContainer
var progress_label: Label
var status_label: Label
var detail_layer: ColorRect
var detail_portrait: TextureRect
var detail_name: Label
var detail_role: Label
var detail_meta: Label
var detail_bio: Label
var detail_snack: Label
var detail_status: Label
func _ready() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
margin.add_theme_constant_override("margin_left", 20)
margin.add_theme_constant_override("margin_right", 20)
margin.add_theme_constant_override("margin_top", 16)
margin.add_theme_constant_override("margin_bottom", 16)
add_child(margin)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 10)
margin.add_child(column)
var top := HBoxContainer.new()
top.add_theme_constant_override("separation", 10)
column.add_child(top)
var back := UI.button("‹", false, 44)
back.custom_minimum_size = Vector2(48, 44)
back.add_theme_font_size_override("font_size", 30)
back.pressed.connect(func() -> void: back_pressed.emit())
top.add_child(back)
var title := UI.label("The Guest Book", 30)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(title)
progress_label = UI.label("5 of 25 checked in", 15, Palette.MUTED)
progress_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
progress_label.autowrap_mode = TextServer.AUTOWRAP_OFF
progress_label.custom_minimum_size = Vector2(150, 0)
progress_label.size_flags_horizontal = Control.SIZE_SHRINK_END
top.add_child(progress_label)
var crumb := _make_crumb_card()
column.add_child(crumb)
status_label = UI.label("Tap a guest to read their card.", 14, Palette.MUTED)
status_label.custom_minimum_size = Vector2(0, 28)
column.add_child(status_label)
var scroll := ScrollContainer.new()
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
column.add_child(scroll)
grid = GridContainer.new()
grid.columns = 3
grid.size_flags_horizontal = Control.SIZE_EXPAND_FILL
grid.add_theme_constant_override("h_separation", 8)
grid.add_theme_constant_override("v_separation", 8)
scroll.add_child(grid)
_build_detail()
SaveGame.progress_changed.connect(refresh)
refresh()
func _make_crumb_card() -> PanelContainer:
var panel := UI.panel(Palette.PAPER, 20, 12)
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 12)
panel.add_child(row)
var portrait := TextureRect.new()
portrait.custom_minimum_size = Vector2(86, 86)
portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
if ResourceLoader.exists("res://art/crumb_head.png"):
portrait.texture = load("res://art/crumb_head.png")
elif ResourceLoader.exists("res://art/crumb.png"):
portrait.texture = load("res://art/crumb.png")
row.add_child(portrait)
var text := VBoxContainer.new()
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
text.alignment = BoxContainer.ALIGNMENT_CENTER
row.add_child(text)
var name := UI.label("Crumb", 22)
name.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(name)
var role := UI.label("Innkeeper · always in", 14, Palette.MUTED)
role.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(role)
return panel
func refresh() -> void:
if grid == null:
return
for child in grid.get_children():
child.free()
var guests := Guests.all()
var unlocked := SaveGame.unlocked_count(guests)
progress_label.text = "%d of %d checked in" % [unlocked, guests.size()]
for guest in guests:
grid.add_child(_make_card(guest))
func _make_card(guest: Dictionary) -> PanelContainer:
var id := str(guest["id"])
var locked := not SaveGame.is_guest_unlocked(id)
var accent := Color(str(guest.get("accent", "#8c7460")))
var panel := UI.panel(Palette.PAPER, 18, 8)
panel.custom_minimum_size = Vector2(188, 224)
panel.size_flags_horizontal = Control.SIZE_EXPAND_FILL
panel.mouse_filter = Control.MOUSE_FILTER_STOP
panel.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
panel.gui_input.connect(_on_card_input.bind(guest, locked))
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 2)
box.mouse_filter = Control.MOUSE_FILTER_IGNORE
panel.add_child(box)
var portrait := Control.new()
portrait.custom_minimum_size = Vector2(170, 170)
portrait.mouse_filter = Control.MOUSE_FILTER_IGNORE
box.add_child(portrait)
var texture := TextureRect.new()
texture.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
texture.mouse_filter = Control.MOUSE_FILTER_IGNORE
texture.texture = load(Guests.portrait(id, "thumbs"))
portrait.add_child(texture)
if locked:
texture.modulate = Color(1.0, 1.0, 1.0, 0.18)
var veil := ColorRect.new()
veil.color = Color(0.98, 0.93, 0.84, 0.78)
veil.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
veil.mouse_filter = Control.MOUSE_FILTER_IGNORE
portrait.add_child(veil)
var mystery := UI.label("???", 34, Palette.INK)
mystery.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
mystery.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
mystery.mouse_filter = Control.MOUSE_FILTER_IGNORE
portrait.add_child(mystery)
var name_label := UI.label("???" if locked else str(guest["name"]), 17)
name_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
box.add_child(name_label)
var role_text := "Room %d" % int(guest.get("unlock_room", 0)) if locked else str(guest["role"])
var role_label := UI.label(role_text, 13, Palette.MUTED if locked else accent)
role_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
box.add_child(role_label)
return panel
func _on_card_input(event: InputEvent, guest: Dictionary, locked: bool) -> void:
if not (event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT):
return
if locked:
var room := int(guest.get("unlock_room", 0))
status_label.text = "Check in a guest from Room %d to meet them." % room
status_label.add_theme_color_override("font_color", Palette.RED)
else:
status_label.text = "Tap a guest to read their card."
status_label.add_theme_color_override("font_color", Palette.MUTED)
_show_detail(guest)
func _build_detail() -> void:
detail_layer = ColorRect.new()
detail_layer.color = Color(0.18, 0.12, 0.08, 0.52)
detail_layer.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
detail_layer.mouse_filter = Control.MOUSE_FILTER_STOP
detail_layer.visible = false
add_child(detail_layer)
var center := CenterContainer.new()
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
detail_layer.add_child(center)
var panel := UI.panel(Palette.CREAM, 32, 24)
panel.custom_minimum_size = Vector2(420, 0)
center.add_child(panel)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 8)
panel.add_child(box)
detail_portrait = TextureRect.new()
detail_portrait.custom_minimum_size = Vector2(300, 300)
detail_portrait.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
detail_portrait.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
box.add_child(detail_portrait)
detail_name = UI.label("Name", 30)
box.add_child(detail_name)
detail_role = UI.label("Role", 18, Palette.MUTED)
box.add_child(detail_role)
detail_meta = UI.label("Variety", 15, Palette.MUTED)
box.add_child(detail_meta)
detail_bio = UI.label("", 17)
detail_bio.custom_minimum_size = Vector2(0, 52)
box.add_child(detail_bio)
detail_snack = UI.label("", 15, Palette.MUTED)
box.add_child(detail_snack)
detail_status = UI.label("", 14, Palette.MUTED)
box.add_child(detail_status)
var close := UI.button("Close", false, 50)
close.pressed.connect(func() -> void: detail_layer.visible = false)
box.add_child(close)
func _show_detail(guest: Dictionary) -> void:
var id := str(guest["id"])
var accent := Color(str(guest.get("accent", "#8c7460")))
detail_portrait.texture = load(Guests.portrait(id, "cards"))
detail_name.text = str(guest["name"])
detail_role.text = "%s · %s" % [str(guest["role"]), str(guest.get("pronouns", ""))]
detail_role.add_theme_color_override("font_color", accent)
detail_meta.text = "%s coat · %s" % [str(guest.get("variety", "")), str(guest.get("coat", ""))]
detail_bio.text = str(guest.get("personality", ""))
detail_snack.text = "Favourite snack: %s" % str(guest.get("snack", ""))
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"
detail_layer.visible = true
+1
View File
@@ -0,0 +1 @@
uid://cfdurhj51k6me
+28
View File
@@ -1,6 +1,9 @@
extends Control
signal play_pressed
signal guest_book_pressed
signal settings_pressed
signal rules_pressed
func _ready() -> void:
@@ -49,8 +52,33 @@ func _ready() -> void:
column.add_child(play_center)
play.pressed.connect(func() -> void: play_pressed.emit())
var secondary := HBoxContainer.new()
secondary.alignment = BoxContainer.ALIGNMENT_CENTER
secondary.add_theme_constant_override("separation", 10)
column.add_child(secondary)
var book := UI.button("Guest Book", false, 52)
book.custom_minimum_size = Vector2(150, 52)
book.pressed.connect(func() -> void: guest_book_pressed.emit())
secondary.add_child(book)
var rules := UI.button("House Rules", false, 52)
rules.custom_minimum_size = Vector2(160, 52)
rules.pressed.connect(func() -> void: rules_pressed.emit())
secondary.add_child(rules)
column.add_child(UI.label("No ads. No lives. Just rats.", 16, Palette.MUTED))
var settings := UI.button("Settings", false, 40)
settings.add_theme_font_size_override("font_size", 16)
settings.set_anchors_preset(Control.PRESET_TOP_RIGHT)
settings.offset_left = -150
settings.offset_top = 24
settings.offset_right = -24
settings.offset_bottom = 64
settings.pressed.connect(func() -> void: settings_pressed.emit())
add_child(settings)
func _make_mascot() -> Control:
if ResourceLoader.exists("res://art/crumb.png"):
+31
View File
@@ -2,9 +2,15 @@ extends Control
const HomeScene = preload("res://scenes/Home.tscn")
const GameScene = preload("res://scenes/Game.tscn")
const GuestBookScene = preload("res://scenes/GuestBook.tscn")
const SettingsScene = preload("res://scenes/Settings.tscn")
const RulebookScene = preload("res://scenes/Rulebook.tscn")
var home
var game
var guest_book
var settings
var rulebook
var screens := {}
var current := "home"
var nav_stack: Array[String] = []
@@ -20,14 +26,34 @@ func _ready() -> void:
home = HomeScene.instantiate()
_add_screen(home)
home.play_pressed.connect(_on_play)
home.guest_book_pressed.connect(func() -> void: show_screen("guest_book"))
home.settings_pressed.connect(func() -> void: show_screen("settings"))
home.rules_pressed.connect(func() -> void: show_screen("rules"))
game = GameScene.instantiate()
_add_screen(game)
game.back_pressed.connect(go_back)
game.guest_book_pressed.connect(func() -> void: show_screen("guest_book"))
guest_book = GuestBookScene.instantiate()
_add_screen(guest_book)
guest_book.back_pressed.connect(go_back)
settings = SettingsScene.instantiate()
_add_screen(settings)
settings.back_pressed.connect(go_back)
settings.rules_pressed.connect(func() -> void: show_screen("rules"))
rulebook = RulebookScene.instantiate()
_add_screen(rulebook)
rulebook.back_pressed.connect(go_back)
screens = {
"home": home,
"game": game,
"guest_book": guest_book,
"settings": settings,
"rules": rulebook,
}
show_screen("home", false)
@@ -53,6 +79,11 @@ func show_screen(name: String, push: bool = true) -> void:
current = name
if name == "guest_book":
guest_book.refresh()
elif name == "settings":
settings.refresh()
func go_back() -> void:
if nav_stack.is_empty():
+104
View File
@@ -0,0 +1,104 @@
class_name MiniDiagram
extends Control
## Tiny 5x5 rule illustrations for the House Rules page.
const REGIONS := [
[0, 0, 0, 0, 0],
[1, 1, 1, 1, 0],
[3, 1, 4, 2, 2],
[3, 3, 4, 2, 2],
[3, 4, 4, 4, 2],
]
var mode := "row"
func _ready() -> void:
mouse_filter = Control.MOUSE_FILTER_IGNORE
custom_minimum_size = Vector2(150, 150)
func _draw() -> void:
var side: float = min(size.x, size.y)
var cell := side / 5.0
var origin := (size - Vector2(side, side)) * 0.5
var board := Rect2(origin, Vector2(side, side))
for r in 5:
for c in 5:
var rect := Rect2(origin + Vector2(c * cell, r * cell), Vector2(cell, cell))
var region := int(REGIONS[r][c])
var color: Color = Palette.REGION_COLORS[region % Palette.REGION_COLORS.size()]
draw_rect(rect.grow(0.5), color)
# Highlight
var accent := Color(0.91, 0.71, 0.36, 0.38)
if mode == "row":
draw_rect(Rect2(origin + Vector2(0, 2 * cell), Vector2(side, cell)), accent)
elif mode == "col":
draw_rect(Rect2(origin + Vector2(2 * cell, 0), Vector2(cell, side)), accent)
elif mode == "region":
for r in 5:
for c in 5:
if int(REGIONS[r][c]) == 0:
draw_rect(Rect2(origin + Vector2(c * cell, r * cell), Vector2(cell, cell)), accent)
# Grid and room walls
for i in range(6):
var x := origin.x + i * cell
var y := origin.y + i * cell
draw_line(Vector2(x, origin.y), Vector2(x, origin.y + side), Palette.GRID, 1.0, true)
draw_line(Vector2(origin.x, y), Vector2(origin.x + side, y), Palette.GRID, 1.0, true)
for r in 5:
for c in 5:
var rect := Rect2(origin + Vector2(c * cell, r * cell), Vector2(cell, cell))
if c == 4 or int(REGIONS[r][c]) != int(REGIONS[r][c + 1]):
draw_line(rect.position + Vector2(cell, 0), rect.position + Vector2(cell, cell), Palette.WALL, 3.0, true)
if r == 4 or int(REGIONS[r][c]) != int(REGIONS[r + 1][c]):
draw_line(rect.position + Vector2(0, cell), rect.position + Vector2(cell, cell), Palette.WALL, 3.0, true)
draw_rect(board, Palette.WALL, false, 4.0, true)
var rat_cell := Vector2i(2, 2)
if mode == "region":
rat_cell = Vector2i(0, 2)
_draw_rat(origin, cell, rat_cell)
if mode == "touch":
for dr in range(-1, 2):
for dc in range(-1, 2):
if dr == 0 and dc == 0:
continue
var r := rat_cell.x + dr
var c := rat_cell.y + dc
if r >= 0 and r < 5 and c >= 0 and c < 5:
_draw_x(origin, cell, Vector2i(r, c))
var center := origin + (Vector2(rat_cell) + Vector2(0.5, 0.5)) * cell
draw_arc(center, cell * 0.40, 0.0, TAU, 24, Palette.RED, 2.5, true)
func _draw_rat(origin: Vector2, cell: float, at: Vector2i) -> void:
var c := origin + (Vector2(at) + Vector2(0.5, 0.5)) * cell
var fur := Color("8f6a4a")
var ear := Color("e0a29a")
draw_circle(c + Vector2(-0.16, -0.14) * cell, cell * 0.12, fur)
draw_circle(c + Vector2(0.16, -0.14) * cell, cell * 0.12, fur)
draw_circle(c + Vector2(-0.16, -0.14) * cell, cell * 0.07, ear)
draw_circle(c + Vector2(0.16, -0.14) * cell, cell * 0.07, ear)
draw_circle(c, cell * 0.22, fur)
draw_circle(c + Vector2(0, 0.08) * cell, cell * 0.12, Color("f6e4c6"))
draw_circle(c + Vector2(-0.08, -0.02) * cell, cell * 0.025, Palette.INK)
draw_circle(c + Vector2(0.08, -0.02) * cell, cell * 0.025, Palette.INK)
draw_circle(c + Vector2(0, 0.08) * cell, cell * 0.02, Color("c9736b"))
func _draw_x(origin: Vector2, cell: float, at: Vector2i) -> void:
var rect := Rect2(origin + Vector2(at.x * cell, at.y * cell), Vector2(cell, cell))
var inset := cell * 0.30
var a := rect.position + Vector2(inset, inset)
var b := rect.position + Vector2(cell - inset, cell - inset)
var c := rect.position + Vector2(cell - inset, inset)
var d := rect.position + Vector2(inset, cell - inset)
draw_line(a, b, Palette.RED, 2.0, true)
draw_line(c, d, Palette.RED, 2.0, true)
+1
View File
@@ -0,0 +1 @@
uid://pss1icj4438q
+178
View File
@@ -0,0 +1,178 @@
extends Control
signal back_pressed
const BoardScene = preload("res://scenes/Board.tscn")
var tutorial_board: Board
var tutorial_status: Label
func _ready() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
margin.add_theme_constant_override("margin_left", 24)
margin.add_theme_constant_override("margin_right", 24)
margin.add_theme_constant_override("margin_top", 18)
margin.add_theme_constant_override("margin_bottom", 18)
add_child(margin)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 12)
margin.add_child(column)
var top := HBoxContainer.new()
top.add_theme_constant_override("separation", 10)
column.add_child(top)
var back := UI.button("‹", false, 44)
back.custom_minimum_size = Vector2(48, 44)
back.add_theme_font_size_override("font_size", 30)
back.pressed.connect(func() -> void: back_pressed.emit())
top.add_child(back)
var title := UI.label("House Rules", 30)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(title)
var scroll := ScrollContainer.new()
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
column.add_child(scroll)
var content := VBoxContainer.new()
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
content.add_theme_constant_override("separation", 10)
scroll.add_child(content)
content.add_child(_heading("Welcome to the Rat Hotel"))
content.add_child(_body("Crumb runs a small hotel for travelling rats. Every guest wants a room of their own — and a little space from the neighbours."))
content.add_child(_heading("The four house rules"))
content.add_child(_rule_row("One guest per room", "Each coloured room holds exactly one rat.", "region"))
content.add_child(_rule_row("One guest per floor", "Each row holds exactly one rat.", "row"))
content.add_child(_rule_row("One guest per corridor", "Each column holds exactly one rat.", "col"))
content.add_child(_rule_row("No shared walls or corners", "Rats cannot touch, not even diagonally.", "touch"))
content.add_child(_heading("Checking in"))
content.add_child(_body("Tap or left-click to mark a cell with an X. Tap an X or a guest to clear it. Press and hold on mobile, or right-click on PC, to check a guest in. A gold ring fills while you hold."))
content.add_child(_body("Gold-ringed guests are already checked in and cannot be moved. Undo is unlimited."))
content.add_child(_heading("Try a tiny room"))
content.add_child(_body("One guest is already checked in. Place the other four. No guessing required."))
var board_center := CenterContainer.new()
content.add_child(board_center)
tutorial_board = BoardScene.instantiate() as Board
tutorial_board.custom_minimum_size = Vector2(300, 300)
tutorial_board.size_flags_horizontal = Control.SIZE_SHRINK_CENTER
tutorial_board.solved.connect(_on_tutorial_solved)
board_center.add_child(tutorial_board)
var controls := HBoxContainer.new()
controls.alignment = BoxContainer.ALIGNMENT_CENTER
controls.add_theme_constant_override("separation", 10)
content.add_child(controls)
var reset := UI.button("Reset", false, 48)
reset.custom_minimum_size = Vector2(120, 48)
reset.pressed.connect(_on_tutorial_reset)
controls.add_child(reset)
var hint := UI.button("Hint", true, 48)
hint.custom_minimum_size = Vector2(120, 48)
hint.pressed.connect(_on_tutorial_hint)
controls.add_child(hint)
tutorial_status = UI.label("Tap a cell to mark X. Hold or right-click to check in.", 14, Palette.MUTED)
content.add_child(tutorial_status)
content.add_child(_heading("Housekeeping tips"))
content.add_child(_body("Start with the smallest room. Mark Xs as you place guests — the board does it for you. If a room's open cells all sit in one row, that row's guest belongs to that room. Every room has exactly one solution, and it never requires guessing."))
content.add_child(_body("If you get stuck, the Hint button reveals one correct guest. In the real rooms, Crumb's hints are always free."))
content.add_child(_heading("Questions"))
content.add_child(_body("Why can't the rats touch? Every guest is a little grumpy after a long journey and wants their own space."))
content.add_child(_body("Why do some guests have gold rings? They checked in early. They are part of the puzzle, not a mistake."))
var gap := Control.new()
gap.custom_minimum_size = Vector2(0, 20)
content.add_child(gap)
var tutorial := _load_tutorial()
if not tutorial.is_empty():
tutorial_board.set_level(tutorial)
func _heading(text: String) -> Label:
var label := UI.label(text, 24)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
return label
func _body(text: String, font_size: int = 16) -> Label:
var label := UI.label(text, font_size, Palette.MUTED)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
return label
func _rule_row(title: String, body: String, mode: String) -> PanelContainer:
var panel := UI.panel(Palette.PAPER, 20, 12)
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 12)
panel.add_child(row)
var diagram := MiniDiagram.new()
diagram.mode = mode
diagram.custom_minimum_size = Vector2(130, 130)
row.add_child(diagram)
var text := VBoxContainer.new()
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
text.alignment = BoxContainer.ALIGNMENT_CENTER
row.add_child(text)
var heading := UI.label(title, 19)
heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(heading)
var detail := UI.label(body, 14, Palette.MUTED)
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(detail)
return panel
func _load_tutorial() -> Dictionary:
if not FileAccess.file_exists("res://data/tutorial.json"):
return {}
var file := FileAccess.open("res://data/tutorial.json", FileAccess.READ)
if file == null:
return {}
var parsed = JSON.parse_string(file.get_as_text())
file.close()
if typeof(parsed) == TYPE_DICTIONARY:
return parsed
return {}
func _on_tutorial_reset() -> void:
tutorial_board.restart()
tutorial_status.text = "Tap a cell to mark X. Hold or right-click to check in."
tutorial_status.add_theme_color_override("font_color", Palette.MUTED)
func _on_tutorial_hint() -> void:
if tutorial_board.hint():
tutorial_status.text = "Crumb tapped the right room."
tutorial_status.add_theme_color_override("font_color", Palette.MUTED)
else:
tutorial_status.text = "Everyone is already checked in."
tutorial_status.add_theme_color_override("font_color", Palette.MUTED)
func _on_tutorial_solved() -> void:
tutorial_status.text = "Everyone checked in. Nicely done."
tutorial_status.add_theme_color_override("font_color", Palette.INK)
+1
View File
@@ -0,0 +1 @@
uid://0wfmdeab7oh3
+169
View File
@@ -0,0 +1,169 @@
extends Control
signal back_pressed
signal rules_pressed
var toggles := {}
var hold_slider: HSlider
var hold_value: Label
var reset_status: Label
var reset_dialog: ConfirmationDialog
func _ready() -> void:
var margin := MarginContainer.new()
margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
margin.add_theme_constant_override("margin_left", 24)
margin.add_theme_constant_override("margin_right", 24)
margin.add_theme_constant_override("margin_top", 18)
margin.add_theme_constant_override("margin_bottom", 18)
add_child(margin)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 14)
margin.add_child(column)
var top := HBoxContainer.new()
top.add_theme_constant_override("separation", 10)
column.add_child(top)
var back := UI.button("‹", false, 44)
back.custom_minimum_size = Vector2(48, 44)
back.add_theme_font_size_override("font_size", 30)
back.pressed.connect(func() -> void: back_pressed.emit())
top.add_child(back)
var title := UI.label("Settings", 30)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
title.size_flags_horizontal = Control.SIZE_EXPAND_FILL
top.add_child(title)
var scroll := ScrollContainer.new()
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
column.add_child(scroll)
var list := VBoxContainer.new()
list.size_flags_horizontal = Control.SIZE_EXPAND_FILL
list.add_theme_constant_override("separation", 10)
scroll.add_child(list)
_add_toggle(list, "Region patterns", "Dots and stripes on the coloured rooms. Helps with colour blindness.", "patterns")
_add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer")
_add_toggle(list, "Reduce motion", "Stop the rat bob and placement pop. The hold ring still works.", "reduce_motion")
_add_hold_row(list)
list.add_child(UI.label("House Rules", 18, Palette.MUTED))
var rules := UI.button("Open the handbook", false, 52)
rules.pressed.connect(func() -> void: rules_pressed.emit())
list.add_child(rules)
list.add_child(UI.label("Progress", 18, Palette.MUTED))
var reset := UI.button("Reset progress", false, 52)
reset.add_theme_color_override("font_color", Palette.RED)
reset.add_theme_color_override("font_hover_color", Palette.RED)
reset.pressed.connect(_on_reset_pressed)
list.add_child(reset)
reset_status = UI.label("Completed rooms and unlocked guests will be cleared. Settings stay.", 15, Palette.MUTED)
list.add_child(reset_status)
list.add_child(UI.label("Ratdoku 0.2 · made with Godot · no ads, no tracking", 14, Palette.MUTED))
reset_dialog = ConfirmationDialog.new()
reset_dialog.title = "Reset progress?"
reset_dialog.dialog_text = "This clears completed rooms and unlocked guests. Your settings stay as they are."
reset_dialog.confirmed.connect(_on_reset_confirmed)
add_child(reset_dialog)
refresh()
func _add_toggle(parent: VBoxContainer, title: String, subtitle: String, key: String) -> void:
var panel := UI.panel(Palette.PAPER, 20, 14)
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 10)
panel.add_child(row)
var text := VBoxContainer.new()
text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
text.add_theme_constant_override("separation", 2)
row.add_child(text)
var label := UI.label(title, 19)
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(label)
var detail := UI.label(subtitle, 14, Palette.MUTED)
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
text.add_child(detail)
var check := CheckButton.new()
check.button_pressed = bool(SaveGame.get_setting(key))
check.add_theme_font_size_override("font_size", 18)
check.add_theme_color_override("font_color", Palette.INK)
check.toggled.connect(func(on: bool) -> void: SaveGame.set_setting(key, on))
row.add_child(check)
toggles[key] = check
parent.add_child(panel)
func _add_hold_row(parent: VBoxContainer) -> void:
var panel := UI.panel(Palette.PAPER, 20, 14)
var column := VBoxContainer.new()
column.add_theme_constant_override("separation", 6)
panel.add_child(column)
var title := UI.label("Hold time", 19)
title.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
column.add_child(title)
var detail := UI.label("How long to press before a guest checks in.", 14, Palette.MUTED)
detail.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT
column.add_child(detail)
var row := HBoxContainer.new()
row.add_theme_constant_override("separation", 10)
column.add_child(row)
hold_slider = HSlider.new()
hold_slider.min_value = 0.20
hold_slider.max_value = 0.50
hold_slider.step = 0.05
hold_slider.value = float(SaveGame.get_setting("hold_seconds"))
hold_slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
hold_slider.custom_minimum_size = Vector2(180, 32)
hold_slider.value_changed.connect(_on_hold_changed)
row.add_child(hold_slider)
hold_value = UI.label("%.2f s" % hold_slider.value, 16, Palette.MUTED)
hold_value.custom_minimum_size = Vector2(64, 0)
row.add_child(hold_value)
parent.add_child(panel)
func refresh() -> void:
for key in toggles:
toggles[key].button_pressed = bool(SaveGame.get_setting(key))
if hold_slider != null:
hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds")))
hold_value.text = "%.2f s" % hold_slider.value
func _on_hold_changed(value: float) -> void:
var snapped: float = snapped(value, 0.05)
hold_value.text = "%.2f s" % snapped
SaveGame.set_setting("hold_seconds", snapped)
func _on_reset_pressed() -> void:
reset_dialog.popup_centered()
func _on_reset_confirmed() -> void:
SaveGame.reset_progress()
reset_status.text = "Progress reset. Every guest is waiting to be met again."
reset_status.add_theme_color_override("font_color", Palette.INK)
+1
View File
@@ -0,0 +1 @@
uid://mtpyejbc4p2q