Skip to content
/ ripcord Public

A JSON-RPC API implementing a traditional style of adventure game.

License

Notifications You must be signed in to change notification settings

kryptx/ripcord

Repository files navigation

ripcord

A JSON-RPC API implementing a traditional style of adventure game.

CircleCI

What is this?

Mostly, it's an experiment.

Since RPC has fallen so far out of favor (thanks to REST), I wanted to imagine what a user-friendly, clean developed RPC-over-HTTP API might realistically look like, free from the assumptions of an existing framework like Express.

For that purpose, I've introduced an entity -- a player character -- to which the user can issue commands. Much like the classic game, Adventure.

The API meets the JSON-RPC 2.0 Specification. It is not backwards compatible to any prior version in any way.

How to run

There are a few ways. This one's pretty good and only requires docker.

  1. Clone the repo.
  2. Inside the folder, docker build -t adventure .
  3. docker run -d -p 3000:3000 adventure

If you're going to be mucking about in the source anyway, there are also launch configurations present for Visual Studio Code and, of course, you can always just npm start.

How do I play?

  1. Create a character using the start method.
Content-type: application/json
POST /json-rpc
{
  "jsonrpc": "2.0",
  "method": "start",
  "id": "anything-you-want"
}
  1. Look at the response.
  2. Be amazed. This step is important. Take your time.
  3. Wait for more to be implemented.
  4. Look at this page later.

Notes

For now, the API stores its data in cookies. If you're playing, make sure your client sends back any cookies you receive.

Methods

move

Move to the next room, in the provided direction.

ping

Responds with "pong". Unless, of course, you don't provide an id.

reflect

Returns your player data.

start

Create a character. Create a world. Place the character in the world. Not necessarily in that order. This is for first time users. Not a general character creation API.

About

A JSON-RPC API implementing a traditional style of adventure game.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published