create-asciitorium 0.1.45 → 0.1.47
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.
- package/dist/templates/base/ASCIITORIUM_REFERENCE.md +187 -134
- package/dist/templates/base/public/art/README.md +23 -96
- package/dist/templates/base/public/art/font/README.md +113 -0
- package/dist/templates/base/public/art/fonts/README.md +113 -0
- package/dist/templates/base/public/art/maps/README.md +87 -190
- package/dist/templates/base/public/art/materials/README.md +81 -207
- package/dist/templates/base/public/art/sounds/README.md +9 -0
- package/dist/templates/base/public/art/sprites/README.md +136 -0
- package/dist/templates/base/src/main.tsx +4 -4
- package/dist/templates/base/src/reference-validation.tsx +1 -1
- package/package.json +1 -1
|
@@ -1,48 +1,74 @@
|
|
|
1
|
-
# Maps
|
|
1
|
+
# Asciitorium Maps
|
|
2
2
|
|
|
3
|
-
This directory contains map layouts and legends for
|
|
3
|
+
This directory contains map layouts and legends for the **MapView** and
|
|
4
|
+
**FirstPersonView** components. Maps use ASCII characters for layout, with JSON
|
|
5
|
+
legends defining character properties.
|
|
4
6
|
|
|
5
|
-
##
|
|
7
|
+
## Directory Structure
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Each map requires its own subdirectory with two files:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
maps/
|
|
13
|
+
└─ example/
|
|
14
|
+
├─ map.art # ASCII map layout
|
|
15
|
+
└─ legend.json # Character definitions
|
|
16
|
+
```
|
|
8
17
|
|
|
9
18
|
## Map File Format
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
Map files (`.art`) use ASCII text where each character represents terrain,
|
|
21
|
+
objects, or game elements:
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
```text
|
|
24
|
+
╭───────────────────────────────────┬───╮
|
|
25
|
+
│ │ │
|
|
26
|
+
│ ╷ ╭───────────────┬───────╮ ╰─o─┤
|
|
27
|
+
│ │ │ │ │ │
|
|
28
|
+
│ │ ╵ ╶───────╮ ├─o─╮ ╰───╮ │
|
|
29
|
+
│ │ │ │ │ │ │
|
|
30
|
+
│ ╰───────┬───────╯ ├───┤ ╭───╯ │
|
|
31
|
+
```
|
|
14
32
|
|
|
15
|
-
|
|
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
|
|
33
|
+
### Common Characters
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
- **Box-drawing**: Walls and structures (`╭`, `╮`, `╯`, `╰`, `│`, `─`, `├`,
|
|
36
|
+
`┤`, `┬`, `┴`)
|
|
37
|
+
- **Partial walls**: Incomplete barriers (`╷`, `╵`, `╶`, `╴`)
|
|
38
|
+
- **Special**: Doors (`o`), items, entities
|
|
39
|
+
- **Spaces**: Walkable floor areas
|
|
22
40
|
|
|
23
|
-
|
|
41
|
+
## Legend File Format
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
Legend files (`legend.json`) map characters to properties and assets:
|
|
26
44
|
|
|
27
|
-
|
|
45
|
+
### Structure
|
|
28
46
|
|
|
29
47
|
```json
|
|
30
48
|
{
|
|
31
49
|
"legend": [
|
|
32
50
|
{
|
|
33
51
|
"chars": ["╭", "╮", "╯", "╰", "│", "─"],
|
|
34
|
-
"kind": "material",
|
|
35
52
|
"name": "wall",
|
|
36
53
|
"solid": true,
|
|
37
|
-
"
|
|
54
|
+
"material": "brick-wall"
|
|
38
55
|
},
|
|
39
56
|
{
|
|
40
57
|
"chars": ["o"],
|
|
41
|
-
"kind": "material",
|
|
42
58
|
"name": "door",
|
|
43
59
|
"solid": false,
|
|
44
60
|
"entity": "door",
|
|
45
|
-
"
|
|
61
|
+
"variant": "wooden",
|
|
62
|
+
"material": "wood-door"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"chars": ["b"],
|
|
66
|
+
"name": "bone",
|
|
67
|
+
"solid": false,
|
|
68
|
+
"showOnMap": false,
|
|
69
|
+
"entity": "item",
|
|
70
|
+
"variant": "bone",
|
|
71
|
+
"material": "bone"
|
|
46
72
|
}
|
|
47
73
|
]
|
|
48
74
|
}
|
|
@@ -50,180 +76,44 @@ Legends use an array format where each entry groups characters with shared prope
|
|
|
50
76
|
|
|
51
77
|
### Legend Properties
|
|
52
78
|
|
|
53
|
-
|
|
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.
|
|
68
|
-
|
|
69
|
-
### Entity and Variant System
|
|
70
|
-
|
|
71
|
-
The `entity` and `variant` properties work together to define gameplay behavior:
|
|
72
|
-
|
|
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.)
|
|
75
|
-
|
|
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
|
-
|
|
96
|
-
#### **enemy**
|
|
97
|
-
Hostile creatures or NPCs
|
|
98
|
-
```json
|
|
99
|
-
{
|
|
100
|
-
"chars": ["w"],
|
|
101
|
-
"entity": "enemy",
|
|
102
|
-
"variant": "wolf",
|
|
103
|
-
"solid": true
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
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
|
-
```
|
|
117
|
-
|
|
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
|
-
```
|
|
79
|
+
**Required:**
|
|
141
80
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
"chars": ["L"],
|
|
147
|
-
"entity": "mechanism",
|
|
148
|
-
"variant": "lever",
|
|
149
|
-
"solid": true
|
|
150
|
-
}
|
|
151
|
-
```
|
|
81
|
+
- `chars`: Array of characters sharing these properties
|
|
82
|
+
- `solid`: Blocks player movement (`true`/`false`)
|
|
83
|
+
- `material`: Reference to asset file (e.g., `"brick-wall"`)
|
|
152
84
|
|
|
153
|
-
|
|
154
|
-
Breakable objects like crates or barrels
|
|
155
|
-
```json
|
|
156
|
-
{
|
|
157
|
-
"chars": ["C"],
|
|
158
|
-
"entity": "destructible",
|
|
159
|
-
"variant": "crate",
|
|
160
|
-
"solid": true
|
|
161
|
-
}
|
|
162
|
-
```
|
|
85
|
+
**Optional:**
|
|
163
86
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"entity": "npc",
|
|
170
|
-
"variant": "merchant",
|
|
171
|
-
"solid": true
|
|
172
|
-
}
|
|
173
|
-
```
|
|
87
|
+
- `name`: Human-readable description
|
|
88
|
+
- `showOnMap`: Show in MapView (`true`/`false`, default: `true`)
|
|
89
|
+
- `entity`: Gameplay type (`"door"`, `"enemy"`, `"treasure"`, `"trap"`,
|
|
90
|
+
`"item"`, `"mechanism"`, `"destructible"`, `"npc"`)
|
|
91
|
+
- `variant`: Specific subtype (e.g., `"wooden"`, `"iron"`, `"bone"`)
|
|
174
92
|
|
|
175
|
-
|
|
93
|
+
**Tips:**
|
|
176
94
|
|
|
177
|
-
|
|
95
|
+
- Group multiple characters with identical properties in the `chars` array
|
|
96
|
+
- Use `"showOnMap": false` for items that appear only in first-person view
|
|
97
|
+
- `entity` and `variant` define gameplay behavior (e.g., all doors open/close,
|
|
98
|
+
but wooden doors are weaker than iron)
|
|
178
99
|
|
|
179
|
-
|
|
180
|
-
- `legend.json`: Character-to-object mapping definitions
|
|
181
|
-
- Optional: Additional map variants or related files
|
|
100
|
+
## Using Maps in Your App
|
|
182
101
|
|
|
183
|
-
|
|
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:
|
|
102
|
+
### With GameWorld
|
|
201
103
|
|
|
202
104
|
```tsx
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
/>
|
|
208
|
-
```
|
|
105
|
+
const gameWorld = new GameWorld({
|
|
106
|
+
mapName: 'example',
|
|
107
|
+
initialPosition: { x: 5, y: 5, direction: 'north' }
|
|
108
|
+
});
|
|
209
109
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
|
110
|
+
<MapView gameWorld={gameWorld} fogOfWar={true} />
|
|
111
|
+
<FirstPersonView gameWorld={gameWorld} scene="brick-wall" />
|
|
112
|
+
```
|
|
223
113
|
|
|
224
114
|
### Automated Generation
|
|
225
115
|
|
|
226
|
-
|
|
116
|
+
Use the map builder script for quick dungeon generation:
|
|
227
117
|
|
|
228
118
|
```bash
|
|
229
119
|
node scripts/map-builder.js <width> <height> <directory-name> [--smooth]
|
|
@@ -232,20 +122,27 @@ node scripts/map-builder.js <width> <height> <directory-name> [--smooth]
|
|
|
232
122
|
**Examples:**
|
|
233
123
|
|
|
234
124
|
```bash
|
|
235
|
-
#
|
|
125
|
+
# Basic 20x15 map
|
|
236
126
|
node scripts/map-builder.js 20 15 my-dungeon
|
|
237
127
|
|
|
238
|
-
#
|
|
239
|
-
node scripts/map-builder.js 30 20 castle
|
|
128
|
+
# Smooth Unicode box-drawing characters
|
|
129
|
+
node scripts/map-builder.js 30 20 castle --smooth
|
|
240
130
|
```
|
|
241
131
|
|
|
242
|
-
|
|
132
|
+
The script generates a maze-like layout with corridors and rooms, creating both
|
|
133
|
+
`map.art` and directory structure as a starting point for customization.
|
|
243
134
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
135
|
+
## Technical Details
|
|
136
|
+
|
|
137
|
+
### Loading
|
|
138
|
+
|
|
139
|
+
Maps are loaded asynchronously via `AssetManager`:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
const mapAsset = await AssetManager.getMap('example');
|
|
143
|
+
```
|
|
248
144
|
|
|
249
|
-
|
|
145
|
+
### Caching
|
|
250
146
|
|
|
251
|
-
|
|
147
|
+
Map and legend assets are cached on first load - subsequent uses reuse cached
|
|
148
|
+
data.
|