Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(readme): add information on "muti-instance" setup #45

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ There is a quick breakdown to present some option you can modify:
Here:
- `80` is the port on the host (your machine). You can choose another available
port if you like.
- `3838` is the the application is listenning to inside the container.
- `3838` is the port the application is listenning to inside the container.
You can not modify it.
- `-v /host/path/to/plantBreedGameData:/var/lib/plantBreedGame` control where
the application will save data to allow persistent storage across container runs.
Expand Down Expand Up @@ -99,6 +99,36 @@ nix build github:timflutre/PlantBreedGame # build the application

The game data will be stored at `$HOME/.local/share/plantBreedGame`.


## Installation for multiplayer session

This application currently suffer from optimization problems when several players
are connected and play at the same time. When one user make a long request to
the application, it becomes unresponsive for all the other users.

It is possible to work around these problems by launching several game instances
targeting **the same `plantBreedGame` volume**, and make each player use a different
instance.

For example to start 2 instances you can run:

```sh
docker run -d --rm --name plantbreedgame_A -p 81:3838 \
-v /host/path/to/plantBreedGameData:/var/lib/plantBreedGame \
juliendiot/plantbreedgame:latest
docker run -d --rm --name plantbreedgame_B -p 82:3838 \
-v /host/path/to/plantBreedGameData:/var/lib/plantBreedGame \
juliendiot/plantbreedgame:latest
```

One instance will be accessible on port `81` and the other on port `82`.

You can then set-up your web server's router to serve each of these instances
on different URLs, or let users access directly port `81` or `82`.

Like that, when eg. *Player-A* make a long request to `plantbreedgame_A`,
`plantbreedgame_B` will not be affected and will be responsive for *Player-B*.

# Usage

## Game Initialisation
Expand Down
Loading