Commit Graph

99 Commits

Author SHA1 Message Date
randrews 04415211c3 event timer change 2026-06-07 10:11:33 -05:00
randrews ac7fd36ccd clippy 2026-06-07 01:29:58 -05:00
randrews a8d2cb8303 object tags 2026-06-07 01:26:18 -05:00
randrews 9c2212520c Moved tests 2026-06-07 00:46:38 -05:00
randrews 5ea7e4ec4e move tests 2026-06-07 00:33:16 -05:00
randrews ea79dc20f9 refactoring 2026-06-07 00:19:53 -05:00
randrews ea18fe8fc2 Real object ids, fixed warping bug 2026-06-06 20:01:07 -05:00
randrews 374a69f0ca Floor layer 2026-06-06 18:49:45 -05:00
randrews a5f60e22e1 more scripting, objects moving 2026-06-06 17:36:00 -05:00
randrews 8ac6da184c crates, player coords, arch.md gone 2026-06-06 14:11:20 -05:00
randrews 05c9fdbde9 Solidity 2026-06-06 01:37:19 -05:00
randrews 8f2cca2907 more refactor 2026-06-05 01:09:50 -05:00
randrews 6cd34ebb4e removed boardstate 2026-06-05 00:30:14 -05:00
randrews 4f21f7fa8a more scripting 2026-06-04 23:52:33 -05:00
randrews e0477a12b8 basic scripting 2026-06-04 20:11:55 -05:00
randrews f0bcc90480 Timer 2026-06-03 23:21:05 -05:00
randrews 0187162e85 Log panel 2026-06-03 22:46:54 -05:00
randrews de1870432f Add kiln-tui: a terminal player for kiln boards
New `kiln-tui` crate (ratatui 0.30 / crossterm) that plays a board from a
.toml map named on the command line, letting the player walk around with the
arrow keys or hjkl. It depends only on kiln-core — the engine needed zero
changes, confirming it is genuinely UI-agnostic.

- Text rendering: each Glyph.tile index is reinterpreted as a character via a
  CP437->Unicode table (cp437.rs); fg/bg map to ratatui Color::Rgb truecolor.
- render.rs BoardWidget: per-axis viewport that centers a small board and
  scrolls a large one to keep the player visible.
- term.rs TerminalCaps: detects truecolor and Kitty keyboard-protocol support,
  enabling the protocol when present (held-key repeat, modifier-only keys);
  shows a rainbow "truecolor" badge in the bottom border.
- Input loop acts on Press and Repeat (continuous held-key movement) and
  ignores Release.

Workspace: removed kiln-egui from members (files left untouched). Updated
CLAUDE.md and ARCHITECTURE.md to document the workspace split and kiln-tui.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 20:10:02 -05:00
randrews 353461dbfd egui changes 2026-06-03 17:45:43 -05:00
randrews dc5b903741 zoom factor 2026-05-31 23:51:51 -05:00
randrews 067bb9bee0 Object passable/opaque: editor checkboxes + doc/simplify cleanup
- ObjectDef gains passable/opaque fields (defaults: false/true); Board::is_passable
  consults the object before the grid cell, so objects block movement independently
  of the floor tile beneath them
- Editor Objects tab exposes Passable and Opaque checkboxes; changes survive save/load
- Add ObjectDef::new(x, y) to centralise placement defaults; remove triple
  default_glyph() call and unused Glyph import from main.rs
- Fix stale Behavior doc comment; update CLAUDE.md and ARCHITECTURE.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 21:48:40 -05:00
randrews 0241cd2a8d Move passable and opaque into objectdef 2026-05-30 21:22:36 -05:00
randrews a0d21bde20 workspaceify 2026-05-30 20:20:09 -05:00
randrews d19737c113 object layer 2026-05-30 19:25:10 -05:00
randrews 96ec8e8e92 object scripting wip 2026-05-30 18:48:41 -05:00
randrews 212297ecf9 Add bitmap font rendering via PNG tilesheet
Replace egui text rendering with a BitmapFont system:
- Glyph.tile: u32 replaces ch: char; top-left pixel of PNG is background sentinel
- BitmapFont loads/preprocesses PNG to opaque-white + transparent, tinted at render time
- Default font: assets/vga-font-8x16.png (CP437, 8×16 tiles); placeholder generated if missing
- Boards can specify a per-board font via [font] in their .toml file
- Editor Board tab: "Font…" button opens font dialog (rfd file picker, tile dims, tilesheet preview)
- Glyph picker: tile grid from active font replaces hardcoded ASCII char grid
- map_file: TileIndex untagged enum accepts char or integer in palette entries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:07:04 -05:00
randrews 12ebe77932 Simplify: extract paint_glyph, drop unused param and redundant comments
- Add paint_glyph(painter, rect, glyph) to render.rs; draw_glyph now
  delegates to it, eliminating the duplicated rect_filled+text pattern
  that appeared in four places across editor.rs and glyph_picker.rs
- Remove unused _board param from show_editor_panel and its call site
- Drop redundant section-header comments in glyph_picker.rs (the
  ui.label() calls immediately below already name each section)
- Remove extracted fg/bg/cur_ch locals in the char grid loop now that
  paint_glyph accepts a Glyph directly
- Fix CLAUDE.md update phase description (stale from pre-refactor)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 22:01:21 -05:00
randrews f3bbfbb169 Document "finish the epic" session-closing command in CLAUDE.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 21:48:20 -05:00
randrews 86bcf84175 Rename project from viberogue to Kiln
Updates Cargo.toml package name, window title, and all references in
ARCHITECTURE.md and CLAUDE.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 19:40:03 -05:00
randrews daaffbca6f Add ASCII-art layout diagram to render.rs
Makes the nine layout constants self-documenting by showing which value
controls which part of the window (cell size, menu bar, panel margin,
side panel, and overall window dimensions).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 19:26:57 -05:00
randrews 4b12005800 Update ARCHITECTURE.md and CLAUDE.md for new module structure
Documents render.rs, editor.rs, and glyph_picker.rs; updates the module
structure diagram and main.rs section to reflect the refactored layout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 19:11:53 -05:00
randrews 03d6337f04 Refactor main.rs into focused modules: render, editor, glyph_picker
Splits the flat 432-line main.rs into four modules so each file has one
clear job: render.rs owns layout constants and drawing primitives,
editor.rs owns EditorTab/EditorState and the side panel, glyph_picker.rs
owns the floating picker dialog with a decoupled (open, glyph) interface,
and main.rs is reduced to AppMode, App, and the frame loop (~150 lines).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 19:09:16 -05:00
randrews 60b04e6ef3 Simplify main.rs: extract draw_board/pos_to_cell, deduplicate logic
- Extract draw_board() to eliminate duplicated board+player render loop in Edit and Play branches
- Extract pos_to_cell() to eliminate duplicated click-to-cell floor math in board and char grid handlers
- Simplify glyph dedup to use Glyph: PartialEq directly instead of manual key tuples
- Merge two identical clicked() handlers in archetype list into one || check
- Remove WHAT-explaining comments

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:35:21 -05:00
randrews 5d97f67a64 Update CLAUDE.md and ARCHITECTURE.md for viewport scrolling, glyph chooser, and sidebar redesign
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:59:14 -05:00
randrews d5d67e988b Reset glyph to archetype default when selection changes
Selecting a different archetype in the editor now updates the active
glyph to that archetype's default_glyph(), keeping the visual preview
in sync with the selected behavior type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:56:27 -05:00
randrews a4b7a4968c Add glyph chooser and redesign editor side panel
Glyph chooser: a painted preview button in the Palette tab opens a
floating dialog with a board-palette picker, fg/bg color pickers
(egui built-in), and a 16×6 printable ASCII character grid. The
stamped glyph is now independent of the archetype's default.

Side panel: widened to 200 px (resizable), tabbed (Palette / Board /
World), archetype rows show their default glyph cell, list scrolls
after 5 entries, labels use ui.label() for consistent sizing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:48:36 -05:00
randrews 0348ecdd13 Add scroll bars to Edit mode when board overflows viewport
Edit mode now wraps the board in a ScrollArea so horizontal/vertical
scroll bars appear when the board is larger than the window. Play mode
keeps the existing player-centered viewport with no scroll bars.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:52:09 -05:00
randrews c3d260266c Add player-centered viewport scrolling for variable map sizes
Window size is now fixed (840×524) and independent of map dimensions.
Small maps center in the viewport; maps larger than the viewport keep
the player centered and clamp at board edges so no empty space shows.
Also derives Copy+Clone on Player to enable the per-frame origin calculation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:49:52 -05:00
randrews f0c49295ea Update CLAUDE.md and ARCHITECTURE.md for Behavior/Archetype redesign and editor mode
Documents the replacement of Element with Behavior + Archetype, the
elimination of the per-board element palette, the new map file format
(archetype = "name" instead of passable = bool), the ErrorBlock sentinel,
and the editor mode (AppMode, EditorState, palette panel, click-to-paint).
Also updates "What's not yet implemented" to reflect editor progress and
call out the Object behavior / glyph chooser / file open gaps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:34:34 -05:00
randrews 8263aff0c4 Add editor mode with archetype palette and click-to-paint
AppMode enum (Play/Edit) gates arrow-key input; a mode toggle in the
menu bar switches between them. Edit mode shows a SidePanel listing the
available archetypes (Empty, Wall, Object); clicking one selects it.
Clicking a board cell in Edit mode stamps it with the selected
archetype's default glyph. Mouse-to-cell conversion mirrors the
rendering origin math so clicks land on the correct cell.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 15:28:01 -05:00
randrews ac6a8dec57 Replace Element with Behavior + Archetype; update map format
Element is replaced by two types: Behavior (a plain struct of runtime
properties: passable, opaque) and Archetype (an enum of named presets:
Empty, Wall, Object, ErrorBlock). Board.cells changes from Vec<(Glyph,
usize)> to Vec<(Glyph, Archetype)>, eliminating the per-board element
palette. Map files now reference archetypes by name (archetype = "wall")
instead of property bags (passable = false), so the archetype list can
be reordered without breaking saved games. Unknown archetype names
produce an ErrorBlock cell (yellow ? on red) so malformed maps are
immediately visible in-game.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 15:20:46 -05:00
randrews 453c7baf4e Add rustdoc and inline comments throughout; update CLAUDE.md style guide
All public types, fields, and functions in game.rs and map_file.rs now
have /// doc comments. main.rs has /// on App and draw_glyph plus inline
comments explaining the input/render pipeline. CLAUDE.md records the
expectation that generated code includes comments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 12:48:52 -05:00
randrews 176c70de6b Add future considerations section to ARCHITECTURE.md
Documents the player-as-object goal and calls out the four specific
places in the current design (Board.player, player_start, try_move,
main.rs overlay) that will need to change when that's implemented.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 12:10:21 -05:00
randrews 9f62bba80c Add ARCHITECTURE.md with design rationale and context
Documents the module structure, key design decisions and their reasons,
map file format design, what's not yet implemented, and ZZT background
for future development sessions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 11:50:42 -05:00
randrews 573e662799 Update CLAUDE.md with current architecture
Documents all implemented modules, data structures, map file format,
and key design decisions made during this session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:51:57 -05:00
randrews 2dc749e037 Load maps from TOML files with XPM-style palette
Introduces a map file format: TOML with a [palette] mapping characters
to (Glyph, Element) definitions and a [grid] multi-line string. Board
now owns the player position, objects, and portals. map_file::load()
deserializes a file and converts it to a Board via From<MapFile>.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:50:05 -05:00
randrews 37c10c7c38 Size window to fit board including panel margin; center board on resize
Accounts for egui's 8px CentralPanel margin in the minimum window size.
When the window is larger than the minimum, the board is centered in the
available area.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:18:02 -05:00
randrews f7e585f6ed Add basic player movement on a ZZT-style board
Implements Glyph (per-cell visual), Element (shared behavior palette),
and Board (60x25 grid of (Glyph, usize) cells). Player walks around
with arrow keys and is blocked by wall elements.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:10:04 -05:00
randrews f3e5dece7f Initial project scaffold
Sets up eframe/egui app with basic menu bar and placeholder viewport. Adds Rhai scripting dependency for future game object scripting system.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:42:14 -05:00