bmaupin / civ5save-editor

Civilization V save editor
https://bmaupin.github.io/civ5save-editor/
MIT License
28 stars 2 forks source link

Changing turn order from simultaneous to sequential locks out both players #5

Closed Krakus closed 6 years ago

Krakus commented 6 years ago

I changed the turn order from simultaneous to sequential in a 1 vs 1 Internet game. Now, when I load the modified save game, and both players re-join, something is wrong. Both players are always waiting for the other to continue. It is impossible to make a turn on either side to continue the game. I tried loading it several times with the same result.

AutoSave_0306 AD-1872.zip

bmaupin commented 6 years ago

That's definitely odd. This isn't something I've personally tested, but it seems like it should work. The logic for changing turn types comes from here: Civilization V: How to change the turn type of a started game. I even created a couple test games and compared the differences, and I can't find any obvious bugs.

I did some research but didn't find very much. I did see a lot of people mentioning that the multiplayer mode was buggy. But without knowing exactly what the cause is it's hard to say what the solution is. A few ideas:

For my reference, here's the comparison I did with your save as well as my test saves:

$ diff -u <(xxd AutoSave_0306\ AD-1872.Civ5Save) <(xxd AutoSave_0306\ AD-1872-2.Civ5Save)
--- /dev/fd/63  2018-02-18 14:55:21.938922378 -0500
+++ /dev/fd/62  2018-02-18 14:55:21.934922318 -0500
@@ -636,7 +636,7 @@
 000027b0: 4e41 4d49 435f 5455 524e 5300 0000 001d  NAMIC_TURNS.....
 000027c0: 0000 0047 414d 454f 5054 494f 4e5f 5349  ...GAMEOPTION_SI
 000027d0: 4d55 4c54 414e 454f 5553 5f54 5552 4e53  MULTANEOUS_TURNS
-000027e0: 0100 0000 1700 0000 4741 4d45 4f50 5449  ........GAMEOPTI
+000027e0: 0000 0000 1700 0000 4741 4d45 4f50 5449  ........GAMEOPTI

$ diff -u <(xxd test-1v1-simultaneous.Civ5Save) <(xxd test-1v1-sequential.Civ5Save)
--- /dev/fd/63  2018-02-18 14:55:12.826784821 -0500
+++ /dev/fd/62  2018-02-18 14:55:12.826784821 -0500
@@ -522,7 +522,7 @@
 00002090: 0000 4741 4d45 4f50 5449 4f4e 5f44 594e  ..GAMEOPTION_DYN
 000020a0: 414d 4943 5f54 5552 4e53 0000 0000 1d00  AMIC_TURNS......
 000020b0: 0000 4741 4d45 4f50 5449 4f4e 5f53 494d  ..GAMEOPTION_SIM
-000020c0: 554c 5441 4e45 4f55 535f 5455 524e 5301  ULTANEOUS_TURNS.
+000020c0: 554c 5441 4e45 4f55 535f 5455 524e 5300  ULTANEOUS_TURNS.
bmaupin commented 6 years ago

Any luck?

Krakus commented 6 years ago

Thanks for all the feedback, it's appreciated. I did some more testing by restoring in different ways several times. Unfortunately, I haven't been able to make more progress on my end. When I change the turn order from simultaneous to consecutive using your editor, and then re-load the 1 vs 1 game, it's always waiting for the other player, on both sides. So the game cannot continue. Kicking either player off and then having them re-join doesn't work. And it's the same whether it's hosted as a loaded game on the Internet (via Steam) or the LAN. I'm not certain now, but I may have tried hybrid mode too, without success. Maybe the simultaneous turn mode is encoding the next player in such a way that restoring is impossible.

bmaupin commented 6 years ago

Very interesting. Did you try a turn timer by chance? It could possibly be enough just to get to the next turn. Then you could even try disabling it.

So the save file is comprised of 2 main parts: the first chunk is uncompressed and contains most of the general game info. That's what my app modifies. The second chunk comprises the largest part of the file and it's compressed. I haven't looked into it but I think that's where the map, tiles, units, and detailed turn info is stored. So in theory it's possible there's something extra that needs to be changed in the compressed part of the save file in order to change from simultaneous to sequential turns. Unfortunately that's a lot of work that I don't really have time to look into, since it'd require adding a lot of extra functionality and rewriting how the app (or the underlying library) fundamentally works. Having said that, it's all open-source so anyone's welcome to look into it.

I suspect part of the reason this hasn't come up before is that in most cases I think people are trying to do the opposite, because they selected sequential (or hybrid) turns and then realize the game is taking way too long and want to switch to simultaneous.

Anyway, I think I'm all out of ideas. But I have found https://forums.civfanatics.com/ to be really helpful. Maybe they would have some more suggestions to try?

bmaupin commented 6 years ago

Any progress?

bmaupin commented 6 years ago

I'll go ahead and close this, but if you have any success in getting this working or if there's any way my app needs to be updated, feel free to let me know.

To reiterate, if anyone can help it's probably the folks at https://forums.civfanatics.com/.

Thanks!

bmaupin commented 5 years ago

@Krakus I'm guessing you've moved on and don't care about this any more, but I was wondering if you happen to remember if both players in this save game were at war with each other.

If that's the case, I just read about a bug in the game that causes this kind of behaviour:

Since India and the other 3 warring civs are all blocked, none of them ever transition to active, so the turn and game are deadlocked. We tried having every other player click end turn, but we get stuck in a state with 8 finished peaceful players and the 4 warring players are still blocked.

https://forums.civfanatics.com/threads/cannot-load-multiplayer-pitboss-game-with-hybrid-turn-mode-when-two-humans-are-at-war.528054/

Krakus commented 5 years ago

Hi, thanks for the note. Yes, from what I remember, both players were indeed at war with each other. We never did get it to work, despite trying many times. We still play the game occasionally.

bmaupin commented 5 years ago

In that case, it does sound like you probably hit that bug. If you read more at that link it sounds like the cause of the bug is one or more units that are marked as busy, which prevents the turn from ending.

One workaround would be to wait until nobody's at war before changing the turn type to something other than simultaneous. However that wouldn't guarantee that you won't hit the bug again the next time you're at war.