💻 The Traveler
A flat-file interactive fiction system that runs in the browser. It is a spiritual successor to tilde world.
If you have created world with the traveler, I'd love to see it! I could even include it in the game source for others to play if you're interested in that.
I will probably create my own worlds at some point, which will be available to load and play.
Source code: https://github.com/0xdstn/traveler
Live version: https://tilde.town/~dustin/traveler/
Description
The traveler is run from a browser using flat files. By default it'll load demo.txt, which includes examples of all available functionality.
You can move around from room to room, pick up objects, and interact with the NPCs and objects in the room or your inventory.
You can also create new rooms, objects, and NPCs directly within the traveler, allowing you to create a world while inhabiting it.
The only things you can't do from within the game is create actions or variables.
There is a very basic variable and action system which allows a more rich interaction with NPCs and objects.
The world, inventory, and current location are constantly saved to local storage, so when you come back the state persists.
You can export the current world to a txt file, and you can import from a text file (local or remote URL). World files do not include inventory or current location, those reset upon import.
A world can be auto imported from url by adding the ?load=URL
query parameter.
Game commands
As a user of the game you can run the following commands:
load (url)
- Load a world txt file from the provided URL. You can always reload the demo with "load demo.txt"import
- Load a world txt from a local fileexport (filename)
- Export the current world to a txt filelook
- View the room along with it's objects, NPCs, and exitslook (object)
- View the provided object and it's actionslook (npc)
- View the provided NPC and it's actionsgo (direction)
- Go the provided direction (north,south,east,west)teleport (x),(y)
- Go to the provided coordinateswhere
- Displays the current room's name and coordinatesgrab (object)
- Add the provided object to your inventorydrop (object)
- Drop the provided object in the current roominventory
- List your current inventorynew
- Destroys the current world and creates a new, empty onecreate room (x),(y)
- Create an empty room at the provided coordinatescreate object (key)
- Create a new object with the provided keycreate npc (key)
- Create a new NPC with the provided keyset name (name)
- Rename the current roomset description (desc)
- Describe the current roomrename (object) (name)
- Rename the provided objectrename (npc) (name)
- Rename the provided NPCdescribe (object) (desc)
- Describe the provided objectdescribe (npc) (desc)
- Describe the provided NPCmove (x),(y)
- Move the current room to the provided coordinatesadd object (key)
- Add the object with the provided key to the current roomadd npc (key)
- Add the NPC with the provided key to the current roomremove object (key)
- Remove the object with the provided key from the current roomremove npc (key)
- Remove the NPC with the provided key from the current roomremove room
- Remove the current roomdebug
- Prints debug information to the console
World creation
Worlds are stored in a txt file. Each element (room, object, npc) are represented by multiple lines, and all are separated by an empty line. You can view an example with all available functionality at demo.txt.
Attributes
You can set the following attributes on an element, using a specific starting glyph for each:
+ Name
& Description
@ (object key) - Room only
# (npc key) - Room only
% (dir):(object key) - Room only, a lock with a required item for an exit (ex: % w:west-key)
> (dir):(x),(y) - Room only, overrides an exit with the specified coordinates (ex: > n:10,10)
! (action) - Object and NPC only, creates an action with the provided key. Action code can be seen below
$ (variable) = (value) - Object only, a variable for the object and it's value (ex: $ opened = false)
Action code
When you set an action on an object or NPC, you can include additonal lines after it with action code that runs when the user calls the action (user example: open chest)
The following commands are available:
ECHO (text)
- Prints out the provided textGRAB (object)
- Adds the speicifed object to the user's inventory, even if it isn't in the roomTAKE (object)
- Removes the speicifed object from the user's inventorySET $(variable) = (value)
- Sets the provided variable to the provided value (ex: SET $opened = true)IF (condition)
- Starts an if block with the provided condition. Currently you can check if a variable is set to something (IF $opened = true) or if the inventory contains an item (IF INVENTORY=item1,item2)ELSE
- Starts an else block for the current IFENDIF
- Ends the if/else block
This is an example of a chest's open action. It gives the user items if it's been opened, and displays a message that it's empty when it's been opened already:
@ chest
+ wooden chest
& A wooden chest in questionable condition
$ opened = false
! open
IF $opened = true
ECHO The chest is empty
ELSE
SET $opened = true
GRAB sword
GRAB shield
GRAB west-key
ENDIF
Here is another example of a lamp the user can turn on and off. The description can include variables that will display the value as well.
@ lamp
+ lamp
& An ordinary lamp with a switch. It is currently $power.
^ false
$ power = on
! switch
IF $power = on
SET $power = off
ECHO You turned off the lamp
ELSE
SET $power = on
ECHO You turned on the lamp
ENDIF
Rooms
Rooms are denoted by a ~
followed by coordinates.
Here is an example room with an item and a NPC. It also has a key required to go west and an override to 10,10 for the north:
You can mention objects in the description with a leading @
, and NPCs with a leading #
.
+ Landing Room
& An ordinary room with a @lamp and a #ghost.
@ lamp
# ghost
% w:west-key
> n:10,10
Objects
Objects are denoted by a @
followed by an object key
Here is an example with no actions or variables:
@ nintendo
+ Nintendo
& An original Nintendo system hooked up to a CRT television.
NPCs
NPCs are denoted by a #
followed by an NPC key
here is an example with a simple talk action:
# ghost
+ Ghost
& A spooky ghost
! talk
ECHO OOooooooooOoOoOoooohhhhhhhhh...
Release notes
v1.0.1
Added TAKE action command, fixed duplicate exit in look, clear world before import, added load URL from query paramv1.0.0
Initial release with base functionality
👋 Hey! Thanks for reading! If you have any comments or questions about this post, or anything else, I'd love to chat! You can find the best way to contact me on my hello page or send me an email.