---
# System prepended metadata

title: Garden Design Notes
tags: [sketchdance]

---

# Garden Design Notes
###### tags: `sketchdance`

Garden of Forking Paths: A distributed, collaborative tool for making and playing games.

Goals:

* Import from Inky and Twine games
* Integrate Trizbort (or Twine?) for mapping
* Make Twine/Chapbook the native format? With some multiplayer extensions? Tempting.
    * Inky: https://www.inklestudios.com/ink/
    * Twine: https://twinery.org/
    * Chapbook: https://klembot.github.io/chapbook/
* How hard will it be to convert Garden to the [Standard Stack](https://hackmd.io/-11_ctzwS7C0V62ipeLyNg?both)?
* How hard will it be to adapt Twine/Chapbook to multiplayer?

Known bugs:

* [x] Choosing a world broken in Wizard mode
mode
* [x] Missing `@change` handler in Player mode
* [x] Fix `path()`
* [x] Fix `<iframe>` in wizard mode
* [x] Fix persistent problem saving messages

Next: 

* [ ] Parse messages into HTML
* [ ] HTML editor for description fields
* [ ] Filter HTML
* [x] Add messages to player view
* [x] Add flag for private for worlds in Wizard mode
* [x] Load room when world is loaded
* [x] Prompt player to create a character if they don't have one

Fixmes:

* [ ] exitRoom function
* [ ] sendMessage function
* [ ] updatePlayer function
* [ ] filter out private worlds from Players
* [ ] sanitize data using https://github.com/punkave/sanitize-html
* [ ] parse messages -> markup using https://github.com/pocka/slack-message-parser

First round of extensions:

* [ ] Only able to use/see exit if carrying specific item
* [ ] Only able to use/see exit if specific event happened (intract with NPC, visit room, used item): reversible, not
* [ ] Pick up items
* [ ] Drop / Give / Use items
* [ ] NPCs in chat rooms
* [ ] Money / points accumulation
* [ ] Spend money

## Optional (i.e., LATER) features

* Auto-mapping to give a view like Twine
* Graphics for rooms
* Chat within rooms
* Import/Export game (not chats) as Markdown
* Using variables & randomness
* Basic nouns and verbs, inventory
* Creating new nouns and verbs
* General availability of programming
* Elm for coding?

## Inspiration and Examples

* [Caves of Quilth - Twine](https://hackmd.io/yiGEiGleTX-9BEe4Q5bIwg?both)
* [Flatpack - Inky](https://hackmd.io/OzM3lFILSQ2If1J0bMwRCg?both)

Minimum requirements: Minimal authentication (so we can see who edits what), Lightly marked up text for "room", places to add "exits", play vs. edit.

User: Name, password, friends, description, short description, per-world: inventory, rooms visited, secrets known

World: Starting room (can be a function, e.g. to randomize), current room

Room: exits, inventory, description, short description

NPCs: name, description, location, motivations?, likes/dislikes?, inventory

Item: name, description, edible?, weapon?, throwable? container?, carryable?

Update 2019-02-10: Put exits and messages directly in Room object.

Playing the game:

* One world
* One room
* Exits for that room
* Characters in that room & login status
* Chat for that room
* Subscribe to changes on all of the above
* Changing online status, entering or exiting room should generate system chat messages

Working on the game

* One world
* Edit view for world, room
* Current room in Play view in iframe
* List of orphaned rooms (no way to reach them)
* List of dead-end rooms (no-way to get out)
* Ideally, a map
* A way to choose room to edit
* A way to promote/demote/ban/unban characters (or players?)

Admining the game

* Stream of all events, filterable
* Stream of all chats, filterable
* Stream of all errors
* Stream of possible code of conduct violations

Needs a highly visible code of conduct for the game.
Include respect for code of conduct as part of license agreement.

Still needs data sanitization, throttling, max characters in schema, etc.

## Objects

MODEL CHANGES NEEDED:

* Move wizard roles from character to a list of player ids in world
* Move banned roles from character to a list of player ids in world
* Create a universal banned list

List of Worlds

World
* ID
* created
* createdBy
* modified
* modifiedBy
* Name
* Summary
* Description
* Exits: list
* Starting Room

Player
* ID
* created
* lastLogin
* online
* Name
* Password
* Summary

Character
* ID
* created
* modified
* wizard
* Name
* Summary
* Description
* Player
* Room
* World

Room
* ID
* created
* createdBy
* modified
* modifiedBy
* Name
* Short Description
* Notes - for authors, not shown to players
* Exits: array of {name,destination} pairs

Message
* text
* name
* player (id)
* room (id)
* createdAt
* createdBy

## Description

Rather than having a parsing engine, will use a HTML GUI, so all available verbs, nouns, and exits are clearly avalable. In edit mode, all exits are available, but ones that don't go anywhere are colour-coded and clicking allows them to be targeted.

Don't want to make it too complicated.

## Architecture

* ~~Nginx server for static html~~ irrelevant
* JavaScript (would love to use elm if db can interface)
* Also looked at Vue.js, looks pretty good, but feather/vue adapter requires webpack/browserify (ugh) and may be out of date. UPDATE: vue.js is fine, don't need adapter.
* Trix for editing copy?
* Sanitize-html for cleaning copy
* Slack-message-parser for richer messages
* ~~GUN for database?~~
* ~~Rethinkdb for database (alternate: https://pusher.com/)~~
* FeatherJS for database connection layer / realtime updates
* Question: can I handle users with FeatherJS? Answer: Yes
* Question: can I hook up Elm with Rethinkdb? Answer: Probably
* ~~Bliss for helpers~~ Not needed with vue.js
* AWSM for styling (WIN!)
* WebSockets / WebRTC

### Why not GUN?

Aside from potential performance issues with distributing the entire list of worlds among all peers (and storing them in localStorage), there is no way to remove data from GUN, so if someone builds racist, sexist, or homophobic content, there is no way to delete it. That is not acceptable for my use case.

