smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.78k stars 2.79k forks source link

Team Generation From Seed Is Incorrect Often #4665

Closed alexayalamcs closed 6 years ago

alexayalamcs commented 6 years ago

There are a few issues with the seed given in the replay logs of random games (though I assume this may be an issue in general). The seed given in the log when used in a simulated game will either be invalid, generate wrong teams, generate a correct team, or generate both teams correctly.

Invalid Seeds

Example Given: https://replay.pokemonshowdown.com/gen7randombattle-638469635.log

According to this documentation, the seed input for a game should be 4 values. Some random battle logs contain 12. When this is passed in as the input seed value, a default team is produced, regardless of the 12 values. That is, it appears that the seed was invalid so both teams are set to a default team containing venusaur and a few other pokemon.

Incorrect Teams

Example Given: https://replay.pokemonshowdown.com/gen7randombattle-710222490.log

Unique teams were generated but they do NOT match with the actual team played.

Player 1 Team Is Fine

Example Given: https://replay.pokemonshowdown.com/gen7randombattle-709331079.log

The team generated for player 1 is correct but the team for player 2 is NOT correct. The team for player 2 is however a unique generation.

Both Team Are Fine

Example Given: https://replay.pokemonshowdown.com/gen7randombattle-720086230.log

The teams generated are 100% correct.


This is the code I used to test these seeds: https://pastebin.com/yjsy3eWK

I believe that this should be fixed somehow or complete context is added to the replays. That is, give the full two teams information in the log. The current issue is that if a pokemon, item, move, or ability is not utilized in the match, it's impossible to know if it was in the context of the game.

That is, if I were to say sweep a team with one pokemon with one move and with a choice specs. In the replay it would be impossible to discern what other pokemons I had, what other moves my first pokemon had, and what item it had. This is useful information for replays.

alexayalamcs commented 6 years ago

I'll be happy to provide more examples of each issue as requested

Zarel commented 6 years ago

PS changes frequently, so you have to use the version of PS from the time of the replay, to get the replay.

The 12-seed version is an old version. The first 4 is the seed for the first team generation, the next 4 are the seed for the second team generation, and the last 4 are the seed for the battle itself.

alexayalamcs commented 6 years ago

Huh interesting!

Given this knowledge I can work around it, so that's helpful, thank you!

However with this, is adding context to these replays planned? It's really hard to see what actually happens in these replays since the context I described in the initial post is missing. I can obviously now work around it, but still. I feel like replays would benefit with either a consistent way of generating the teams with the seed (something futureproof) or the context being added to these replays

Zarel commented 6 years ago

I mean, I plan to add the commit hash to make it easier to grab the right version to generate the replay, it's just gotten bogged down in other work. I can do this next; it's relatively easy.

alexayalamcs commented 6 years ago

Awesome, thanks for the prompt responses! I'll close the ticket as there's nothing actually wrong with the seeds, just differing versions.