Curveship

Writing for Curveship-js

To write a Curveship-js story file ending in ".js" one needs only define some metadata, provide sequences of Places, Actors, Things, and Events, and then conclude with a final, standard two lines.

The easy things, such as defining a story that is like a folk tale, with straightforward story elements and little underlying complexity, are meant to be easy to implement in Curveship-js. See robbery.js for one reasonably simple example, with only a few special nuances; even simpler is waiting.js. The harder things are meant to be possible, even if they may take some effort. See hour.js and prodigal.js

The metadata is an associative array with your own title, author, date, instructions, and examples, several of which are optional. See the beginning of any story file for an example.

Places in the most simple case are defined like so:

  place.stairs = new Place("the", "stairs");
  place.outside = new Place("", "outside the Mallard house");
  place.rail = new Place("a", "rail line");

This declares that there are three Places. They each have a unique tag (stairs, outside, rail) which is used to refer to them elsewhere in the code. Each time the Place class is instantiated, it is given two arguments, and generally needs at least these two arguments. They correspond the the initial article and the noun phrase. Whenever “rail line” is first mentioned in the story, it will be called “a rail line.” If it is mentioned again, it will be called “the rail line.” But “the stairs” are a part of the house that is taken for granted, so they are called “the stairs” initially. While there are other optional arguments in defining Places, and it’s possible to learn about them though the examples, these are the only ones required.

Actors are defined like so:

  actor.louise = new Actor("", "Mrs. Mallard", spatial.in, place.downstairs,
                           pronoun.feminine);
  actor.doctors = new Actor("the", "doctors", spatial.of, actor.cosmos,
                           pronoun.masculine, 2);

In the first line, an Actor (“louise”) is defined without an article (she will never be referred to as “a Mrs. Mallard” or “the Mrs. Mallard”) and with the noun phrase “Mrs. Mallard.” She is initially located in the place with the tag “downstairs.” She is referred to using feminine pronouns.

In the second line, an Actor (“doctors”) is defined without the article “the” (they will be called “the doctors” from the start) and with the noun phrase “doctors.” They are initially located offstage, possessed by the Cosmos but not in any place. Masculine pronouns are set for them. The “2” at the end indicates they are plural. Because the doctors are plural, it doesn’t matter which of the several pronoun options are chosen, as plural pronouns are the same for all of them. But all Items do need to have a PronounSet defined.

Things are then defined, e.g.:

  thing.chair = new Thing("a", "comfortable chair", spatial.in, place.room);
  thing.trees = new Thing("some", "trees", spatial.in, place.outside);

As with other Existents, these two things get their own tags (“chair” and “trees”), have their articles set, and are situated in places. It is not necessary to explicitly declare that these use neuter pronouns, because things use such pronouns by default. It is also not necessary to explicitly declare that the trees are plural, because Curveship-js figures that out based on the article “some,” a plural article.

Events come after this, each one assigned to a variable. As the events are read in, they will be added to eventSeq, putting them in chronological order. Here is the simplest case of an event definition:

  var SOB = new Event(actor.louise, "sob");

This defines an event in which the Actor with the tag “louise” undertakes an (intransitive) action, sobbing or crying. The events that occur earlier in the file will be read in and made chronologically earlier; then this one will be read; and finally, the events after this one, which will made chronologically later.

There are many more complex possibilities. In Curveship-js, an Event can itself be the argument to another event, so for instance an actor can see or realize something that has previously happened. Again, checking the examples provides the best introduction to the complexities of events. For now, to elaborate slightly further, here is a transitive Event and one with an indirect direct object:

  var ASK_TO_ENTER = new Event(actor.josephine, "ask to enter", place.room);
  ...
  var OPEN_FRONT = new Event(actor.brently, "open +ing", "the front door",
      temporal.with, "a latchkey");

In the first case, “ask to enter” can be used as the verb phrase and “ask” will be conjugated, as in asked to enter, asks to enter, etc. Adding “+ing” to the string defining the verb forces it to always be realized in the progressive, as in was opening, is opening, etc. If the verb is negated, one can simply prepend “not” as in “not open” to have the realization be did not open, does not open, etc. Note that the front door and the latchkey are not implemented as actual Existents in this example. They could have been, but since they are only mentioned as part of this Event, and these phrases never need to be realized in any different way, it’s possible to take this shortcut and simply use the appropriate strings.

In a standard story file, the final two lines are:

  var world = new World(place, actor, thing, eventSeq);
  function run() { narrate(metadata, {}, world); }

A corresponding HTML page is also needed, which is in a standard format.

Any “spin” (narrative discourse specification) can be applied to any story file, as long as the correct actors are referenced when setting the narrator and narratee. The examples show how this is done.

The source files of the interactive examples offered online are currently the best guide to writing for Curveship-js:

As of the 0.2.0 release, the recommended way to write a new Curveship-js story file and the corresponding HTML page is by modifying existing files.

Main Curveship Page