Skip to content

Add Multiplayer support #36

@abc013

Description

@abc013

Describe the feature you'd like
Add multiplayer support using servers and a architecture that allows to join midgame. Servers are included in the game itself.

Describe alternatives you've considered
If midgame-joining is not possible, use lobbies instead.

Additional context
See this WIP branch.

My current proposal is that commands are sent by the players to the server. The server gathers all commands in each tick, processes them and returns the new world state (more exact: the difference to the last one). This is also used if a new client wants to join: just send the current world state.

Downsides
It will make the code a lot more complex.

Rendering, Animation ticks and ticks need to be separated.

There are still a few questions open:

  • What about local games?
  • Latency problems: Without simulation, an average internet game will take up to ~100ms.
  • What about poor client connections? The server would wait until the commands for the current tick arrive. This may not be the best idea. Instead, one could just assume that the client sent nothing and continue ticking. If the request comes a bit later, then process it in the corresponding tick. If the requests take too long, drop the client. However, this opens another can of worms: How do we determine the latency? What about missing world states? etc.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions