Re: Manalink 3.0 multiplayers setup and test
Posted: 14 Sep 2015, 18:39
The three most obvious things that'll desync multiplayer are
There's no premade network-aware front end for choose_a_card(), since it was originally only used for Ring of Ma'ruf, but the network handling for it can be lifted out of that card's function in magic.exe.
The third case is the hardest to automatically find, the most extensive, and the hardest to fix. There are many, many cases where, instead of coaxing the AI to choose to do the right thing, it's instead forced to - Energy Arc, for example, can only legally target non-attacking creatures if player 0 is casting it; and many cards similar to Bloodthirsty Ogre have end-of-turn triggers forcing them to activate if controlled by player 1. So if one player - remember, both players in a network game think they're player 0, and the other is player 1 - casts Energy Arc and targets a blocking creature, the other player is going to think the target's illegal; and if someone controls an untapped Bloodthirsty Ogre at the end of his opponent's turn, the other player is going to think it has more devotion counters than it should. Kaboom.
- generating random numbers and not sending them over the network
- calling the non-network-aware versions of low-level UI choice functions (I think the only one Manalink uses is choose_a_card()) without communicating the result over the network
- treating players 0 (the human in a human-AI duel, or the local player in multiplayer) and 1 (the AI in a human-AI duel, or the remote player in multiplayer) differently.
There's no premade network-aware front end for choose_a_card(), since it was originally only used for Ring of Ma'ruf, but the network handling for it can be lifted out of that card's function in magic.exe.
The third case is the hardest to automatically find, the most extensive, and the hardest to fix. There are many, many cases where, instead of coaxing the AI to choose to do the right thing, it's instead forced to - Energy Arc, for example, can only legally target non-attacking creatures if player 0 is casting it; and many cards similar to Bloodthirsty Ogre have end-of-turn triggers forcing them to activate if controlled by player 1. So if one player - remember, both players in a network game think they're player 0, and the other is player 1 - casts Energy Arc and targets a blocking creature, the other player is going to think the target's illegal; and if someone controls an untapped Bloodthirsty Ogre at the end of his opponent's turn, the other player is going to think it has more devotion counters than it should. Kaboom.