Git Product home page Git Product logo

glulxe-httpd's Introduction

glulxe-httpd

license build status

glulxe-httpd provides an HTTP REST interface for interacting with interactive fiction (IF) stories in the Glulx (.ulx) format using glulxe. Clients (like my website) can connect to the service to start a game and then send commands to it.

Sessions are deleted after a while in a feeble attempt to save memory. This service is definitely DoS-able.

With the --csv option, transcripts of commands are saved to a CSV file. (I read what players type on my game to occasionally improve it.)

Get Started

If you haven't spent many laborous hours writing an interactive fiction game with Inform, you can download one from the Interactive Fiction Database or grab the classic Adventure game as a .ulx file from the Glulx page.

With Docker

$ docker run -p 8080:8080 -v mygame.ulx:/story.ulx ghcr.io/statico/glulxe-httpd

With Node.js

  1. Get Node.js v12 or so
  2. Install Yarn
  3. yarn install
  4. yarn start mygame.ulx

Sending Commands

First get a session ID:

$ curl -X POST http://localhost:8080/new
{
   "session": "xxxxxxx",
   "output": "Welcome to Adventure!\n\nADVENTURE..."
}

Then send commands:

$ curl -X POST http://localhost:8080/send \
-H 'Content-type: application/json' \
-d '{ "message": "look", "session": "xxxxxxx" }'
{
   "output": "At End Of Road\nYou are standing at the end..."
}

Pro tip: Run the server with --debug to always make the session ID test.

See Also

I thought about running Quixe -- a Glulx interpreter written in JavaScript -- from within Node like I did with my original Z8 server. However, Quixe seems designed for the browser, not Node, and this just seemed a lot simpler.

These projects are good but don't support sessions and/or don't save transcripts:

My original version of this used a Z-machine emulator for .z8 games: https://github.com/statico/ifhttp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.