From d6ab0e93a64525ce34f89e26d5272efbac513c32 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 11 Jun 2026 20:41:06 -0400 Subject: feat: big map and options changes --- TODO.md | 21 +++++-- data/help/automap.yaml | 13 ++++ data/help/color.yaml | 13 ++++ data/help/depletion.yaml | 11 ++++ data/help/description.yaml | 15 ++--- data/help/exits.yaml | 12 ++-- data/help/left-tinymap.yaml | 11 ++++ data/help/map.yaml | 23 +++++++ data/help/mapheight.yaml | 10 +++ data/help/mappadding.yaml | 13 ++++ data/help/mapwidth.yaml | 10 +++ data/help/mobenter.yaml | 10 +++ data/help/mobleave.yaml | 10 +++ data/help/mobspawn.yaml | 10 +++ data/help/option.yaml | 20 ++++++ data/help/reserve.yaml | 11 ++++ data/help/tinymap.yaml | 11 ++++ data/help/toggle.yaml | 18 ------ data/help/xpdrops.yaml | 10 +++ data/rooms/1.yaml | 2 +- data/rooms/100.yaml | 7 +++ data/rooms/101.yaml | 8 +++ data/rooms/102.yaml | 8 +++ data/rooms/103.yaml | 8 +++ data/rooms/104.yaml | 7 +++ data/rooms/105.yaml | 8 +++ data/rooms/106.yaml | 7 +++ data/rooms/107.yaml | 8 +++ data/rooms/108.yaml | 7 +++ data/rooms/109.yaml | 7 +++ data/rooms/110.yaml | 8 +++ data/rooms/111.yaml | 9 +++ data/rooms/112.yaml | 9 +++ data/rooms/113.yaml | 7 +++ data/rooms/115.yaml | 7 +++ data/rooms/116.yaml | 8 +++ data/rooms/117.yaml | 9 +++ data/rooms/118.yaml | 8 +++ data/rooms/119.yaml | 8 +++ data/rooms/120.yaml | 8 +++ data/rooms/121.yaml | 9 +++ data/rooms/122.yaml | 7 +++ data/rooms/126.yaml | 8 +++ data/rooms/127.yaml | 9 +++ data/rooms/128.yaml | 9 +++ data/rooms/129.yaml | 7 +++ data/rooms/130.yaml | 8 +++ data/rooms/131.yaml | 8 +++ data/rooms/136.yaml | 8 +++ data/rooms/137.yaml | 9 +++ data/rooms/138.yaml | 9 +++ data/rooms/139.yaml | 6 ++ data/rooms/140.yaml | 7 +++ data/rooms/141.yaml | 8 +++ data/rooms/142.yaml | 7 +++ data/rooms/143.yaml | 6 ++ data/rooms/145.yaml | 6 ++ data/rooms/146.yaml | 8 +++ data/rooms/147.yaml | 8 +++ data/rooms/148.yaml | 8 +++ data/rooms/149.yaml | 6 ++ internal/game/action_gather.go | 2 +- internal/game/action_use.go | 2 +- internal/game/cmd_attack.go | 4 +- internal/game/cmd_look.go | 12 ++-- internal/game/cmd_map.go | 140 +++++++++++++++++++++++++++++++++++++++++ internal/game/cmd_move.go | 6 +- internal/game/cmd_option.go | 116 ++++++++++++++++++++++++++++++++++ internal/game/cmd_toggle.go | 56 ----------------- internal/game/game.go | 6 +- internal/game/map_test.go | 86 +++++++++++++++++++++++++ internal/game/tick.go | 4 +- internal/player/player.go | 127 +++++++++++++++++++++++++++++++++---- 73 files changed, 1012 insertions(+), 120 deletions(-) create mode 100644 data/help/automap.yaml create mode 100644 data/help/color.yaml create mode 100644 data/help/depletion.yaml create mode 100644 data/help/left-tinymap.yaml create mode 100644 data/help/map.yaml create mode 100644 data/help/mapheight.yaml create mode 100644 data/help/mappadding.yaml create mode 100644 data/help/mapwidth.yaml create mode 100644 data/help/mobenter.yaml create mode 100644 data/help/mobleave.yaml create mode 100644 data/help/mobspawn.yaml create mode 100644 data/help/option.yaml create mode 100644 data/help/reserve.yaml create mode 100644 data/help/tinymap.yaml delete mode 100644 data/help/toggle.yaml create mode 100644 data/help/xpdrops.yaml create mode 100644 data/rooms/100.yaml create mode 100644 data/rooms/101.yaml create mode 100644 data/rooms/102.yaml create mode 100644 data/rooms/103.yaml create mode 100644 data/rooms/104.yaml create mode 100644 data/rooms/105.yaml create mode 100644 data/rooms/106.yaml create mode 100644 data/rooms/107.yaml create mode 100644 data/rooms/108.yaml create mode 100644 data/rooms/109.yaml create mode 100644 data/rooms/110.yaml create mode 100644 data/rooms/111.yaml create mode 100644 data/rooms/112.yaml create mode 100644 data/rooms/113.yaml create mode 100644 data/rooms/115.yaml create mode 100644 data/rooms/116.yaml create mode 100644 data/rooms/117.yaml create mode 100644 data/rooms/118.yaml create mode 100644 data/rooms/119.yaml create mode 100644 data/rooms/120.yaml create mode 100644 data/rooms/121.yaml create mode 100644 data/rooms/122.yaml create mode 100644 data/rooms/126.yaml create mode 100644 data/rooms/127.yaml create mode 100644 data/rooms/128.yaml create mode 100644 data/rooms/129.yaml create mode 100644 data/rooms/130.yaml create mode 100644 data/rooms/131.yaml create mode 100644 data/rooms/136.yaml create mode 100644 data/rooms/137.yaml create mode 100644 data/rooms/138.yaml create mode 100644 data/rooms/139.yaml create mode 100644 data/rooms/140.yaml create mode 100644 data/rooms/141.yaml create mode 100644 data/rooms/142.yaml create mode 100644 data/rooms/143.yaml create mode 100644 data/rooms/145.yaml create mode 100644 data/rooms/146.yaml create mode 100644 data/rooms/147.yaml create mode 100644 data/rooms/148.yaml create mode 100644 data/rooms/149.yaml create mode 100644 internal/game/cmd_map.go create mode 100644 internal/game/cmd_option.go delete mode 100644 internal/game/cmd_toggle.go diff --git a/TODO.md b/TODO.md index c049acf..a139835 100644 --- a/TODO.md +++ b/TODO.md @@ -195,7 +195,7 @@ See WORLDBUILDING.md for full examples of every data type with explanations. ### Phase 1: Tiny ASCII Map -- [ ] Limit the room description to 70 characters wide. Add a setting named "maxWidth" in an appropriate section of config.yaml along with comment explaining it. +- [x] Limit the room description to 70 characters wide. Add a setting named "maxWidth" in an appropriate section of config.yaml along with comment explaining it. Next to the block of room description text should be an ASCII mini-map showing the current room as @ and a grid of the rooms and connections surrounding it. A full-size ASCII map for the "map" command will eventually be implemented so keep that in mind for methodology and potential functions we can reuse. Each line of the map should print on the maxWidth+2 character after the description (so there's always at least one space between the description and map) @@ -246,11 +246,11 @@ voices, a symphony of commerce and humanity that hasn't changed in ║o—o generations. Overhead, September clouds drift lazily across the sky, ║| |↑|║ occasionally releasing weak sunlight that transforms the ancient ║o—@—o║ stone beneath countless feet into patches of burnished gold. ║|↓| |║ - ║o—o—o║ - ╚═════╝ + ║o—o—o║ + ╚═════╝ -- [ ] This is a feature that can be toggled with the "tinymap" toggle. If the toggle is off, don't print the map at all. -- [ ] Add a toggle "left-tinymap". If this is enabled, the map should be printed on each line before the room description. For example: +- [x] This is a feature that can be toggled with the "tinymap" toggle. If the toggle is off, don't print the map at all. +- [x] Add a toggle "left-tinymap". If this is enabled, the map should be printed on each line before the room description. For example: Central Market ╔═════╗ The market square pulses with the unbridled energy of a thousand @@ -261,6 +261,17 @@ Central Market ║o—o—o║ ╚═════╝ +### Phase 1b: Map & Option System + +- [x] Replaced `toggle` command with `option`/`options` — supports bool (on/off), string (choice lists), and int option types +- [x] All old toggles migrated to the option system (tinymap, left-tinymap, xpdrops, exits, mobenter, mobleave, mobspawn, reserve, depletion, description) +- [x] Added `color` option (none, ansi, xterm256) +- [x] Added `mapwidth` and `mapheight` options for the `map` command viewport size +- [x] `map` command — renders a full ASCII map centered on the player using BFS graph traversal with geometric coordinate assignment +- [x] Shared BFS graph builder (`buildGraph`) reused by both the tiny map (in `look`) and the `map` command +- [x] Added `mappadding` option (none, x, y, xy) — controls blank-row stripping and left-trimming of map output +- [x] Tiny map built via BFS viewport rendering (3x3 room window at 2x zoom) — no hardcoded corner/cardinal rules, no room duplication + ### Phase 2: Core Skill Chains (breadth over depth) - [x] Woodcutting — tree objects + axes, shared depletion, bird's nests diff --git a/data/help/automap.yaml b/data/help/automap.yaml new file mode 100644 index 0000000..32b84cb --- /dev/null +++ b/data/help/automap.yaml @@ -0,0 +1,13 @@ +name: "automap" +category: "Options" +description: | + Show the full map automatically after each movement. + + Type: boolean (on/off) + Default: off + + When enabled, the map command output is printed after each + room movement, so you always know where you are. + + Map size and padding are controlled by the mapwidth, + mapheight, and mappadding options. diff --git a/data/help/color.yaml b/data/help/color.yaml new file mode 100644 index 0000000..8171ab9 --- /dev/null +++ b/data/help/color.yaml @@ -0,0 +1,13 @@ +name: "color" +category: "Options" +description: | + Color output mode. + + Type: string + Default: none + Values: none, ansi, xterm256 + + Controls the color output format used by the game. + none - No color output + ansi - Standard 16-color ANSI codes + xterm256 - 256-color xterm codes diff --git a/data/help/depletion.yaml b/data/help/depletion.yaml new file mode 100644 index 0000000..d4d8390 --- /dev/null +++ b/data/help/depletion.yaml @@ -0,0 +1,11 @@ +name: "depletion" +category: "Options" +description: | + Show depletion and despawn timers on objects. + + Type: boolean (on/off) + Default: off + + When enabled, resource objects (rocks, trees, etc.) + show their remaining despawn or respawn timers in + the room look output. diff --git a/data/help/description.yaml b/data/help/description.yaml index ab6afa1..3436c5b 100644 --- a/data/help/description.yaml +++ b/data/help/description.yaml @@ -1,11 +1,12 @@ name: "description" -category: "Character" +category: "Options" description: | - View or change your character description. + Show full room descriptions when moving between rooms. - Usage: description, desc + Type: boolean (on/off) + Default: on - Shows your current description (if any) and prompts you to enter a new - one. Other players can see your description by looking at you with - "look ". Press enter without typing anything to keep your - current description. + When enabled, moving into a new room shows the full + room look output including description, mobs, objects, + items, and exits. + When disabled, only the room name is shown on move. diff --git a/data/help/exits.yaml b/data/help/exits.yaml index 673e789..fbfe3a6 100644 --- a/data/help/exits.yaml +++ b/data/help/exits.yaml @@ -1,9 +1,11 @@ name: "exits" -category: "Exploration" +category: "Options" description: | - List exits from the current room. + Show exit destinations in look output. - Usage: exits + Type: boolean (on/off) + Default: on - Shows each exit and the name of the room it leads to. Also toggleable - via "toggle exits" to show destinations inline in the look output. + When enabled, look shows each exit direction and the + name of the room it leads to. + When disabled, only the exit directions are listed. diff --git a/data/help/left-tinymap.yaml b/data/help/left-tinymap.yaml new file mode 100644 index 0000000..689aa89 --- /dev/null +++ b/data/help/left-tinymap.yaml @@ -0,0 +1,11 @@ +name: "left-tinymap" +category: "Options" +description: | + Show the mini-map on the left side of room descriptions. + + Type: boolean (on/off) + Default: off + + When both tinymap and left-tinymap are enabled, the + mini-map appears on the left side of the room description + rather than the right. diff --git a/data/help/map.yaml b/data/help/map.yaml new file mode 100644 index 0000000..3b4917a --- /dev/null +++ b/data/help/map.yaml @@ -0,0 +1,23 @@ +name: "map" +category: "Exploration" +description: | + Display a full map of the surrounding area. + + Usage: map + + The map shows all explored rooms and their connections, + centered on your current location. You are shown as @. + + Map size is controlled by: + option mapwidth (default 30) + option mapheight (default 20) + + Padding/trimming is controlled by: + option mappadding + none - strip blank lines + left-trim (default) + x - strip blank lines only + y - left-trim only + xy - no trimming + + To show the map automatically after each move: + option automap on diff --git a/data/help/mapheight.yaml b/data/help/mapheight.yaml new file mode 100644 index 0000000..ee3920b --- /dev/null +++ b/data/help/mapheight.yaml @@ -0,0 +1,10 @@ +name: "mapheight" +category: "Options" +description: | + Height of the full map display in characters. + + Type: integer + Default: 20 + + Controls how many rows tall the map command + output is. Must be at least 5. diff --git a/data/help/mappadding.yaml b/data/help/mappadding.yaml new file mode 100644 index 0000000..201ef53 --- /dev/null +++ b/data/help/mappadding.yaml @@ -0,0 +1,13 @@ +name: "mappadding" +category: "Options" +description: | + Controls how the map command trims its output. + + Type: string + Default: none + Values: none, x, y, xy + + none - Strip blank rows and left-trim whitespace + x - Strip blank rows only (horizontal trim) + y - Left-trim whitespace only (vertical trim) + xy - No trimming (raw output) diff --git a/data/help/mapwidth.yaml b/data/help/mapwidth.yaml new file mode 100644 index 0000000..7e372ef --- /dev/null +++ b/data/help/mapwidth.yaml @@ -0,0 +1,10 @@ +name: "mapwidth" +category: "Options" +description: | + Width of the full map display in characters. + + Type: integer + Default: 30 + + Controls how many columns wide the map command + output is. Must be at least 5. diff --git a/data/help/mobenter.yaml b/data/help/mobenter.yaml new file mode 100644 index 0000000..529a5a5 --- /dev/null +++ b/data/help/mobenter.yaml @@ -0,0 +1,10 @@ +name: "mobenter" +category: "Options" +description: | + Show messages when mobs enter the room. + + Type: boolean (on/off) + Default: on + + When enabled, you are notified when a mob wanders + into your current room. diff --git a/data/help/mobleave.yaml b/data/help/mobleave.yaml new file mode 100644 index 0000000..06ddeab --- /dev/null +++ b/data/help/mobleave.yaml @@ -0,0 +1,10 @@ +name: "mobleave" +category: "Options" +description: | + Show messages when mobs leave the room. + + Type: boolean (on/off) + Default: on + + When enabled, you are notified when a mob wanders + out of your current room. diff --git a/data/help/mobspawn.yaml b/data/help/mobspawn.yaml new file mode 100644 index 0000000..d6c096f --- /dev/null +++ b/data/help/mobspawn.yaml @@ -0,0 +1,10 @@ +name: "mobspawn" +category: "Options" +description: | + Show messages when mobs spawn in the area. + + Type: boolean (on/off) + Default: on + + When enabled, you are notified when a mob respawns + anywhere in the area. diff --git a/data/help/option.yaml b/data/help/option.yaml new file mode 100644 index 0000000..1948b7a --- /dev/null +++ b/data/help/option.yaml @@ -0,0 +1,20 @@ +name: "option" +category: "General" +description: | + View or change character settings. + + Usage: option - List all options and their current values + options - Same as option + option - Show details for a specific option + option - Set an option to a value + + Boolean options accept on/off, true/false, yes/no, or 1/0. + String options show available choices with option . + Numeric options accept any integer. + + Examples: + option tinymap off + option color ansi + option mapwidth 50 + + Use help