narrat 2.2.4 → 2.2.7
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/CHANGELOG.md +1081 -0
- package/LICENSE +21 -21
- package/README.md +120 -120
- package/dist/.DS_Store +0 -0
- package/dist/app.vue.d.ts +92 -92
- package/dist/components/MainMenu.vue.d.ts +12 -12
- package/dist/components/Skills.vue.d.ts +22 -22
- package/dist/components/StartMenu.vue.d.ts +46 -46
- package/dist/components/debug/debug-menu.vue.d.ts +48 -48
- package/dist/components/dialog-picture.vue.d.ts +9 -9
- package/dist/components/game-dialog.vue.d.ts +65 -65
- package/dist/components/hud.vue.d.ts +14 -14
- package/dist/components/inventory-ui.vue.d.ts +30 -30
- package/dist/components/loading-bar.vue.d.ts +10 -10
- package/dist/components/menu-buttons.vue.d.ts +26 -26
- package/dist/components/notification-toast.vue.d.ts +6 -6
- package/dist/components/quests-ui.vue.d.ts +20 -20
- package/dist/components/save-slots.vue.d.ts +58 -58
- package/dist/components/screen-layer.vue.d.ts +54 -54
- package/dist/components/screens.vue.d.ts +46 -46
- package/dist/components/utils/modal.vue.d.ts +6 -6
- package/dist/components/volume-controls.vue.d.ts +18 -18
- package/dist/config.d.ts +170 -170
- package/dist/constants.d.ts +7 -7
- package/dist/defaultConfig.d.ts +2 -2
- package/dist/demo/demo.d.ts +1 -1
- package/dist/dialog-box.vue.d.ts +41 -41
- package/dist/exports/config.d.ts +1 -1
- package/dist/exports/display.d.ts +2 -2
- package/dist/exports/plugins.d.ts +20 -20
- package/dist/img/.DS_Store +0 -0
- package/dist/lib/lib.d.ts +15 -15
- package/dist/main.d.ts +5 -5
- package/dist/music/.DS_Store +0 -0
- package/dist/narrat.es.js +33797 -30997
- package/dist/narrat.es.js.map +1 -1
- package/dist/narrat.umd.js +105 -92
- package/dist/narrat.umd.js.map +1 -1
- package/dist/plugins/NarratPlugin.d.ts +11 -11
- package/dist/sounds/.DS_Store +0 -0
- package/dist/stores/audio-store.d.ts +48 -48
- package/dist/stores/dialog-store.d.ts +32 -32
- package/dist/stores/hud-stats-store.d.ts +22 -22
- package/dist/stores/inventory-store.d.ts +37 -37
- package/dist/stores/main-store.d.ts +390 -390
- package/dist/stores/notification-store.d.ts +15 -15
- package/dist/stores/quest-log.d.ts +39 -39
- package/dist/stores/rendering-store.d.ts +13 -13
- package/dist/stores/screens-store.d.ts +23 -23
- package/dist/stores/skills.d.ts +40 -40
- package/dist/stores/vm-store.d.ts +177 -177
- package/dist/types/app-types.d.ts +5 -5
- package/dist/types/character-types.d.ts +27 -27
- package/dist/types/dialog-box-types.d.ts +11 -11
- package/dist/types/game-save.d.ts +30 -30
- package/dist/types/parser.d.ts +93 -93
- package/dist/types/state.d.ts +3 -3
- package/dist/utils/InputsListener.d.ts +9 -9
- package/dist/utils/ajax.d.ts +1 -1
- package/dist/utils/audio-loader.d.ts +10 -10
- package/dist/utils/characters.d.ts +5 -5
- package/dist/utils/data-helpers.d.ts +25 -25
- package/dist/utils/debounce.d.ts +14 -14
- package/dist/utils/error-handling.d.ts +3 -3
- package/dist/utils/helpers.d.ts +6 -6
- package/dist/utils/images-loader.d.ts +6 -6
- package/dist/utils/logger.d.ts +11 -11
- package/dist/utils/object-iterators.d.ts +8 -8
- package/dist/utils/promises.d.ts +1 -1
- package/dist/utils/randomId.d.ts +1 -1
- package/dist/utils/save-helpers.d.ts +15 -15
- package/dist/utils/skillchecks.d.ts +17 -17
- package/dist/utils/string-helpers.d.ts +3 -3
- package/dist/utils/time-helpers.d.ts +2 -2
- package/dist/utils/type-utils.d.ts +1 -1
- package/dist/utils/typed-emitter.d.ts +18 -18
- package/dist/vm/commands/arithmetic-commands.d.ts +23 -23
- package/dist/vm/commands/audio-commands.d.ts +15 -15
- package/dist/vm/commands/choice.d.ts +37 -37
- package/dist/vm/commands/clear_dialog.d.ts +2 -2
- package/dist/vm/commands/command-helpers.d.ts +3 -3
- package/dist/vm/commands/command-plugin.d.ts +43 -43
- package/dist/vm/commands/flow-commands.d.ts +17 -17
- package/dist/vm/commands/if.d.ts +10 -10
- package/dist/vm/commands/index.d.ts +2 -2
- package/dist/vm/commands/inventory-commands.d.ts +15 -15
- package/dist/vm/commands/logic-command.d.ts +42 -42
- package/dist/vm/commands/math-commands.d.ts +30 -30
- package/dist/vm/commands/notify.d.ts +6 -6
- package/dist/vm/commands/quest-commands.d.ts +30 -30
- package/dist/vm/commands/random-commands.d.ts +10 -10
- package/dist/vm/commands/screen-commands.d.ts +12 -12
- package/dist/vm/commands/set.d.ts +6 -6
- package/dist/vm/commands/skill-commands.d.ts +30 -30
- package/dist/vm/commands/stats-commands.d.ts +12 -12
- package/dist/vm/commands/string-commands.d.ts +9 -9
- package/dist/vm/commands/text-field.d.ts +7 -7
- package/dist/vm/commands/text.d.ts +14 -14
- package/dist/vm/commands/wait.d.ts +4 -4
- package/dist/vm/vm-helpers.d.ts +18 -18
- package/dist/vm/vm-parser.d.ts +19 -19
- package/dist/vm/vm-parser.test.d.ts +1 -1
- package/dist/vm/vm.d.ts +18 -18
- package/package.json +87 -87
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
# Narrat changelog
|
|
2
|
+
|
|
3
|
+
## 2.2.3
|
|
4
|
+
|
|
5
|
+
New `think` command. Works the same as talk, but doesn't wrap text in quotes.
|
|
6
|
+
|
|
7
|
+
It also has custom CSS so each version of text can be customised. talk commands add the CSS class `talk-command`, think: `think-command`, and the basic text command adds `text-command`.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
```py
|
|
12
|
+
think player idle "I wonder if I could eat a whole pizza in 28 seconds"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 2.2.2
|
|
16
|
+
|
|
17
|
+
New notification commands and options:
|
|
18
|
+
|
|
19
|
+
- `disable_notifications`: Disables notifications
|
|
20
|
+
- `enable_notifications`: Enables notifications
|
|
21
|
+
|
|
22
|
+
New config option: `skillOptions.notifyLevelUp` (boolean). Default: true. If set to false, will disable notifications from level ups for the whole game.
|
|
23
|
+
|
|
24
|
+
## 2.2.1
|
|
25
|
+
|
|
26
|
+
Notifications can now use html tags and string interpolation
|
|
27
|
+
|
|
28
|
+
Example: `notify "Hello <span style='color:red;'>%{playerName}</span>"` will work
|
|
29
|
+
|
|
30
|
+
## 2.2.0
|
|
31
|
+
|
|
32
|
+
Audio improvements:
|
|
33
|
+
|
|
34
|
+
- New audio mode: `ambiant` for ambiant music/sound
|
|
35
|
+
- New audio channels feature: Optional `channel` parameter in `play`, `stop` and `pause` commands to choose a channel (defaults to 0). This allows having multiple musics, or multiple ambiant sounds to play at once.
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
|
|
39
|
+
- `play music calm` will play the music `calm` on channel 0.
|
|
40
|
+
- `wait 2000`
|
|
41
|
+
- `play music calm 1` will play the music `calm` on channel 1. Because it's a different channel, the musics will superpose
|
|
42
|
+
- `wait 2000`
|
|
43
|
+
- `stop music 1` will stop the music on channel 1.
|
|
44
|
+
- `play ambiant forest` will play the ambiant sound `forest` on channel 0. This is a different audio mode, so it will be played independently of the musics.
|
|
45
|
+
|
|
46
|
+
Sounds now also use channels, but they ignore all the code related to fading musics in and out, or stopping the previous audio on the channel (because sounds are meant to be a one off and people shouldn't have to bother keeping track of sound channels).
|
|
47
|
+
|
|
48
|
+
To stop the last audio played on the channel `stop sound` works. It is still possible to use channels with sounds (`play sound bang 1` then later `stop sound 1`), but it shouldn't be necessary.
|
|
49
|
+
|
|
50
|
+
## 2.1.6
|
|
51
|
+
|
|
52
|
+
Fixed an issue where the `random` command didn't accept 0 as a number
|
|
53
|
+
|
|
54
|
+
## 2.1.5
|
|
55
|
+
|
|
56
|
+
Bugfixes related to save slots edge cases
|
|
57
|
+
|
|
58
|
+
## 2.1.4
|
|
59
|
+
|
|
60
|
+
New math commands:
|
|
61
|
+
|
|
62
|
+
- `floor`: Turns a number into an integer (whole number), rounding down.
|
|
63
|
+
- `ceil`: Turns a number into an integer (whole number), rounding up.
|
|
64
|
+
- `round`: Rounds a number to the nearest integer.
|
|
65
|
+
- `sqrt`: Square root of a number.
|
|
66
|
+
- `^`: Exponentiation.
|
|
67
|
+
|
|
68
|
+
Also, the `set_level` and `add_level` commands will give a warning and auto round values passed if they're not whole numbers.
|
|
69
|
+
|
|
70
|
+
### Save slots
|
|
71
|
+
|
|
72
|
+
The engine now supports save slots. The "Load game" button will open a window for the player to choose a save file to load.
|
|
73
|
+
|
|
74
|
+
There is also a new "Continue" button that will appear if the player has already played to continue playing on the same slot as last time.
|
|
75
|
+
|
|
76
|
+
## 2.1.3
|
|
77
|
+
|
|
78
|
+
There is now access to the game's config and app options in script, notably useful to check if the game is in debug mode. New available options:
|
|
79
|
+
|
|
80
|
+
`$config`: The game's config.
|
|
81
|
+
`$gameOptions`: The options passed when launching the game with `startApp`
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
|
|
85
|
+
```rpy
|
|
86
|
+
main:
|
|
87
|
+
if $gameOptions.debug:
|
|
88
|
+
"Do something in debug mode"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 2.1.2
|
|
92
|
+
|
|
93
|
+
### Internal Refactor
|
|
94
|
+
|
|
95
|
+
The scripting engine has been refactored internally to differentiate between blocks and frames. A frame in the stack is now a function call (running a label or jumping), whereas blocks are for branching. That means any block inside a frame still has access to the same scoped variables (which are stored in the frame), and `return` can now be called anywhere inside a function and will interrupt the function and return, like in other languages.
|
|
96
|
+
|
|
97
|
+
### Bugfixes
|
|
98
|
+
|
|
99
|
+
- There was an issue with the `text` command from the fix in 2.1.1, now solved
|
|
100
|
+
- There were various issues affecting performance and logic in keyboard handling with the dialogue box which are now fixed
|
|
101
|
+
- Added a bit of debouncing on the keyboard events because there was an issue when speeding through games
|
|
102
|
+
|
|
103
|
+
### Keyboard events in production
|
|
104
|
+
|
|
105
|
+
Previously, the engine was using a `keydown` event for picking choices with the keyboard. This allowed speeding through the game quickly, but shouldn't be possible in production.
|
|
106
|
+
|
|
107
|
+
The engine now instead uses a `keyup` event if the debug mode is up, to make it impossible to speed through the game by holding space for normal players.
|
|
108
|
+
|
|
109
|
+
## 2.1.1
|
|
110
|
+
|
|
111
|
+
fix: The `text` command (default command for printing text without using `talk`) was adding quotes around text since 2.0.0. This is now fixed.
|
|
112
|
+
|
|
113
|
+
## 2.1.0
|
|
114
|
+
|
|
115
|
+
### ⚠️ Breaking Change ⚠️
|
|
116
|
+
|
|
117
|
+
Narrat has been updated to use [vite 3](https://vitejs.dev/blog/announcing-vite3.html#the-ecosystem-is-ready-for-v3). The only breaking change is that the path of the narrat CSS file has changed:
|
|
118
|
+
|
|
119
|
+
In the game's `index.ts` the import of CSS needs to change. Before:
|
|
120
|
+
|
|
121
|
+
`import 'narrat/dist/lib.css';`
|
|
122
|
+
|
|
123
|
+
After:
|
|
124
|
+
|
|
125
|
+
`import "narrat/dist/style.css";`
|
|
126
|
+
|
|
127
|
+
Many new features, TODO: fill changelog.
|
|
128
|
+
|
|
129
|
+
### Data shorthand
|
|
130
|
+
|
|
131
|
+
It is now no longer necessary to prefix things with `data` when setting or getting variables.
|
|
132
|
+
|
|
133
|
+
For example `set player.name` is equivalent to `set data.player.name`.
|
|
134
|
+
|
|
135
|
+
The way the system works when looking up variables is:
|
|
136
|
+
|
|
137
|
+
- Return if there's a base variable in the lookup state matching (for example `data`, `skills` etc)
|
|
138
|
+
- Otherwise if a variable exists in the local scope (created with `var`) use that
|
|
139
|
+
- Otherwise default to assuming we're editing something inside `data`
|
|
140
|
+
|
|
141
|
+
### New example RPG game
|
|
142
|
+
|
|
143
|
+
There is now an example [dungeon crawler turn based RPG](https://github.com/liana-p/narrat/tree/main/examples/rpg) game made as a test to push the engine and scripting features. It is not meant to be a full game, but can be a useful reference for advanced usage.
|
|
144
|
+
|
|
145
|
+
### Anchor feature for buttons
|
|
146
|
+
|
|
147
|
+
There is now an optional `anchor` property for buttons, useful for anchoring a buttom from its center or any other place.
|
|
148
|
+
|
|
149
|
+
Example:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"buttons": {
|
|
154
|
+
"go_front": {
|
|
155
|
+
"enabled": false,
|
|
156
|
+
"background": "img/ui/front.png",
|
|
157
|
+
"position": {
|
|
158
|
+
"left": 440,
|
|
159
|
+
"top": 120,
|
|
160
|
+
"width": 96,
|
|
161
|
+
"height": 96
|
|
162
|
+
},
|
|
163
|
+
"anchor": {
|
|
164
|
+
"x": 0.5,
|
|
165
|
+
"y": 0.5
|
|
166
|
+
},
|
|
167
|
+
"action": "choose_front"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Base assets path
|
|
174
|
+
|
|
175
|
+
There is now a way to pass a base assets path to narrat, which will be prepended to the path of any assets that need to be loaded by the engine (this was needed to implement the multiple demos in a single repo).
|
|
176
|
+
|
|
177
|
+
The option is `baseAssetsPath` which can be passed in the first options object of `startApp`.
|
|
178
|
+
|
|
179
|
+
See the `demo.ts` file for an example of how to use it.
|
|
180
|
+
|
|
181
|
+
### Game examples now in the repo
|
|
182
|
+
|
|
183
|
+
The repo has been restructures to allow having multiple example games directly inside it.
|
|
184
|
+
|
|
185
|
+
The `examples/` folder contains a subfolder for each demo game, where the data/asset files for a game can be placed.
|
|
186
|
+
|
|
187
|
+
To run an example game, the dev script needs to be run with a special environment variable pointing to the path of the game to run. For example, a command has been added to run the rpg game:
|
|
188
|
+
|
|
189
|
+
`npm run rpg` -> Runs `cross-env VITE_EXAMPLE=examples/rpg npx vite dev`
|
|
190
|
+
|
|
191
|
+
Demo games can also be built from the repo. For example:
|
|
192
|
+
|
|
193
|
+
`npm run build-rpg` -> Runs `cross-env VITE_DEMO_BUILD=rpg npx vite build && shx cp -r examples/rpg/* built-example/rpg`. The built game is then available in the `built-example/rpg` folder.
|
|
194
|
+
|
|
195
|
+
### New commands
|
|
196
|
+
|
|
197
|
+
Added a lot of new commands while making the RPG example.
|
|
198
|
+
|
|
199
|
+
#### Math operations
|
|
200
|
+
|
|
201
|
+
- Negate numbers: `neg 1` -> returns -1
|
|
202
|
+
- Absolute function: `abs -1` -> returns 1
|
|
203
|
+
- Min - returns lowest passed number: `min 1 2` -> returns 1
|
|
204
|
+
- Max - returns highest passed number: `max 1 2` -> returns 2
|
|
205
|
+
- Clamp - returns number between min and max: `clamp 1 2 3` -> returns 2 (syntax: `clamp [min] [max] [value]`)
|
|
206
|
+
|
|
207
|
+
#### Random generation
|
|
208
|
+
|
|
209
|
+
- Random number: `random 1 10` -> returns an **integer** random number between 1 and 10 (inclusive)
|
|
210
|
+
- Random float: `random_float 1 10` -> returns a float between 1 and 10
|
|
211
|
+
- Random from args: `random_from_args "a thing" "another thing" 2 "things can be any value"` -> returns a random item from the list of arguments
|
|
212
|
+
|
|
213
|
+
#### Strings
|
|
214
|
+
|
|
215
|
+
- Concat: `concat "a" "b"` -> returns "ab" (Syntax: `concat [string1] [string2] [string3]...`)
|
|
216
|
+
- Join: `join ", " "a" "b"` -> returns "a, b" (Syntax: `join [separator] [item1] [item2] [item3] ...`)
|
|
217
|
+
|
|
218
|
+
#### Skills
|
|
219
|
+
|
|
220
|
+
- Set level: `set_level agility 1` -> sets the level of the skill "agility" to 1
|
|
221
|
+
- Get level: `get_level agility` -> returns the level of the skill "agility"
|
|
222
|
+
- Get xp: `get_xp agility` -> returns the xp of the skill "agility"
|
|
223
|
+
|
|
224
|
+
#### Utility
|
|
225
|
+
|
|
226
|
+
- Log: `log $someVariable` -> logs the value of the variable $someVariable to the console (Syntax: `log [value1] [value2] [value3]...`). Can be used to log anything for debugging
|
|
227
|
+
|
|
228
|
+
## 2.0.12
|
|
229
|
+
|
|
230
|
+
New layers feature: Multiple screens can be overlaid on top of each other in layers.
|
|
231
|
+
|
|
232
|
+
Layers are defined by their number, being displayed from 0 to x. By default, the `set_screen` command sets a screen on the first layer, as it did before. To set a screen on a different layer, pass the layer number as a second parameter.
|
|
233
|
+
|
|
234
|
+
```py
|
|
235
|
+
set_screen my_screen 1
|
|
236
|
+
// do stuff, then remove the overlay
|
|
237
|
+
empty_layer 1
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## 2.0.11
|
|
241
|
+
|
|
242
|
+
feature: The left-side viewport now uses DOM instead of canvas so screens and buttons can use animated gifs or webp.
|
|
243
|
+
|
|
244
|
+
The config has optionally been made easier to edit, with no need to define images in the `images` part of the config. buttons can also now be optionally defined inside the screen directly. The config is still compatible with the old syntax.
|
|
245
|
+
|
|
246
|
+
Example:
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"screens": {
|
|
251
|
+
"default": {
|
|
252
|
+
"background": "narrat"
|
|
253
|
+
},
|
|
254
|
+
"map": {
|
|
255
|
+
"background": "img/backgrounds/map.png",
|
|
256
|
+
"buttons": [
|
|
257
|
+
{
|
|
258
|
+
"id": "shopButton",
|
|
259
|
+
"enabled": false,
|
|
260
|
+
"background": "img/ui/shop-button.png",
|
|
261
|
+
"position": {
|
|
262
|
+
"left": 38,
|
|
263
|
+
"top": 6,
|
|
264
|
+
"width": 255,
|
|
265
|
+
"height": 226
|
|
266
|
+
},
|
|
267
|
+
"action": "shopButton"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "parkButton",
|
|
271
|
+
"enabled": false,
|
|
272
|
+
"background": "img/ui/park-button.png",
|
|
273
|
+
"position": {
|
|
274
|
+
"left": 632,
|
|
275
|
+
"top": 86,
|
|
276
|
+
"width": 255,
|
|
277
|
+
"height": 226
|
|
278
|
+
},
|
|
279
|
+
"action": "parkButton"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## 2.0.10
|
|
288
|
+
|
|
289
|
+
fix: `quest_completed?` now returns the correct value
|
|
290
|
+
|
|
291
|
+
## 2.0.9
|
|
292
|
+
|
|
293
|
+
Internal engine changes, shouldn't impact users.
|
|
294
|
+
|
|
295
|
+
Refactor to the VM and commands system to handle the way the stack flows better. Commands don't have to call `nextLine` on the VM to run the next line, instead the VM properly knows when a command is truly finished and controls the program's flow.
|
|
296
|
+
|
|
297
|
+
Also renamed `stacks` to `frames`, as the stack is the array that contains the frames and this was confusing.
|
|
298
|
+
|
|
299
|
+
## 2.0.8
|
|
300
|
+
|
|
301
|
+
- Fix: Auto scrolling when new text is added now works properly
|
|
302
|
+
- Fix: error when using set_stat or add_stat with a value of 0
|
|
303
|
+
|
|
304
|
+
## 2.0.7
|
|
305
|
+
|
|
306
|
+
Fixed an error where the `roll` function always returned true even if the skill check failed
|
|
307
|
+
|
|
308
|
+
## 2.0.6
|
|
309
|
+
|
|
310
|
+
Fixed a reggression bug introduced in 2.x where player choices weren't printed anymore in the dialogue history after making a choice.
|
|
311
|
+
|
|
312
|
+
## 2.0.4
|
|
313
|
+
|
|
314
|
+
Fixed more audio edge cases around race conditions
|
|
315
|
+
|
|
316
|
+
## 2.0.1
|
|
317
|
+
|
|
318
|
+
Fixed audio bug around loading
|
|
319
|
+
|
|
320
|
+
### New feature: Text Fields
|
|
321
|
+
|
|
322
|
+
New text fields feature to let players type answers to questions.
|
|
323
|
+
|
|
324
|
+
Usage: `text_field [prompt]`
|
|
325
|
+
|
|
326
|
+
Example:
|
|
327
|
+
|
|
328
|
+
```py
|
|
329
|
+
main:
|
|
330
|
+
set player.name (text_field "Enter your name")
|
|
331
|
+
"Your name is %{playerName}"
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## 2.0.0
|
|
335
|
+
|
|
336
|
+
The narrat 2.0.0 branch is now the main branch.
|
|
337
|
+
|
|
338
|
+
Narrat 1.x has been deprecated and moved to the `v1-latest` tag on npm.
|
|
339
|
+
|
|
340
|
+
To install old v 1.x for legacy games, use `npm install narrat@v1-latest` instead of just `npm install narrat`
|
|
341
|
+
|
|
342
|
+
To know more about how to update a game to 2.x, see the [narrat 2.0.0 docs](https://docs.get-narrat.com/readme/narrat-2.0)
|
|
343
|
+
|
|
344
|
+
## 2.0.0-rc4
|
|
345
|
+
|
|
346
|
+
### Important Note
|
|
347
|
+
|
|
348
|
+
The main CSS file from narrat must now be imported in games using it to have the default CSS.
|
|
349
|
+
|
|
350
|
+
Simply add `import 'narrat/dist/style.css';` at the top of your `index.ts` (before your own CSS).
|
|
351
|
+
|
|
352
|
+
### Switch to vite
|
|
353
|
+
|
|
354
|
+
To make developping narrat easier, the bundler used has been switched from rollup to vite. Vite is recommended as the standard for Vue these days, and the rollup vue plugin is deprecated. The update was necessary to support more recent features.
|
|
355
|
+
|
|
356
|
+
This has no impact on end users, other than having to import the CSS file as explained above.
|
|
357
|
+
|
|
358
|
+
## 2.0.0-rc3
|
|
359
|
+
|
|
360
|
+
- Improvements to debugging to show more useful info on parser/runtime errors
|
|
361
|
+
- Corrected display of line numbers in errors
|
|
362
|
+
- Made parser continue parsing after errors to make it easier to see all errors at once and to be able to play the game even if there are parser errors
|
|
363
|
+
|
|
364
|
+
## 2.0.0-rc1
|
|
365
|
+
|
|
366
|
+
### Narrat 2.0
|
|
367
|
+
|
|
368
|
+
### What changed in narrat 2.0
|
|
369
|
+
|
|
370
|
+
Narrat has a **new language syntax** in 2.0.0 - The parser has been improved to turn the narrat scripting into a full programming language with support for expressions, variables and functions
|
|
371
|
+
|
|
372
|
+
The syntax is generally the same so existing scripts would mostly work, except for the use of `$if` (which used to be a hack by sending your code to JavaScript [eval](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)).
|
|
373
|
+
|
|
374
|
+
### Script updating tool
|
|
375
|
+
|
|
376
|
+
There is a [script updating tool](https://github.com/liana-pigeot/Narrat-Script-Updater) which can be used to help automatically update existing scripts from 1.x to work with the new syntax.
|
|
377
|
+
|
|
378
|
+
{% hint style="danger" %}
|
|
379
|
+
The old syntax is largely compatible, but the $if instruction works very differently now. The script will update those $if instructions to match the new system, but might fail at updating long series of conditions in $if
|
|
380
|
+
{% endhint %}
|
|
381
|
+
|
|
382
|
+
### Installing narrat 2.0
|
|
383
|
+
|
|
384
|
+
Narrat 2.0 is currently published under a different tag to avoid people on 1.x accidentally installing it.
|
|
385
|
+
|
|
386
|
+
To install narrat to, run `npm install narrat@next`. The `next` tag is where the latest 2.x version is published.
|
|
387
|
+
|
|
388
|
+
### Expressions
|
|
389
|
+
|
|
390
|
+
Expressions are now a first party feature. An expression is any operation between parenthesis. Any command in the game can be used as an expression, if it returns a value. For example `(+ 2 3)` is an expression that would get evaluated to `5`.
|
|
391
|
+
|
|
392
|
+
### Syntax for using commands
|
|
393
|
+
|
|
394
|
+
The syntax for using commands hasn't changed, but it's been formalised.
|
|
395
|
+
|
|
396
|
+
The format for any operation is `[operator] [arg1] [arg2] [arg3] ...`. Operator is the command's keyword (like `talk`, `set`, `if` etc).
|
|
397
|
+
|
|
398
|
+
For example:
|
|
399
|
+
|
|
400
|
+
`set data.player.score 3` is the operator `set` with arguments `data.player.score` and `3`.
|
|
401
|
+
|
|
402
|
+
`set data.player.score (+ $data.player.score 2)`
|
|
403
|
+
|
|
404
|
+
The first command would set `3` in `data.player.score`.
|
|
405
|
+
|
|
406
|
+
The second command is also a set on `data.player.score`, but the second argument (the value) is an expression itself: `(+ $data.player.score 2)`. So the final resulting command is effectively `set data.player.score 5`.
|
|
407
|
+
|
|
408
|
+
### Using Variables
|
|
409
|
+
|
|
410
|
+
To use a variable's value in a command, prefix its name with `$` as in the example above. In the case of the `set` command, we want to pass to set the variable's name, not its value, so we don't use `$` at the start.
|
|
411
|
+
|
|
412
|
+
Variables are also available in string interpolation as before, to insert variables in text:
|
|
413
|
+
|
|
414
|
+
`talk player idle "Hello %{data.player.name}"`
|
|
415
|
+
|
|
416
|
+
### New If syntax
|
|
417
|
+
|
|
418
|
+
The previous `$if` is gone, now `if` is a command itself, which takes one argument: the condition. If the condition is true it plays the next branch, and it can have an optional else branch.
|
|
419
|
+
|
|
420
|
+
Example:
|
|
421
|
+
|
|
422
|
+
```py
|
|
423
|
+
set data.age 25
|
|
424
|
+
if (> $data.age 18):
|
|
425
|
+
"The player is an adult"
|
|
426
|
+
else:
|
|
427
|
+
"The player is not an adult"
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
#### More details on syntax and expressions
|
|
431
|
+
|
|
432
|
+
More complex example:
|
|
433
|
+
|
|
434
|
+
```py
|
|
435
|
+
main:
|
|
436
|
+
set data.winThreshold 10
|
|
437
|
+
set data.player.score 5
|
|
438
|
+
set data.player.scoreBonus 5
|
|
439
|
+
if (== (+ $data.player.score $data.player.scoreBonus) $data.winThreshold):
|
|
440
|
+
"The player won!"
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
In this example, the script stores a few variables, and then uses them in an `if` to compare their value. The `==` operation returns true if all arguments are equal, while the `+` operation adds values together and returns the result.
|
|
444
|
+
|
|
445
|
+
Here's how the code above would get broken down as the expressions get calculated:
|
|
446
|
+
|
|
447
|
+
```py
|
|
448
|
+
if (== (+ $player.score $player.scoreBonus) $data.winThreshold):
|
|
449
|
+
if (== 10 $data.winThreshold):
|
|
450
|
+
if (== 10 10):
|
|
451
|
+
if true
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### New operators
|
|
455
|
+
|
|
456
|
+
A lot of new operators have been added to be able to perform basic operations with the new scripting system:
|
|
457
|
+
|
|
458
|
+
- `+`, `-`, `*`, `/` : Will add/substract/etc arguments passed and return the value. Can take infinite arguments
|
|
459
|
+
- `||` and `&&` : Will or/and all arguments passed and return true or false. Inifinite arguments
|
|
460
|
+
- `>`, `>=`, `<`, `<=`, `==`, `!=` : Compares arguments 1 and 2, returns true or false. Note: equality uses truthy equality, not strict equality
|
|
461
|
+
- `!`: Negates argument 1
|
|
462
|
+
- `?`: Ternary operation. Arg 1 is the condition, 2 is what gets returned on success, 3 what gets returned on failure
|
|
463
|
+
|
|
464
|
+
### New helper functions
|
|
465
|
+
|
|
466
|
+
New helper functions for easily checking quests and inventory without long lines:
|
|
467
|
+
|
|
468
|
+
- `quest_completed? [questId]`: Returns true if the quest `questId` is completed
|
|
469
|
+
- `objective_completed? [questId] [objectiveId]`: Same for an objective
|
|
470
|
+
- Also quest_started and `objective_started`
|
|
471
|
+
- `has_item? [itemId] [amount (optional)]`: Returns true if the player has an item (if amount is passed, the player needs to have amount or more of it)
|
|
472
|
+
- `item_amount? [itemId]` Returns how many of an item the player has.
|
|
473
|
+
|
|
474
|
+
### Local variables
|
|
475
|
+
|
|
476
|
+
Local variables can now be declared. They exist inside the scope in which they are declared. Example
|
|
477
|
+
|
|
478
|
+
```python
|
|
479
|
+
main:
|
|
480
|
+
run variables_test
|
|
481
|
+
"The variable 'test' is now undefined because we left the scope it was created in: %{test}"
|
|
482
|
+
|
|
483
|
+
variables_test:
|
|
484
|
+
var test 1
|
|
485
|
+
"Test value is %{test}"
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Function with arguments and return values
|
|
489
|
+
|
|
490
|
+
Labels are now "functions" and can take arguments or return values.
|
|
491
|
+
|
|
492
|
+
Example:
|
|
493
|
+
|
|
494
|
+
```renpy
|
|
495
|
+
main:
|
|
496
|
+
var meal (run takeout_menu Cake)
|
|
497
|
+
"The player chose to eat %{meal}"
|
|
498
|
+
|
|
499
|
+
takeout_menu third_option:
|
|
500
|
+
var meal ""
|
|
501
|
+
choice:
|
|
502
|
+
talk helper idle "Which meal do you want?"
|
|
503
|
+
"Pizza":
|
|
504
|
+
set meal pizza
|
|
505
|
+
"Burger":
|
|
506
|
+
set meal burger
|
|
507
|
+
"%{third_option}":
|
|
508
|
+
set meal $third_option
|
|
509
|
+
talk helper idle "Chosen %{meal}"
|
|
510
|
+
return $meal
|
|
511
|
+
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### Other new features
|
|
515
|
+
|
|
516
|
+
#### Audio triggers
|
|
517
|
+
|
|
518
|
+
New audio triggers feature to play sounds on certain events in the game.
|
|
519
|
+
|
|
520
|
+
Simply add the sounds to the config:
|
|
521
|
+
|
|
522
|
+
```json
|
|
523
|
+
"audioTriggers": {
|
|
524
|
+
"onPlayerAnswered": "click",
|
|
525
|
+
"onPressStart": "game_start",
|
|
526
|
+
"onSkillCheckFailure": "failure",
|
|
527
|
+
"onSkillCheckSuccess": "success"
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Keys are event names, and values are the id of an audio you've defined in the config. For now all the available events are the ones above. Once defined, the sound will play every time that event is triggered.
|
|
532
|
+
|
|
533
|
+
## 1.3.3
|
|
534
|
+
|
|
535
|
+
1.x branch is now deprecated as 2.x is being pushed to main.
|
|
536
|
+
|
|
537
|
+
See [Narrat 2.0 update](https://docs.get-narrat.com/readme/narrat-2.0) docs for more info on how to update to 2.x
|
|
538
|
+
|
|
539
|
+
The main breaking change is the syntax for $if has changed, and also a CSS file needs to be imported in the game's `index.ts`:
|
|
540
|
+
|
|
541
|
+
`import 'narrat/dist/lib.css';`
|
|
542
|
+
|
|
543
|
+
## 1.3.2
|
|
544
|
+
|
|
545
|
+
- Improvement to variables editor for debugging
|
|
546
|
+
- Bugfixes to access quests in conditions
|
|
547
|
+
|
|
548
|
+
## 1.3.1
|
|
549
|
+
|
|
550
|
+
New feature to "use" items.
|
|
551
|
+
|
|
552
|
+
In an item config, an optional `onUse` value is available, which cn be set to a label to jump to when using the item.
|
|
553
|
+
|
|
554
|
+
There are also interaction groups which allow scripts to toggle on/off whether using items is allowed. They can be configured to automatically be turned off during dialogue scripts (to avoid bugs/side effects that jumping to an item's label would cause halfway through dialogue).
|
|
555
|
+
|
|
556
|
+
Config:
|
|
557
|
+
|
|
558
|
+
```json
|
|
559
|
+
"items": {
|
|
560
|
+
"bread": {
|
|
561
|
+
"name": "Bread",
|
|
562
|
+
"description": "A bread in the game.",
|
|
563
|
+
"icon": "img/items/bread.png",
|
|
564
|
+
"onUse": {
|
|
565
|
+
"action": "jump",
|
|
566
|
+
"label": "eat_bread"
|
|
567
|
+
},
|
|
568
|
+
"tag": "default"
|
|
569
|
+
},
|
|
570
|
+
"book": {
|
|
571
|
+
"name": "Ominous Book",
|
|
572
|
+
"description": "An ominous book",
|
|
573
|
+
"icon": "img/items/book.png",
|
|
574
|
+
"onUse": {
|
|
575
|
+
"action": "run",
|
|
576
|
+
"label": "read_book"
|
|
577
|
+
},
|
|
578
|
+
"tag": "always_interactable"
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
"interactionTags": {
|
|
582
|
+
"default": {
|
|
583
|
+
"onlyInteractOutsideOfScripts": true
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
The `onUse` `action` property can be either `jump` or `run`, allowing to either jump to a script, or run a script as a function (see [1.3.0 changes](#1.3.0) or [functions docs](https://docs.get-narrat.com/features/functions)), which effectively allows interrupting the current dialogue to run an item's function before going back to it.
|
|
589
|
+
|
|
590
|
+
The `tag` property on an item data sets which interaction group it is part of. This allows fine control of which items can be allowed to be used when. For example, some items might be available to use all the time, while some should only be allowed to be used at certain points.
|
|
591
|
+
|
|
592
|
+
By default if not provided, items have the `default` tag, and the default configuration has the `default` tag set to use `onlyInteractOutsideOfScripts`, which automatically disables interaction during scripts to avoid issues.
|
|
593
|
+
|
|
594
|
+
In the example above, the bread can only be interacted with outside of scripts and will use a jump to a label, while the book can be interacted with at any time and will use a `run`, effectively running a label as a function and then going back to where the script was.
|
|
595
|
+
|
|
596
|
+
In scripts, interaction tags can be controlled:
|
|
597
|
+
|
|
598
|
+
```py
|
|
599
|
+
main:
|
|
600
|
+
disable_interaction someTag
|
|
601
|
+
talk player idle "Impossible to use items with the tag someTag for now"
|
|
602
|
+
enable_interaction someTag
|
|
603
|
+
talk player idle "It is now possible to use items with the tag someTag"
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
## 1.3.0
|
|
607
|
+
|
|
608
|
+
New `run` function to run a label as a "function"
|
|
609
|
+
|
|
610
|
+
The difference between this and jump is that using `run` will go back to where you were before once the label is over.
|
|
611
|
+
|
|
612
|
+
For example:
|
|
613
|
+
|
|
614
|
+
```py
|
|
615
|
+
main:
|
|
616
|
+
set data.counter 1
|
|
617
|
+
jump functions_test
|
|
618
|
+
|
|
619
|
+
functions_test:
|
|
620
|
+
run some_function
|
|
621
|
+
talk player idle "Back to functions_test"
|
|
622
|
+
run some_function
|
|
623
|
+
talk player idle "We're back again"
|
|
624
|
+
|
|
625
|
+
some_function:
|
|
626
|
+
talk player idle "Ran the function %{data.counter} times"
|
|
627
|
+
add data.counter 1
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
In this example when running `functions_test`, the script in `some_function` will be ran, then the execution comes back to do the rest of `functions_test`.
|
|
631
|
+
|
|
632
|
+
**Note:** Saving still only happens when _jumping_ to a label, because being at a specific label is the only way to make sure a save file can keep working if the code of the game gets changed in an update.
|
|
633
|
+
|
|
634
|
+
## 1.2.1
|
|
635
|
+
|
|
636
|
+
Improved reset feature when returning to main menu to avoid potential bugs
|
|
637
|
+
|
|
638
|
+
## 1.2.0
|
|
639
|
+
|
|
640
|
+
## Quests system
|
|
641
|
+
|
|
642
|
+
There is a new quests system.
|
|
643
|
+
|
|
644
|
+
Quests can be defined in the config:
|
|
645
|
+
|
|
646
|
+
```json
|
|
647
|
+
"quests": {
|
|
648
|
+
"breadShopping": {
|
|
649
|
+
"title": "Bread Shopping",
|
|
650
|
+
"description": "The helper cat asked you to buy bread for him.",
|
|
651
|
+
"objectives": {
|
|
652
|
+
"bread": {
|
|
653
|
+
"description": "Buy bread for the helper cat."
|
|
654
|
+
},
|
|
655
|
+
"delivery": {
|
|
656
|
+
"description": "Deliver the bread to the helper cat."
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
Scripts can interact with the quest system:
|
|
664
|
+
|
|
665
|
+
- Start Quest: `start_quest breadShopping`
|
|
666
|
+
- Start objective: `start_objective breadShopping delivery` (for hidden objectives)
|
|
667
|
+
- Complete objective: `complete_objective breadShopping bread`
|
|
668
|
+
- Complete quest: `complete_quest breadShopping`
|
|
669
|
+
|
|
670
|
+
Example demo:
|
|
671
|
+
|
|
672
|
+
```py
|
|
673
|
+
quest_demo:
|
|
674
|
+
set_button shopButton true
|
|
675
|
+
set_button parkButton false
|
|
676
|
+
jump bread_quest
|
|
677
|
+
|
|
678
|
+
bread_quest:
|
|
679
|
+
choice:
|
|
680
|
+
talk helper idle "Can you get 2 pieces of bread for me?"
|
|
681
|
+
"Yes":
|
|
682
|
+
talk helper idle "Thanks, that's very nice!"
|
|
683
|
+
talk helper idle "I'll be waiting for you at the park"
|
|
684
|
+
jump bread_start
|
|
685
|
+
"No":
|
|
686
|
+
talk helper idle "Oh, okay"
|
|
687
|
+
jump quest_demo
|
|
688
|
+
|
|
689
|
+
bread_start:
|
|
690
|
+
start_quest breadShopping
|
|
691
|
+
talk inner idle "Time to go to the shop to buy some bread then."
|
|
692
|
+
set_screen map
|
|
693
|
+
set_button shopButton true
|
|
694
|
+
|
|
695
|
+
shopButton:
|
|
696
|
+
set_screen default
|
|
697
|
+
"You visit the bread shop"
|
|
698
|
+
talk shopkeeper idle "Hello, I'm a little baker selling bread!"
|
|
699
|
+
set data.breadPrice 5
|
|
700
|
+
jump shop_menu
|
|
701
|
+
|
|
702
|
+
parkButton:
|
|
703
|
+
choice:
|
|
704
|
+
talk helper idle "Ah, so do you have my bread?"
|
|
705
|
+
"Yes!" $if this.items.bread.amount >= 2:
|
|
706
|
+
talk helper idle "Thanks a lot!"
|
|
707
|
+
complete_objective breadShopping delivery
|
|
708
|
+
complete_quest breadShopping
|
|
709
|
+
"No :(":
|
|
710
|
+
talk helper idle "Oh okay"
|
|
711
|
+
set_button parkButton false
|
|
712
|
+
|
|
713
|
+
shop_menu:
|
|
714
|
+
choice:
|
|
715
|
+
talk shopkeeper idle "So, do you want some bread?"
|
|
716
|
+
"Buy bread (costs %{data.breadPrice})" $if this.stats.money.value >= this.data.breadPrice:
|
|
717
|
+
add_item bread 1
|
|
718
|
+
$if this.data.breadPrice === 5:
|
|
719
|
+
add_stat money -5
|
|
720
|
+
else:
|
|
721
|
+
add_stat money -4
|
|
722
|
+
jump map_update
|
|
723
|
+
roll bread_haggle haggling 50 "Try to haggle for bread" hideAfterRoll:
|
|
724
|
+
success "You explain that helper cat needs bread to feed his poor family":
|
|
725
|
+
set data.breadPrice 4
|
|
726
|
+
talk shopkeeper idle "I guess I can sell you bread for 4 coins"
|
|
727
|
+
jump shop_menu
|
|
728
|
+
failure "You try to pity trip the shopkeeper but he won't bulge":
|
|
729
|
+
talk shopkeeper idle "The price is 5 coins, nothing less, nothing more."
|
|
730
|
+
jump shop_menu
|
|
731
|
+
"Exit":
|
|
732
|
+
jump map_update
|
|
733
|
+
|
|
734
|
+
map_update:
|
|
735
|
+
$if this.items.bread.amount >= 2:
|
|
736
|
+
complete_objective breadShopping bread
|
|
737
|
+
talk inner idle "I've got enough bread now, I'm going to go to the park."
|
|
738
|
+
start_objective breadShopping delivery
|
|
739
|
+
set_screen map
|
|
740
|
+
set_button parkButton true
|
|
741
|
+
set_button shopButton false
|
|
742
|
+
else:
|
|
743
|
+
talk inner idle "Hmm, I still need to buy more bread for helper cat."
|
|
744
|
+
set_screen map
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
## 1.1.0
|
|
748
|
+
|
|
749
|
+
### Inventory system
|
|
750
|
+
|
|
751
|
+
There is a new inventory system.
|
|
752
|
+
|
|
753
|
+
Possible items can be defined in the config:
|
|
754
|
+
|
|
755
|
+
```json
|
|
756
|
+
"items": {
|
|
757
|
+
"bread": {
|
|
758
|
+
"name": "Bread",
|
|
759
|
+
"description": "A bread in the game.",
|
|
760
|
+
"icon": "img/items/bread.png"
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
Then items can be added/removed in scripts:
|
|
766
|
+
|
|
767
|
+
```py
|
|
768
|
+
main:
|
|
769
|
+
add_item bread 15
|
|
770
|
+
remove_item bread 10
|
|
771
|
+
$if this.items.bread.amount > 0:
|
|
772
|
+
talk helper idle "You have %{items.bread.amount} bread"
|
|
773
|
+
else:
|
|
774
|
+
talk helper idle "You have no bread"
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
## 1.0.0
|
|
778
|
+
|
|
779
|
+
### State management rewrite
|
|
780
|
+
|
|
781
|
+
Rewrote the state management of the engine using [pinia](https://pinia.vuejs.org/) instead of Vuex for state management.
|
|
782
|
+
|
|
783
|
+
This allows the state to be more modular, easy to use and better compatible with Vue.js devtools for development of the engine, as pinia is now the official vue state management library.
|
|
784
|
+
|
|
785
|
+
The version has been bumped to 1.0.0 as it's a major rewrite. No bugs have been found when testing though.
|
|
786
|
+
|
|
787
|
+
### Save files breaking change
|
|
788
|
+
|
|
789
|
+
The save file format has changed, so saved games from previous versions would break. As no one is using this engine in production for now, this isn't an issue.
|
|
790
|
+
|
|
791
|
+
A new `version` string has been added to save files, so that in the future it will be possible to add migrations from older save files to newer ones if needed
|
|
792
|
+
|
|
793
|
+
## Updated Vue version
|
|
794
|
+
|
|
795
|
+
The Vue dependency version has been updated to the current latest (3.2.37)
|
|
796
|
+
|
|
797
|
+
## Vuex peer dependency deleted
|
|
798
|
+
|
|
799
|
+
Vuex is no longer a peer dependency, and has been replaced with pinia.
|
|
800
|
+
|
|
801
|
+
## 0.11.1
|
|
802
|
+
|
|
803
|
+
Fixed an error in how the narrat packaged is exported
|
|
804
|
+
|
|
805
|
+
## 0.11.0
|
|
806
|
+
|
|
807
|
+
### New Plugin system!
|
|
808
|
+
|
|
809
|
+
There is now a plugin system developers can use to add new functionality to narrat (more documentation soon). See the [narrat-bitsy](https://github.com/liana-pigeot/narrat-bitsy) plugin for an example.
|
|
810
|
+
|
|
811
|
+
## 0.10.0
|
|
812
|
+
|
|
813
|
+
### New XP System
|
|
814
|
+
|
|
815
|
+
- XP can be accumulated to level
|
|
816
|
+
- config option: `skillOptions.xpPerLevel`
|
|
817
|
+
- Use `add_xp` in script tso add xp, just like adding levels
|
|
818
|
+
- XP now displayed in skills menu
|
|
819
|
+
|
|
820
|
+
### Other improvements
|
|
821
|
+
|
|
822
|
+
- Improvements in skill checks display and difficulty
|
|
823
|
+
- Bug fixes to skill check edge cases
|
|
824
|
+
- Fixed a bug when not having a default title screen music
|
|
825
|
+
- Added a new `hideAfterRoll` option to skill checks to hide their choice after they've happened once
|
|
826
|
+
- Refactored skill check code for internal consistency between the different ways they're run
|
|
827
|
+
- New CSS variables and classes to customise the look of skill check prompts
|
|
828
|
+
|
|
829
|
+
## 0.9.4
|
|
830
|
+
|
|
831
|
+
- Fixed a bug when going back to the main menu and reloading the save without refreshing the page
|
|
832
|
+
- New `defaultMusic` option in audio options for title screen music
|
|
833
|
+
|
|
834
|
+
## 0.9.3
|
|
835
|
+
|
|
836
|
+
- Fixed a bug when loading a saved game
|
|
837
|
+
|
|
838
|
+
## 0.9.2
|
|
839
|
+
|
|
840
|
+
- Added new CSS variables and id/classes to make it easier to theme games
|
|
841
|
+
|
|
842
|
+
Current CSS variables list (Look at [main.css](https://github.com/liana-pigeot/narrat/blob/main/src/sass/main.css) in the narrat repo for up to date version):
|
|
843
|
+
|
|
844
|
+
```css
|
|
845
|
+
:root {
|
|
846
|
+
--bg-color: #131720;
|
|
847
|
+
--text-color: #d9e1f2;
|
|
848
|
+
--primary: hsl(255, 30%, 55%);
|
|
849
|
+
--focus: hsl(210, 90%, 50%);
|
|
850
|
+
--secondary: #42b983;
|
|
851
|
+
--border-color: hsla(0, 0%, 100%, 0.2);
|
|
852
|
+
--light-1: hsl(210, 30%, 40%);
|
|
853
|
+
--light-2: hsl(255, 30%, 50%);
|
|
854
|
+
--light-background: linear-gradient(to right, var(--light-1), var(--light-2));
|
|
855
|
+
--shadow-1: hsla(236, 50%, 50%, 0.3);
|
|
856
|
+
--shadow-2: hsla(236, 50%, 50%, 0.4);
|
|
857
|
+
--hud-background: rgba(0, 0, 0, 0.4);
|
|
858
|
+
--hud-text-color: var(--text-color);
|
|
859
|
+
--notifications-bg: darkslateblue;
|
|
860
|
+
|
|
861
|
+
--skills-text-background: rgba(0, 0, 0, 0.5);
|
|
862
|
+
--skills-text-color: var(--text-color);
|
|
863
|
+
--skills-level-background: rgba(0, 0, 0, 0.5);
|
|
864
|
+
--skills-level-color: orange;
|
|
865
|
+
}
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
Can be edited in a game's CSS file by overriding those variables in a more specific selector. For example:
|
|
869
|
+
|
|
870
|
+
```css
|
|
871
|
+
#app {
|
|
872
|
+
--bg-color: white;
|
|
873
|
+
--text-color: black;
|
|
874
|
+
}
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
would override the background and text colors of the game
|
|
878
|
+
|
|
879
|
+
## 0.9.1
|
|
880
|
+
|
|
881
|
+
- Fixed a file capitalisation error in 0.9.0
|
|
882
|
+
|
|
883
|
+
## 0.9.0
|
|
884
|
+
|
|
885
|
+
### Breaking Changes
|
|
886
|
+
|
|
887
|
+
New config options for skills:
|
|
888
|
+
|
|
889
|
+
- `icon`: Path to the image to use for the skill's icon (currently the skill widget is 200x300, but you can override the CSS if needed)
|
|
890
|
+
- `hidden`: Optional boolean to make the skill hidden until it is "obtained". A skill that is configured to be hidden will only start appearing in the skills menu once it's above level 0
|
|
891
|
+
|
|
892
|
+
Example skills config:
|
|
893
|
+
|
|
894
|
+
```json
|
|
895
|
+
"skills": {
|
|
896
|
+
"agility": {
|
|
897
|
+
"name": "Agility",
|
|
898
|
+
"description": "How good you are at moving around.",
|
|
899
|
+
"startingLevel": 0,
|
|
900
|
+
"icon": "img/skills/agility.jpg",
|
|
901
|
+
"hidden": true
|
|
902
|
+
},
|
|
903
|
+
"logic": {
|
|
904
|
+
"name": "Logic",
|
|
905
|
+
"description": "How good you are at solving problems",
|
|
906
|
+
"icon": "img/skills/logic.jpg",
|
|
907
|
+
"startingLevel": 0
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
### Bug Fixes
|
|
913
|
+
|
|
914
|
+
- Music could play multiple times at once when replaying the same music
|
|
915
|
+
|
|
916
|
+
### New Features and improvements
|
|
917
|
+
|
|
918
|
+
#### Development and debug
|
|
919
|
+
|
|
920
|
+
- Improved debug menu with a **variable editor** to view and edit values in the `data` object.
|
|
921
|
+
- Also added a separate editor for the entire engine/app state. Can be useful for debugging complex bugs by exploring the state of the app.
|
|
922
|
+
- New **Quick label jump** feature to easily jump to specific labels for testing. Press **J** to open and type the name of a label then select a result with up/down arrows and press Enter
|
|
923
|
+
- New keyboard shortcut to open debug menu (**d**)
|
|
924
|
+
- Added a debug info panel on the main starting screen of the game with info on the shortcuts
|
|
925
|
+
|
|
926
|
+
#### Engine improvements
|
|
927
|
+
|
|
928
|
+
- Menu modal improved to be more compact with a cleaner design
|
|
929
|
+
- Added fade in and fade outs when changing music (configurable in config)
|
|
930
|
+
- **Improved the default UI** to be more pleasing to look at
|
|
931
|
+
- Added a **return to Main Menu** button to the main menu for resetting the game
|
|
932
|
+
- New **Skills Menu** allowing players to view their skills:
|
|
933
|
+
- It only appears if the game has skills configured
|
|
934
|
+
- It shows skill icons, name and current level on a grid
|
|
935
|
+
- Clicking on a skill opens a skill page with more detailed info and the skill description
|
|
936
|
+
- The skill menu button is next to the usual menu button
|
|
937
|
+
|
|
938
|
+
## 0.8.5
|
|
939
|
+
|
|
940
|
+
- Fixed a bug with `clear_dialog` that was disabling all interaction upon use
|
|
941
|
+
|
|
942
|
+
## 0.8.4
|
|
943
|
+
|
|
944
|
+
- Fixed many issues with save being broken (it didn't properly save the name of the last label the player was on, effectively restarting the game from scratch every time)
|
|
945
|
+
- Added new things to the save function so their state gets reloaded properly on game launch:
|
|
946
|
+
- Current music now gets saved and restarts when reloading the game, if any is active
|
|
947
|
+
- Stats (the ones in the HUD) now get saved
|
|
948
|
+
- Current screen is also saved
|
|
949
|
+
- Removed many useless spammy `console.log` and added a `Logger` in the code so that most logs (outside of errors/important logs) will only appear in debug mode.
|
|
950
|
+
|
|
951
|
+
## 0.8.3
|
|
952
|
+
|
|
953
|
+
- Fixed bug where menu button would move up as more text gets added to the game
|
|
954
|
+
|
|
955
|
+
## 0.8.2
|
|
956
|
+
|
|
957
|
+
- Added css to hide scrollbars in the game UI
|
|
958
|
+
- Added a new Menu button with the options to quit and change volume
|
|
959
|
+
- Removed volume slider from the HUD and moved it to the new menu
|
|
960
|
+
|
|
961
|
+
## 0.8.1
|
|
962
|
+
|
|
963
|
+
- Fixed a bug in accessing values inside conditions caused by changed in 0.7.2
|
|
964
|
+
|
|
965
|
+
## 0.8.0
|
|
966
|
+
|
|
967
|
+
- Changed the `set` method to access things without caps (`data`, `skills`, `buttons` instead of `DATA`, `SKILLS`, `BUTTONS`) for consistency.
|
|
968
|
+
- Changed string interpolation to have more accessible objects, now values in `data` need to be accessed with `%{data.something}` instead of just `%{something}`
|
|
969
|
+
- Now possible to access skill levels in string interpolation with `%{skills.someSkill.level}`
|
|
970
|
+
- Improvements to how skill checks are printed to be less awkward
|
|
971
|
+
|
|
972
|
+
## 0.7.1
|
|
973
|
+
|
|
974
|
+
- Added `stop` and `pause` functions which work similarly to play for stopping or pausing audio.
|
|
975
|
+
|
|
976
|
+
## 0.6.5
|
|
977
|
+
|
|
978
|
+
- Audio and music options from the config now get passed to howler
|
|
979
|
+
- Renamed `path` to `src` in audio config (to be consistent with howler)
|
|
980
|
+
|
|
981
|
+
## 0.6.0
|
|
982
|
+
|
|
983
|
+
Added stats feature for tracking numbers and displaying them in the hud
|
|
984
|
+
|
|
985
|
+
Example config:
|
|
986
|
+
|
|
987
|
+
```
|
|
988
|
+
"hudStats": {
|
|
989
|
+
"money": {
|
|
990
|
+
"icon": "img/ui/money.png",
|
|
991
|
+
"name": "Money",
|
|
992
|
+
"startingValue": 0,
|
|
993
|
+
"minValue": 0
|
|
994
|
+
},
|
|
995
|
+
"energy": {
|
|
996
|
+
"icon": "img/ui/energy.png",
|
|
997
|
+
"name": "Energy",
|
|
998
|
+
"startingValue": 10,
|
|
999
|
+
"minValue": 0,
|
|
1000
|
+
"maxValue": 10
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
## 0.5.4
|
|
1006
|
+
|
|
1007
|
+
- Improved responsive layout and fixed some issues in it
|
|
1008
|
+
|
|
1009
|
+
New config keys required in the layout part of the config (to be documented):
|
|
1010
|
+
|
|
1011
|
+
```
|
|
1012
|
+
"layout": {
|
|
1013
|
+
"backgrounds": {
|
|
1014
|
+
"width": 880,
|
|
1015
|
+
"height": 720
|
|
1016
|
+
},
|
|
1017
|
+
"dialogBottomPadding": 70,
|
|
1018
|
+
"minTextWidth": 475,
|
|
1019
|
+
"mobileDialogHeightPercentage": 60,
|
|
1020
|
+
"verticalLayoutThreshold": 1000,
|
|
1021
|
+
"portraits": {
|
|
1022
|
+
"width": 100,
|
|
1023
|
+
"height": 100
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
## 0.4.0
|
|
1029
|
+
|
|
1030
|
+
Added responsive layout for mobile and small screens. Still in progress, but functionnal enough to be better than before so I'm releasing it.
|
|
1031
|
+
|
|
1032
|
+
## 0.3.4
|
|
1033
|
+
|
|
1034
|
+
- Improved string templating to work with deep nesting and also inside choice text
|
|
1035
|
+
|
|
1036
|
+
## 0.3.3
|
|
1037
|
+
|
|
1038
|
+
- Now detects indentation size and can support any indentation size
|
|
1039
|
+
|
|
1040
|
+
## 0.3.2
|
|
1041
|
+
|
|
1042
|
+
- Added a new `add_level` function for increasing the level of a skill. Example: `add_level someSkill 1` will increase the player's level in `someSkill` by 1
|
|
1043
|
+
- Added a new `notify` function for displaying a notification toast that disappears after a few seconds (duration configurable in `config.json`). Example: `notify "Hello, this is a notification"`.
|
|
1044
|
+
|
|
1045
|
+
## 0.3.1
|
|
1046
|
+
|
|
1047
|
+
Added new config options for controlling how skill rolls are done and the display of their difficulty
|
|
1048
|
+
|
|
1049
|
+
## 0.3.0
|
|
1050
|
+
|
|
1051
|
+
Breaking changes around renaming data access from scripts
|
|
1052
|
+
|
|
1053
|
+
### New Add Command
|
|
1054
|
+
|
|
1055
|
+
New `add` command, works the same way as `set` but increments the value based on the existing value, ie. `set SKILLS.someSkill.level 2` will increment `someSkill.level` by 2.
|
|
1056
|
+
|
|
1057
|
+
### Skills
|
|
1058
|
+
|
|
1059
|
+
- Now possible to set the starting value of a skill (in the config)
|
|
1060
|
+
- Now possible to edit a skill's value with `set SKILLS.someSkill.level 2` for example
|
|
1061
|
+
- Skillcheck command renamed to roll (`if this.roll("someSkillCheck", "testSkill", 40);`)
|
|
1062
|
+
|
|
1063
|
+
### General
|
|
1064
|
+
|
|
1065
|
+
The `set` and `$if` command now refer to data in caps and have access to more data:
|
|
1066
|
+
|
|
1067
|
+
- `set SKILLS.someSkill.level [value]` Sets the value of a skill
|
|
1068
|
+
- `set DATA.someData [value]` Sets a value in the data object (data is for any game-created variables)
|
|
1069
|
+
- `$if this.SKILLCHECKS.someSkillCheck.passed` now available for checking if a skillcheck has already been passed
|
|
1070
|
+
|
|
1071
|
+
## 0.0.14
|
|
1072
|
+
|
|
1073
|
+
- Added the changelog (manually made for now)
|
|
1074
|
+
|
|
1075
|
+
## 0.0.13
|
|
1076
|
+
|
|
1077
|
+
- Added debug menu for jumping to labels (currently doesn't support production builds disabling it)
|
|
1078
|
+
- Added saving and loading of the game (works by storing data, skills, skillchecks etc. When the game is reloaded, it is brought back at the last label visited)
|
|
1079
|
+
- Fixed a bug where conditional choices would play the wrong result if a choice is removed due to a condition
|
|
1080
|
+
- Made script loading and compilation happen during the initial loading, so everything is ready to play when pressing start game
|
|
1081
|
+
- Skill checks now also save and load their data, so a failed check becomes impossible to choose, and a succeeded skill check can be skipped if shown again
|