create-asciitorium 0.1.46 → 0.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/templates/base/ASCIITORIUM_REFERENCE.md +45 -30
  2. package/dist/templates/base/public/art/README.md +82 -83
  3. package/dist/templates/base/public/art/fonts/README.md +115 -0
  4. package/dist/templates/base/public/art/maps/README.md +89 -190
  5. package/dist/templates/base/public/art/materials/README.md +82 -206
  6. package/dist/templates/base/public/art/sounds/README.md +11 -0
  7. package/dist/templates/base/public/art/sprites/README.md +138 -0
  8. package/dist/templates/base/src/main.tsx +4 -4
  9. package/dist/templates/base/vite.config.ts +12 -1
  10. package/package.json +1 -1
  11. package/dist/templates/base/public/art/ART-DESIGN-SPEC.md +0 -375
  12. package/dist/templates/base/public/art/font/pencil.art +0 -168
  13. package/dist/templates/base/public/art/maps/example/README.md +0 -62
  14. package/dist/templates/base/public/art/maps/example/legend.json +0 -29
  15. package/dist/templates/base/public/art/maps/example/map.art +0 -21
  16. package/dist/templates/base/public/art/materials/bone.art +0 -11
  17. package/dist/templates/base/public/art/materials/door-wooden.art +0 -154
  18. package/dist/templates/base/public/art/materials/wall-brick.art +0 -128
  19. package/dist/templates/base/public/art/materials/wall-wireframe.art +0 -128
  20. package/dist/templates/base/public/art/sounds/door-close.mp3 +0 -0
  21. package/dist/templates/base/public/art/sounds/door-open.mp3 +0 -0
  22. package/dist/templates/base/public/art/sounds/taps.mp3 +0 -0
  23. package/dist/templates/base/public/art/sprites/asciitorium.art +0 -6
  24. package/dist/templates/base/public/art/sprites/balloon.art +0 -126
  25. package/dist/templates/base/public/art/sprites/beating-heart.art +0 -49
  26. package/dist/templates/base/public/art/sprites/castle.art +0 -4
  27. package/dist/templates/base/public/art/sprites/component-icon.art +0 -6
  28. package/dist/templates/base/public/art/sprites/eyes.art +0 -61
  29. package/dist/templates/base/public/art/sprites/firework.art +0 -58
  30. package/dist/templates/base/public/art/sprites/heart.art +0 -5
  31. package/dist/templates/base/public/art/sprites/multi-select-test.art +0 -6
  32. package/dist/templates/base/public/art/sprites/nav-basics.art +0 -5
  33. package/dist/templates/base/public/art/sprites/pyramid.art +0 -5
  34. package/dist/templates/base/public/art/sprites/welcome.art +0 -7
  35. package/dist/templates/base/src/reference-validation.tsx +0 -307
@@ -1,48 +1,76 @@
1
- # Maps Directory
1
+ # Asciitorium Maps
2
2
 
3
- This directory contains map layouts and legends for game environments in asciitorium. Maps are typically stored as text files with ASCII characters representing different terrain types, while legend files (JSON format) define what each character represents.
3
+ > **Note**: This directory is empty by default. The asciitorium library includes starter assets in `node_modules/asciitorium/public/art/maps/` that are automatically available without copying. See the main [art/README.md](../README.md) for details on using and customizing library assets.
4
4
 
5
- ## Contents
5
+ This directory contains map layouts and legends for the **MapView** and
6
+ **FirstPersonView** components. Maps use ASCII characters for layout, with JSON
7
+ legends defining character properties.
6
8
 
7
- - `example/`: Sample map directory demonstrating map and legend file organization
9
+ ## Directory Structure
10
+
11
+ Each map requires its own subdirectory with two files:
12
+
13
+ ```text
14
+ maps/
15
+ └─ example/
16
+ ├─ map.art # ASCII map layout
17
+ └─ legend.json # Character definitions
18
+ ```
8
19
 
9
20
  ## Map File Format
10
21
 
