sashimi

package module
v0.0.0-...-9034458 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2016 License: MIT Imports: 0 Imported by: 0

README

Sashimi

Sashimi provides a small platform to play with interactive fiction programming concepts. It is not yet a complete IF engine, and may never be. ( It's not an immediate goal, for instance, to provide proper English output. )

Based on some ideas from Infom7, Sashimi uses a "scripting language" embedded inside of Go.

In the example story:

    s.The("container",
      Called("the cabinet"), In("the studio"),
      Is("openable", "closed").And("fixed in place"),
      Has("brief", "A huge cabinet, in the guise of an armoire, stands between the windows."),
      Has("description", "Large, and with a bit of an Art Nouveau theme going on in the shape of the doors."),
    )
    s.The("cabinet", IsKnownAs("armoire"))
    lookedUnderCabinet := false 
    s.The("cabinet", 
        When("looking under").Always(func(g G.Play) {
          if !lookedUnderCabinet {
              lookedUnderCabinet = true
              g.The("evil fish").Says(`"Dustbunnies," predicts the fish, with telling accuracy...`)
              g.StopHere()
          }
      }))

helps to produce the following game:

>x cabinet

Large, and with a bit of an Art Nouveau theme going on in the shape of the doors.

The evil fish is floating belly up! ...oh, curse. He was toying with you. As soon as he sees you looking, he goes back to swimming around.

>look under cabinet

evil fish: "Dustbunnies," predicts the fish, with telling accuracy...

Motivation

Why Go?

Go hits a nice middle-ground between scripting and C-like programming.

  1. No semi-colons makes it slightly more English like than other options.
  2. Back-quotes (`) for strings makes embedding dialog easier. (`"Actually, it's much easier," she said.`)
  3. Quick to compile.
  4. The AST package opens the possibility of extracting script callbacks and transforming them into other languages for other runtimes ( ex. lua with a custom C-runtime, javascript in a web-app, or C# for Unity. )
Why not Inform?

Inform is great, why not just experiment with it?

  1. Inform is easy to read, but I find it's often difficult to write stories correctly; it always takes me a fair bit of trial and error to get what I want.
  2. Not easily hackable, and I want to try new low-level features.
  3. I would like to more easily split a single story into multiple files (for instance: for multiple authors.)
  4. I would like to more readily incorporate 2D and 3D graphics.

Status and Goals

Sashimi is currently capable of handling short, one-room stories; but, it lacks many standard IF features, including save-load.

Possible future features, in no particular order:

( See the wiki for more indepth info. )

  • A process for mocking up simple point-and-click adventure games ( in progress. )
  • A more complete set of IF features, especially: movement from room-to-room, doors, clothing, dialog.
  • Documentation for the current architecture.
  • Continuous time ( instead of purely turn-based. )
  • Sqlite storage for the game world, with the ability to merge data about story generated objects from non-story sources.
  • Improved scripting: type injection for script callbacks, global variables, type inferencing, variants for object properties, prettier syntax, and improved relationship support...
  • Improved support for testing stories: especially a way to test expected output.
  • Improved object modeling: for instance, context state machines to support concepts such as "lockable", "openable", "rideable" ( instead of classes: "container", "door", "vehicle", etc. )
  • AST translation of script callbacks into other programming languages.
  • Some sort of web-based story editor.

Examples

Command line version:

The examples directory includes a version of A Day For Fresh Sushi ported from Inform7 with permission.

cd $GOPATH/src/github.com/ionous/sashimi/_examples
go run gofishgo.go

Command line options:

  • --text: use the simpler text console ( default is the fancier "minicon" which has a status bar, colors, etc. )
  • --verbose: prints full output of actions and events as they happen.
  • --dump: print all script generated classes,instances,actions, etc. to stdout, then exit.

Suppported comands include:

  • examine something, take something, open something, close something
  • look, jump, smell, attack, kiss
  • show something to someone, insert something into something else
  • ...
  • and, q (to quit)
Web version:

This is a work in progress. You need both this project and the sashimi-testapp. For example, from the sashimi-testapp root directory:

go run $GOPATH/src/github.com/ionous/sashimi/_examples/webapp.go -story sushi .

then browse to http://localhost:8080/app/, for something that looks something like this: Webapp

Documentation

Overview

sashimi package for the experimental fiction engine.

Directories

Path Synopsis
stories
Package for example stories
Package for example stories
Package appengine is an attempt at running sashimi on google's appengine It works, but is slow.
Package appengine is an attempt at running sashimi on google's appengine It works, but is slow.
Package change provides a metal/Model implementation which triggers property watch evens.
Package change provides a metal/Model implementation which triggers property watch evens.
model
Package Model provides a post-compiled representation of the scripts.
Package Model provides a post-compiled representation of the scripts.
xmodel
package xmodel provides a post-compiled representation of the scripts.
package xmodel provides a post-compiled representation of the scripts.
extension
Package game provides interfaces for the source, compiler, and runtime packages, severing circular dependencies.
Package game provides interfaces for the source, compiler, and runtime packages, severing circular dependencies.
Package meta provides interfaces for read / write interaction with models.
Package meta provides interfaces for read / write interaction with models.
Package metal implements the meta interfaces for an in-memory game model.
Package metal implements the meta interfaces for an in-memory game model.
Simple interactive fiction console based on http://github.com/nsf/termbox-go.
Simple interactive fiction console based on http://github.com/nsf/termbox-go.
net
app
Package app wraps the runtime in json input, output handlers.
Package app wraps the runtime in json input, output handlers.
ess
Package ess provides resource implementations for game session endpoints.
Package ess provides resource implementations for game session endpoints.
jsmem
Package jsmem bridges a json (net/app) game to gopherjs TBD: would []byte instead of string be faster ( re: utf8 )
Package jsmem bridges a json (net/app) game to gopherjs TBD: would []byte instead of string be faster ( re: utf8 )
mem
Package mem implements net.ess sessions for games compiled and held in local memory.
Package mem implements net.ess sessions for games compiled and held in local memory.
resource
Package resource rest-ish-ly provides game data similar to http://jsonapi.org.
Package resource rest-ish-ly provides game data similar to http://jsonapi.org.
simple
Package simple provides an http server which allows for console-like interaction with a game.
Package simple provides an http server which allows for console-like interaction with a game.
Package parser reads input and produces commands ( or errors.
Package parser reads input and produces commands ( or errors.
api
Package script provides authors an interface to create stories.
Package script provides authors an interface to create stories.
Package source provides a bridge between the script and the compiler.
Package source provides a bridge between the script and the compiler.
Pacakage standard defines common classes and behaviors for interactive fiction stories.
Pacakage standard defines common classes and behaviors for interactive fiction stories.
live
Package live provides functions useful for runtime ( live ) callbacks.
Package live provides functions useful for runtime ( live ) callbacks.
Package tests provides integration tests for script to model into runtime.
Package tests provides integration tests for script to model into runtime.
errutil
Package errutil hosts functions for merging and extending go errors.
Package errutil hosts functions for merging and extending go errors.
recode
Package recode rewrites json-interface objects ( with golang upper case keys ) to Json dictionaries ( and lowercase keys.
Package recode rewrites json-interface objects ( with golang upper case keys ) to Json dictionaries ( and lowercase keys.
uuid
Package uuid isolates the crypto libraries from the rest of the utils TODO: an "id maker" interface implemented by various things?
Package uuid isolates the crypto libraries from the rest of the utils TODO: an "id maker" interface implemented by various things?

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL