Skip to content

Commit

Permalink
doc(readme): add information on "muti-instance" setup
Browse files Browse the repository at this point in the history
This is a workarong for mitigating the optimisation problem
of the app when serveral player make concurrent requests
  • Loading branch information
juliendiot42 committed Sep 30, 2024
1 parent 792a87b commit 9a7e7df
Showing 1 changed file with 31 additions and 1 deletion.
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

0 comments on commit 9a7e7df

Please sign in to comment.