Replace AI by a player

Hi, I was killed in our game early on and my friends want me to return as one of AIs. Can you add me back to the game as Hungary? Hungary is being played by AI at the moment.

Best regards,
Esa

Hello,

First off, your game master may be able to set the AI player as needing substituion. You can then try joining. Tell them to look under admin tools.

If that does not work. Provide some more information.

  • link to your game
  • what is your username on PYDT (may be different to your forum username)
  • Which player slot are you wanting to sub in for.

Hi, thanks for quick reply. I will talk with our current host.

I was the original host (and creator) of the game session and I was surprised that I loose the admin view in the page.

Thank you,
Esa

Hi,

We checked the substitution options in the Admin-view; there are following views:

  • “Mark Player for Substitution“-tab with a label: “Use this to mark a player as requesting substitution so another player can take their spot.“ The drop-down has only three names (active players - I do not appear in the list), and no AI’s in the menu. We do not want to substitute any human player, so this does not seem the right option.
  • “Request Substitution”-view seem to be for the situation where the person wants to leave the game and is looking for someone to take their place.

Have we missed something? As the original host, I was able to see the Admin view before I got killed off.

Game details:

The game started with 4 players and 4 AIs; we did not leave any empty slots for the game.

Best regards,
Esa

I think you’ll need to edit the game to change it to 5 players / 3 AI since your civ is dead. At that point if “Allow users to join after start” is checked you should be able to join the game.

Thanks - I will look into that. Are there instructions somewhere regarding editing on-going game?

I assume I need to

  1. Load the save game in Civ 6 in hotseat mode.
  2. Open the lobby and change given AI to human controlled (see the picture below)
  3. Start the game. (Important not to make any moves)
  4. Save the game.
  5. Let the current host reset the game in PYDT page.
  6. Let the current host upload the hotseat save file (which I saved).

Would this be correct process or did I miss something?

I assume I will continue where AI was on turn 64? (The turn when I got eliminated). As you can see, The game has changed to 7 civs and I do not even appear in the lobby anymore. I was originally playing as France.
image

Last question: is the name I put to the player case sensitive or case insensitive? Does it matter if I write there ‘esa’ or ‘Esa’? (in terms of how PYDT assigns players to slots?)

Update: I noticed that I had set “Allow Users to Join After Start: No”. This means that I cannot join back to the game?

Best regards,
Esa

Ok, I checked the git repo and and it seems that it is not possible to join a game while “Allow Users to Join After Start”-flag is set to ‘no’.

But it seems that it is possible to edit on-going game and set “Allow Users to Join After Start” to ‘yes’ once the game is started. I will ask our current host if this option is visible in the UI

Related code that I went through:

  # edit.ts
  public async edit(
    ...
  ): Promise<Game> {
    const game = await this.gameRepository.getOrThrow404(gameId);

    // ...no conditions that I can see that would prevent this...
    game.allowJoinAfterStart = body.allowJoinAfterStart;
  # join.ts
  public async join(
    ...
  ): Promise<Game> {
    const game = await this.gameRepository.getOrThrow404(gameId);
    let targetPlayer: GamePlayer;

    if (game.inProgress) {
      if (!game.allowJoinAfterStart) {
        throw new HttpResponseError(400, 'Game does not allow joining after start!');
      }

      targetPlayer = game.players.find(player => ...
<!--
     config.component.html  - input seems to be visible always.
-->
<input type="checkbox" [(ngModel)]="model.allowJoinAfterStart" />

Since the value is nullable in database, alternative would be to set this flag to null or true in database? Since I haven’t checked the code more deeply, I don’t know if this has other implications - or whether it would break something.

The admin (merowin?) should be able to edit the game and change those settings, i believe

1 Like

What about my original assumption about how to edit the on-going game?

  1. Host modifies the game settings (in PYDT Admin-page) so that new players may join mid-game.
  2. Load the save game in Civ 6 in hotseat mode.
  3. Open the lobby and change given AI to human controlled.
  4. Start the game. (Important not to make any moves)
  5. Save the game.
  6. Let the current host reset the game in PYDT page.
  7. Let the current host upload the hotseat save file (which I saved).

Will this work? See my original question earlier in the thread.

Br,
Esa

I don’t think you need to worry about it, PYDT should edit the save.

Unfortunately we were not able to get this to work. What we did:

Current host (= player with current turn) did following:

  1. Set “Allow Users to Join After Start”-flag to ‘true’.

  2. Reset game state in web site.

  3. Open PYDT client and download the turn.

  4. Open Civ 6, load the save file (“(PYDT) Play This One!.Civ6Save”) as hotseat.

  5. In lobby, set AI in slot 6 (Hungary) to “Human” with name “esa”.

  6. Start game.

  7. After game loaded, we tried to upload the save file in two ways (using the client):

    a) immediately without making a turn, and
    b) after making the turn.
    Both times the PYDT client reported: Couldn't detect the current player in the save file. If you're converting this game from PBC or Online multiplayer, you may need to play a turn in Hotseat mode to get the file converted properly.

What does “play a turn in Hotseat mode” in this context mean? Does it mean that current host makes the turn, saves, and we replace the AI in the next players turn, or does it mean that all remaining three players must play one round first?

Br,
Esa

I think you’re making this harder than it needs to be, just try joining the game on the game page. PYDT should take care of everything.

True. I just found out about this feature now… :joy:

Unfortunately I get following error:

I suppose the game has not yet detected that I am dead?

Br,
Esa

Ahh, yeah, I put out a fix to allow dead players to rejoin if you want to try again.

1 Like

I suppose you are talking about commit bd489018 in api repo?

Great! Thank you for the effort!

Br, Esa