You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,17 +17,17 @@ An HTML-based text adventure game engine. Small and easy to use with no dependen
17
17
Very little programming is required, but several JavaScript hooks are provided if you are inclined to use them!
18
18
19
19
### How do I use it?
20
-
To create your own adventure, you can use one of the files in the [game-disks](https://github.com/okaybenji/text-engine/blob/master/game-disks) folder as a template. For example, take a look at [the disk called newDiskTemplate](https://github.com/okaybenji/text-engine/blob/master/game-disks/new-disk-template.js).
20
+
To create your own adventure, you can use one of the files in the [game-disks](https://github.com/okaybenji/text-engine/blob/main/game-disks) folder as a template. For example, take a look at [the disk called newDiskTemplate](https://github.com/okaybenji/text-engine/blob/main/game-disks/new-disk-template.js).
21
21
22
-
Include your "game disk" (a function returning JSON data) in index.html and load it with `loadDisk(myGameData)`. (Look at [index.html](https://github.com/okaybenji/text-engine/blob/master/index.html) in the repo for an example.)
22
+
Include your "game disk" (a function returning JSON data) in index.html and load it with `loadDisk(myGameData)`. (Look at [index.html](https://github.com/okaybenji/text-engine/blob/main/index.html) in the repo for an example.)
23
23
24
24
The end product will be your very own text adventure game, similar to [this one](http://okaybenji.github.io/text-engine). It's a good idea to give that game a try to get introduced to the engine.
`text-engine` uses a disk metaphor for the data which represents your game, like the floppy disks of yore.
29
29
30
-
Including [index.js](https://github.com/okaybenji/text-engine/blob/master/index.js) from this repository in your [index.html](https://github.com/okaybenji/text-engine/blob/master/index.html)`<script>` adds a several functions to the global namespace. One of these is called `loadDisk`. `loadDisk` accepts a single argument, which is your disk -- a function returning a JavaScript object (JSON).
30
+
Including [index.js](https://github.com/okaybenji/text-engine/blob/main/index.js) from this repository in your [index.html](https://github.com/okaybenji/text-engine/blob/main/index.html)`<script>` adds a several functions to the global namespace. One of these is called `loadDisk`. `loadDisk` accepts a single argument, which is your disk -- a function returning a JavaScript object (JSON).
31
31
32
32
## Disks
33
33
A disk is a function which returns a JavaScript object that describes your game. At minimum, that object must have these two top-level properties:
@@ -137,11 +137,11 @@ Topics can have these other optional properties as well:
137
137
That's everything! If you've made a JSON object with a `roomId` and a list of `rooms` -- that is, a disk -- you've got a playable game!
138
138
139
139
### How do I play it?
140
-
Just pass a reference to your disk to the loadDisk function. Take a look at [index.html](https://github.com/okaybenji/text-engine/blob/master/index.html) to see an example.
140
+
Just pass a reference to your disk to the loadDisk function. Take a look at [index.html](https://github.com/okaybenji/text-engine/blob/main/index.html) to see an example.
141
141
142
-
I've saved my disk to a `const` variable called `demoDisk` in [game-disks/demo-disk.js](https://github.com/okaybenji/text-engine/blob/master/game-disks/demo-disk.js). I've included that file and `index.js` in my HTML file, and added a script tag with a single line to call `loadDisk(demoDisk)`. The game boots when [index.html](https://github.com/okaybenji/text-engine/blob/master/index.html) is loaded in a web browser.
142
+
I've saved my disk to a `const` variable called `demoDisk` in [game-disks/demo-disk.js](https://github.com/okaybenji/text-engine/blob/main/game-disks/demo-disk.js). I've included that file and `index.js` in my HTML file, and added a script tag with a single line to call `loadDisk(demoDisk)`. The game boots when [index.html](https://github.com/okaybenji/text-engine/blob/main/index.html) is loaded in a web browser.
143
143
144
-
You can use the included [index.html](https://github.com/okaybenji/text-engine/blob/master/index.html) file in your own project, or you can create your own.
144
+
You can use the included [index.html](https://github.com/okaybenji/text-engine/blob/main/index.html) file in your own project, or you can create your own.
145
145
146
146
#### Making your own HTML file
147
147
@@ -257,7 +257,7 @@ Every command a player can issue in the game has a corresponding function in tex
257
257
258
258
For instance, there's a function called "go" that gets called when the player types GO.
259
259
260
-
You can add your own custom commands as well. Take a look at [the "unlock" command in game-disks/demo-disk.js](https://github.com/okaybenji/text-engine/blob/master/game-disks/demo-disk.js#L478-L495) for an example.
260
+
You can add your own custom commands as well. Take a look at [the "unlock" command in game-disks/demo-disk.js](https://github.com/okaybenji/text-engine/blob/main/game-disks/demo-disk.js#L478-L495) for an example.
261
261
262
262
#### Overriding the default command set
263
263
If existing commands don't work how you want them to, you can override them by reassigning them to your own function code.
If you do remove some or all of the default commands, you'll want to override the `help` function as well so that it doesn't list commands which are not supported by your game.
293
293
294
294
### Other Functions
295
-
There are several other functions available in the engine! Feel free to take a peek at the [source code](https://github.com/okaybenji/text-engine/blob/master/index.js). It's designed to be open and simple to use and to customize.
295
+
There are several other functions available in the engine! Feel free to take a peek at the [source code](https://github.com/okaybenji/text-engine/blob/main/index.js). It's designed to be open and simple to use and to customize.
296
296
297
297
### A word of caution regarding SAVE/LOAD
298
298
The default implementation of saving and loading games in text-engine is quite simple. All the commands a player has entered are stored in the save to be "played back" into the game in the same order on load. It's something like the game playing itself back to the point where you left off, instantaneously.
0 commit comments