11
- Maps use ASCII text files where each character represents a different type of terrain, object, or game element. The visual representation uses various ASCII characters to create recognizable layouts.
22
+ Map files (`.art`) use ASCII text where each character represents terrain,
23
+ objects, or game elements:
12
24
 
13
- ### Common Map Characters
25
+ ```text
26
+ ╭───────────────────────────────────┬───╮
27
+ │ │ │
28
+ │ ╷ ╭───────────────┬───────╮ ╰─o─┤
29
+ │ │ │ │ │ │
30
+ │ │ ╵ ╶───────╮ ├─o─╮ ╰───╮ │
31
+ │ │ │ │ │ │ │
32
+ │ ╰───────┬───────╯ ├───┤ ╭───╯ │
33
+ ```
14
34
 
15
- - **Box-drawing characters**: For walls and structures (`╭`, `╮`, `╯`, `╰`, `│`, `─`, `├`, `┤`, `┬`, `┴`)
16
- - **Partial walls**: For incomplete barriers (`╷`, `╵`, `╶`, `╴`)
17
- - **Special characters**: For doors (`o`), spawn points, or interactive elements
18
- - **Spaces**: For walkable floor areas
19
- - **Custom characters**: Any ASCII character can be assigned meaning through legends
35
+ ### Common Characters
20
36
 
21
- ## Legend Files
37
+ - **Box-drawing**: Walls and structures (`╭`, `╮`, `╯`, `╰`, `│`, `─`, `├`,
38
+ `┤`, `┬`, `┴`)
39
+ - **Partial walls**: Incomplete barriers (`╷`, `╵`, `╶`, `╴`)
40
+ - **Special**: Doors (`o`), items, entities
41
+ - **Spaces**: Walkable floor areas
22
42
 
23
- Each map should have an accompanying `legend.json` file that defines what each character represents. This allows the game engine to understand collision, rendering, and gameplay properties.
43
+ ## Legend File Format
24
44
 
25
- ### Legend Structure
45
+ Legend files (`legend.json`) map characters to properties and assets:
26
46
 
27
- Legends use an array format where each entry groups characters with shared properties:
47
+ ### Structure
28
48
 
