smogon / pokemon-showdown

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

pokemon-showdown simulate-battle hangs and doesn't load turn 1 on master #7605

Closed curtdissel closed 3 years ago

curtdissel commented 3 years ago

Not sure if any intentional changes were made, but when loading players alice and bob, i get p1 request and p2 request and nothing else loads. normally i would see more information including turn 1. But that isn't the case anymore.

Commands ran:

./pokemon-showdown simulate-battle
>start {"formatid":"gen8randomdoublesbattle"}
>player p1 {"name":"Alice"}
>player p2 {"name":"Bob"}

Output:

>player p1 {"name":"Alice"}
update
|player|p1|Alice||

>player p2 {"name":"Bob"}
sideupdate
p1
|request|{"active":[{"moves":[{"move":"Knock Off","id":"knockoff","pp":32,"maxpp":32,"target":"normal","disabled":false},
...
["heatwave","calmmind","protect","shadowball"],"baseAbility":"flashfire","item":"sitrusberry","pokeball":"pokeball","ability":"flashfire"}]}}

sideupdate
p2
|request|{"active":[{"moves":
...
[{"move":"Protect","id":"protect","pp":16,"maxpp":16,"target":"self","disabled":false},","ability":"powerconstruct"}]}}

On an older commit: git checkout 529fdaaa685d8aa695fba01a80cccb3c1d761f7c

Same commands would give way more information after the requests. Commands are the same, below is the output:

update
|t:|1604041942

update
|player|p2|Bob||

sideupdate
p1
|request|{"active":[{"moves":[{"move":"Roost","id":"roost","pp":16,"maxpp":16,"target":"self","disabled":false},{"
...
["protect","closecombat","icepunch","knockoff"],"baseAbility":"guts","item":"flameorb","pokeball":"pokeball","ability":"guts"}]}}

sideupdate
p2
|request|{"active":[{"moves":[{"move":"Knock Off","id":"knockoff","pp":32,"maxpp":32,"target":"normal","disabled":false},
...
["quash","knockoff","foulplay","fakeout"],"baseAbility":"prankster","item":"sitrusberry","pokeball":"pokeball","ability":"prankster"}]}}

update
|player|p1|Alice||
|teamsize|p1|6
|teamsize|p2|6
|gametype|doubles
|gen|8
|tier|[Gen 8] Random Doubles Battle
|rule|Species Clause: Limit one of each Pokémon
|rule|HP Percentage Mod: HP is shown in percentages
|
|t:|1604041966
|start
|split|p1
|switch|p1a: Kyurem|Kyurem, L80|331/331
|switch|p1a: Kyurem|Kyurem, L80|100/100
|split|p1
|switch|p1b: Sableye|Sableye, L88, M|231/231
|switch|p1b: Sableye|Sableye, L88, M|100/100
|split|p2
|switch|p2a: Azumarill|Azumarill, L82, M|298/298
|switch|p2a: Azumarill|Azumarill, L82, M|100/100
|split|p2
|switch|p2b: Zarude|Zarude, L80|299/299
|switch|p2b: Zarude|Zarude, L80|100/100
|-ability|p1a: Kyurem|Pressure
|turn|1
curtdissel commented 3 years ago

It's not a complete hang. if I type

>p1 switch 2
>p2 switch 2

I get a new side update. but the match information doesn't get printed.

Maybe there is a printout that needs to be toggled back on.

Zarel commented 3 years ago

Thanks for the report! I'll try to look into it when I have time.

Zarel commented 3 years ago

Yep, I've tested and confirmed, something's definitely wrong here. I'm surprised PS still works at all.

Zarel commented 3 years ago

...apparently the answer is that it doesn't. Worrying.

Zarel commented 3 years ago

I FINALLY FIGURED IT OUT

001f98b4f2ba57426dbdaa6ee

Zarel commented 3 years ago

Thanks for reporting this! It was a nightmare to debug but it also fixed a major bug in our Streams library. Special thanks to VS Code's built in debugger for helping narrow this down.

curtdissel commented 3 years ago

Zehahaha, I build tools that rely on the simulator. Every time gamefreaks adds to the game, it's a nightmare for me to add all the new mon and update the simulator tools. So you fixing this is a big boost to me as well.