Jump to content

Multiplayer Save Games


Recommended Posts

I've just read through the discussion for ticket  https://trac.wildfiregames.com/ticket/1088

Isn't loading a multiplayer saved game equivalent to setting up a new multiplayer game?

All players choose there slots, and when complete, the game will start,

but instead of generating a new game, the one from the save is used.

The parameters and world data is transmitted from the host (has the save file) to the other players,

and then the game will start as usual.

 

Link to comment
Share on other sites

But singleplayer save games work with an AI, right?

And it doesnt do a full replay on loading, or does it?

The thing I'm wondering most about is, I would expect that the game could be frozen at a turn-wrap, even for multiplayer games.

Then that state is encoded and saved.

For the AI it should be sufficient to save the states of the RNGs + where all units are etc

 

Link to comment
Share on other sites

replays work with AI, since the AI is completely deterministic, however their simstate isn't saved when serializing, so rejoining (and saving) isn't supported. For singleplayer games AI's work after loading a savegame, but might act a little different compared to how they would act without the save/load (think of the AI being brainwashed).

Link to comment
Share on other sites

1 minute ago, bb_ said:

For singleplayer games AI's work after loading a savegame, but might act a little different compared to how they would act without the save/load (think of the AI being brainwashed).

I don't understand why it would act differently. What details are not saved for the AI making it non-deterministic in this respect?

 

Link to comment
Share on other sites

1 hour ago, bb_ said:

however their simstate isn't saved when serializing, so rejoining (and saving) isn't supported. For singleplayer games AI's work after loading a savegame, but might act a little different compared to how they would act without the save/load (think of the AI being brainwashed).

But then a loaded multiplayer savegame could also just start with 'brainwashed' (==new) AIs in the respective player slots, like for a single player save game.

And rejoining human players would be solved by

2 hours ago, skeletonzombie said:

Isn't loading a multiplayer saved game equivalent to setting up a new multiplayer game?

All players choose there slots, and when complete, the game will start,

but instead of generating a new game, the one from the save is used.

(so the game does not start/continue before all human players are available),

where the large part to do is

2 hours ago, skeletonzombie said:

The parameters and world data is transmitted from the host (has the save file) to the other players,

and then the game will start as usual.

 

Or do I miss sth?

 

Link to comment
Share on other sites

8 minutes ago, skeletonzombie said:

But then a loaded multiplayer savegame could also just start with 'brainwashed' (==new) AIs in the respective player slots, like for a single player save game.

If it doesn't get the exact same brain washing on all computers, it will start doing different things or each client, so the game start will not be the same for all players any more.

Link to comment
Share on other sites

4 minutes ago, GunChleoc said:

If it doesn't get the exact same brain washing on all computers, it will start doing different things or each client, so the game start will not be the same for all players any more.

... and transmitting the AI parameters/state requires to serialize it.

Ok, now I understand that part, too.

Thanks

Link to comment
Share on other sites

One can play multiplayer games with AI, since indeed the initial state is the same. Rejoining is not possible since the rejoining person will have a brainwashed AI, while all other players will have the normal AI.

Maybe, loading a savegame on two machines gives the same state (as the AI gets brainwashed on both ends), but it has never been tried. Feel free to hack it somehow (there is no such gui ingame), but no promises if it will work...

Link to comment
Share on other sites

Subsuming as I have understood it so far:

on every computer, a complete simulation of all aspects of the game is run.
all 500ms this is synced checked for being in-sync between the computers.
what happens in between the sync is called a 'turn'.
while a turn is being simulated, each player can accumulate new commands.
but these commands do not affect the current turn,
they are synced to everybody on the next turn-wrap,
and only after that they affect the simulation.

currently the AI of AI-players is a set of deterministic scripts which is just run
on every computer, so syncing is not needed for their commands.

currently the state of the AI-players' AI itself is not saved in savegames.

even the AI's initial state is not synced between the computers,
it is just the same everywhere because it is seeded in the same way everytime.


Question:
It is possible to rejoin multiplayer games (without AI).
Does the game halt while somebody is disconnected?
Because if the game would continue without the player,
the game-state would have to be completely synced-in from another player on rejoin.
(since all players have the same simulation, it doensnt matter who would send it)


actions
- replay,
  all non-deterministic information, like human players' commands, has been saved,
  so that the whole game can literally be resimulated.
  since all commands for all players are already available,
  the whole thing can be acted out on a single computer, making turn-wraps trivial.
- savegame,
  loading this should behave as if it was the first turn of a new game,
  but with initial state already prepaired,
  i.e. loaded from the savegame instead of being generated.
  [this currently misses the state of the AI-players' AI]
- syncing on turn-wrap
  - check whether simulation is in sync,
    this is needed
    - against cheating or bugs
    - because fpu operations can differ depending on hardware architechture
  - everybody sends his commands for the next turn to everybody else,
    so the simulation stays exactly the same on all computers.
- start game
  - communicate initial parameters/state to all players,
    so the simulation is in sync for the first turn
    [How is this currently handled? e.g. at least the winning conditions must be somehow synced?]
- resolve out-of-sync, [not implemented]
  e.g. by syncing the state of the host to everybody else or similar
- rejoin (see question above)
 

Edited by skeletonzombie
Link to comment
Share on other sites

5 hours ago, skeletonzombie said:

It is possible to rejoin multiplayer games (without AI).
Does the game halt while somebody is disconnected?
Because if the game would continue without the player,
the game-state would have to be completely synced-in from another player on rejoin.
(since all players have the same simulation, it doensnt matter who would send it)

Yes it's possible. The rejoining player just downloads the commands.txt replay file from the host.

Link to comment
Share on other sites

The server sends a compressed state of the entire simulation. And all the commands from the point the rejoin was requested. While the rejoined client is executing those commands, the game would be locked in the current step.

What you are asking of is actually very simple. Conceptually at least. (Assuming the AI serializes all it needs). All the prerequisite code is already present.

None of the state changing math is floating point btw. It’s all fixed point. So, just integer operations.

Since you seem to be somewhat interested in engine design, I suggest reading up on the lockstep architecture. It’s not entirely the best engine design today, but it came from a time when bandwidth was rather precious.

Edited by smiley
  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 15/09/2019 at 8:18 PM, bb_ said:

One can play multiplayer games with AI, since indeed the initial state is the same. Rejoining is not possible since the rejoining person will have a brainwashed AI, while all other players will have the normal AI.

Maybe, loading a savegame on two machines gives the same state (as the AI gets brainwashed on both ends), but it has never been tried. Feel free to hack it somehow (there is no such gui ingame), but no promises if it will work...

Hello! This thread is already older, and I rather stumbled over it. I am especially curious about the second paragraph (loading a multiplayer saved game on two machines). How can this be done without the possibility in the GUI? Thank you!

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...


I found that thread after reading that write-up - https://tamashii-yusaburuyo.work/21_0326
Really, the multiplayer saved game equivalent to setting up a new multiplayer game
players are choosing slots, loots etc, and when complete, the game will start
Then will be started saved session with a last chacracteristics and parameters. 

So It's ok

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...