Skip to content

Multiplayer

ManApart edited this page May 5, 2022 · 2 revisions

Multiplayer

The game is designed for a single player, but it looked fun to build in a form of multiplayer and it currently seems to work. There is no security, auth, or checks that one bad actor can't ruin the experience for others. At this time the goal is only for local coop.

Hosting

Download the latest release of Quest Command Server and run it. java -jar quest-command-server.jar.

You can pass in a port if you'd like to use something other than 8080. java -jar quest-command-server.jar 9090

Connecting to a Host

Given you have a version greater than 0.0.5, you can start up quest command normally and then use the Connect command to connect and the Disconnect command to disconnect from the host. Note (as explained in the command's help page) that the first time you connect you'll create a new character with the given name if they don't already exist.

By default each client polls the server for updates in addition to getting them whenever they send a command. To turn this behavior off, simply use the debug command: db poll.

Technical Design

Each human is given a connection id (string). This id matches with a Player object which has a Thing (your character) and metadata like known locations and recipes. A player object is also how the game knows how to send text back to a human. The Gamestate keeps a map of ids to players, considering the first player in its map to be the main player.

Clone this wiki locally