29
49
  ```json
30
50
  {
31
51
  "legend": [
32
52
  {
33
53
  "chars": ["╭", "╮", "╯", "╰", "│", "─"],
34
- "kind": "material",
35
54
  "name": "wall",
36
55
  "solid": true,
37
- "asset": "material/brick-wall"
56
+ "material": "brick-wall"
38
57
  },
39
58
  {
40
59
  "chars": ["o"],
41
- "kind": "material",
42
60
  "name": "door",
43
61
  "solid": false,
44
62
  "entity": "door",
45
- "asset": "material/wood-door-on-brick-wall"
63
+ "variant": "wooden",
64
+ "material": "wood-door"
65
+ },
66
+ {
67
+ "chars": ["b"],
68
+ "name": "bone",
69
+ "solid": false,
70
+ "showOnMap": false,
71
+ "entity": "item",
72
+ "variant": "bone",
73
+ "material": "bone"
46
74
  }
47
75
  ]
48
76
  }
@@ -50,180 +78,44 @@ Legends use an array format where each entry groups characters with shared prope
50
78
 
51
79
  ### Legend Properties
52
80
 
53
- #### Required Properties
54
-
55
- - **chars**: Array of characters that share the same properties (e.g., all wall variations)
56
- - **kind**: Type of asset (`"material"` for terrain/environment, `"sprite"` for animated entities)
57
- - **solid**: Whether the object blocks player movement (`true`/`false`)
58
- - **asset**: Reference to visual asset file in the materials or sprites directories
59
-
60
- #### Optional Properties
61
-
62
- - **name**: Human-readable description for the object type
63
- - **visible**: Whether the object appears in map view (`true`/`false`). Defaults to `true`. When `false`, renders as a space in MapView but still appears in first-person view. Useful for ground items, invisible triggers, or objects that should only be visible up close.
64
- - **entity**: Gameplay entity type that defines behavior (e.g., `"door"`, `"enemy"`, `"treasure"`, `"trap"`, `"item"`)
65
- - **variant**: Specific subtype of the entity (e.g., `"wooden"`, `"iron"`, `"magic"`, `"bone"`)
66
-
67
- **Note:** The `chars` array allows you to group multiple map characters that share identical properties, significantly reducing legend file size and making them easier to maintain.
81
+ **Required:**
68
82
 
69
- ### Entity and Variant System
83
+ - `chars`: Array of characters sharing these properties
84
+ - `solid`: Blocks player movement (`true`/`false`)
85
+ - `material`: Reference to asset file (e.g., `"brick-wall"`)
70
86
 
71
- The `entity` and `variant` properties work together to define gameplay behavior:
87
+ **Optional:**
72
88
 
73
- - **entity**: The primary type that determines how the game handles interactions (door, enemy, treasure, trap, item, etc.)
74
- - **variant**: The specific implementation or subtype (wooden-door, iron-door, wolf, bone, spike-trap, etc.)
89
+ - `name`: Human-readable description
90
+ - `showOnMap`: Show in MapView (`true`/`false`, default: `true`)
91
+ - `entity`: Gameplay type (`"door"`, `"enemy"`, `"treasure"`, `"trap"`,
92
+ `"item"`, `"mechanism"`, `"destructible"`, `"npc"`)
93
+ - `variant`: Specific subtype (e.g., `"wooden"`, `"iron"`, `"bone"`)
75
94
 
76
- This separation allows for:
77
- - Shared behavior across similar entities (all doors can be opened/closed)
78
- - Variant-specific properties (wooden doors are weak, iron doors are strong)
79
- - Clear gameplay categorization
80
-
81
- ### Common Entity Types
82
-
83
- Here are standard entity types used in dungeon crawlers:
84
-
85
- #### **door**
86
- Openable/closable passages, may be locked
87
- ```json
88
- {
89
- "chars": ["o"],
90
- "entity": "door",
91
- "variant": "wooden",
92
- "solid": false
93
- }
94
- ```
95
+ **Tips:**
95
96
 
96
- #### **enemy**
97
- Hostile creatures or NPCs
98
- ```json
99
- {
100
- "chars": ["w"],
101
- "entity": "enemy",
102
- "variant": "wolf",
103
- "solid": true
104
- }
105
- ```
97
+ - Group multiple characters with identical properties in the `chars` array
98
+ - Use `"showOnMap": false` for items that appear only in first-person view
99
+ - `entity` and `variant` define gameplay behavior (e.g., all doors open/close,
100
+ but wooden doors are weaker than iron)
106
101
 
107
- #### **treasure**
108
- Collectible currency or valuables
109
- ```json
110
- {
111
- "chars": ["g"],
112
- "entity": "treasure",
113
- "variant": "gold-pile",
114
- "solid": false
115
- }
116
- ```
102
+ ## Using Maps in Your App
117
103
 
118
- #### **item**
119
- Pickup-able objects for inventory
120
- ```json
121
- {
122
- "chars": ["b"],
123
- "entity": "item",
124
- "variant": "bone",
125
- "solid": false,
126
- "visible": false
127
- }
128
- ```
129
- **Note:** Items often use `"visible": false` so they appear in first-person view but not on the map, creating a more immersive exploration experience.
130
-
131
- #### **trap**
132
- Hazards that trigger on player interaction
133
- ```json
134
- {
135
- "chars": ["^"],
136
- "entity": "trap",
137
- "variant": "spike",
138
- "solid": false
139
- }
140
- ```
141
-
142
- #### **mechanism**
143
- Switches, levers, pressure plates
144
- ```json
145
- {
146
- "chars": ["L"],
147
- "entity": "mechanism",
148
- "variant": "lever",
149
- "solid": true
150
- }
151
- ```
152
-
153
- #### **destructible**
154
- Breakable objects like crates or barrels
155
- ```json
156
- {
157
- "chars": ["C"],
158
- "entity": "destructible",
159
- "variant": "crate",
160
- "solid": true
161
- }
162
- ```
163
-
164
- #### **npc**
165
- Non-hostile characters for dialog/quests
166
- ```json
167
- {
168
- "chars": ["@"],
169
- "entity": "npc",
170
- "variant": "merchant",
171
- "solid": true
172
- }
173
- ```
174
-
175
- ## Directory Organization
176
-
177
- Each map should be organized in its own subdirectory containing:
178
-
179
- - `map.art`: The ASCII map layout file
180
- - `legend.json`: Character-to-object mapping definitions
181
- - Optional: Additional map variants or related files
182
-
183
- Example structure:
184
-
185
- ```text
186
- maps/
187
- ├─ underground/
188
- │ ├─ map.art
189
- │ └─ legend.json
190
- ├─ overworld/
191
- │ ├─ map.art
192
- │ └─ legend.json
193
- └─ example/
194
- ├─ map.art
195
- └─ legend.json
196
- ```
197
-
198
- ## Usage in Asciitorium
199
-
200
- Maps are loaded by the `MapView` component using the `src` property:
104
+ ### With GameWorld
201
105
 
202
106
  ```tsx
203
- <MapView
204
- src="./art/maps/example/map.art"
205
- player={playerPosition}
206
- fogOfWar={false}
207
- />
208
- ```
107
+ const gameWorld = new GameWorld({
108
+ mapName: 'example',
109
+ initialPosition: { x: 5, y: 5, direction: 'north' }
110
+ });
209
111
 
210
- The component automatically looks for the corresponding `legend.json` file in the same directory to understand how to interpret the map characters.
211
-
212
- ## Creating New Maps
213
-
214
- ### Manual Creation
215
-
216
- When creating new maps manually:
217
-
218
- 1. Design your layout using ASCII characters in a text file
219
- 2. Create a `legend.json` file defining what each character represents
220
- 3. Organize both files in a dedicated subdirectory
221
- 4. Reference appropriate assets in the materials and sprites directories
222
- 5. Test with the `MapView` component to ensure proper rendering and collision
112
+ <MapView gameWorld={gameWorld} fogOfWar={true} />
113
+ <FirstPersonView gameWorld={gameWorld} scene="brick-wall" />
114
+ ```
223
115
 
224
116
  ### Automated Generation
225
117
 
226
- For quick map generation, use the included `map-builder.js` script:
118
+ Use the map builder script for quick dungeon generation:
227
119
 
228
120
  ```bash
229
121
  node scripts/map-builder.js <width> <height> <directory-name> [--smooth]
@@ -232,20 +124,27 @@ node scripts/map-builder.js <width> <height> <directory-name> [--smooth]
232
124
  **Examples:**
233
125
 
234
126
  ```bash
235
- # Generate a basic 20x15 map in 'my-dungeon' directory
127
+ # Basic 20x15 map
236
128
  node scripts/map-builder.js 20 15 my-dungeon
237
129
 
238
- # Generate a map with smooth Unicode box-drawing characters
239
- node scripts/map-builder.js 30 20 castle-level --smooth
130
+ # Smooth Unicode box-drawing characters
131
+ node scripts/map-builder.js 30 20 castle --smooth
240
132
  ```
241
133
 
242
- **Options:**
134
+ The script generates a maze-like layout with corridors and rooms, creating both
135
+ `map.art` and directory structure as a starting point for customization.
243
136
 
244
- - `width`: Map width in characters
245
- - `height`: Map height in characters
246
- - `directory-name`: Name of the directory to create (saved to `public/art/maps/<directory-name>/map.art`)
247
- - `--smooth`: Use Unicode box-drawing characters for smoother appearance
137
+ ## Technical Details
138
+
139
+ ### Loading
140
+
141
+ Maps are loaded asynchronously via `AssetManager`:
142
+
143
+ ```typescript
144
+ const mapAsset = await AssetManager.getMap('example');
145
+ ```
248
146
 
249
- The script automatically generates a maze-like layout with corridors and rooms, creating both a `map.art` file and the proper directory structure. This provides a perfect starting point for dungeon-style maps that you can then customize manually.
147
+ ### Caching
250
148
 
251
- Use the `example/` directory as a reference for proper file organization and legend format.
149
+ Map and legend assets are cached on first load - subsequent uses reuse cached
150
+ data.