cRz-Shadows / Pokemon_Trainer_Tournament_Simulator

Here we have an environment for running large amounts of Pokémon battle simulations in the command line.
53 stars 3 forks source link

runSimulations.py hangs not long after it starts running #3

Open esoccoli opened 3 weeks ago

esoccoli commented 3 weeks ago

So I am trying to use this program to simulate battles between every pokemon, and I have been running into an issue where I will run 'runSimulations.py', and it will run fine at first, but then after a couple of log messages, it will just hang, and seemingly never continue running. The point that it hangs doesn't seem to be consistent, as sometimes it hangs almost right away, but other times it runs fine for 30ish seconds before hanging. I have tried waiting for it to see if it is just taking a while, but this doesn't seem to be the case. Normally, while it runs properly, I will see a log message telling me the number of simulations and estimated time left every 5 or so seconds. I have set a timer and waited anywhere from 5 to 10 minutes on multiple occasions while it is stuck, and it never continues. I always have to stop it, and then if I go to re-run it the same thing happens.

I have tried changing the number of simulations to a smaller number, but it doesn't fix it. Regardless of how many simulations it is set to run, it still hangs after up to 1 minute. I have checked my system performance as well, and neither my CPU nor RAM are at 100% usage when it hangs. At this point, I have absolutely no clue why this is happening, as I have tried everything I can think of. If you have any ideas as to why this is happening or how to fix it, that would be greatly appreciated.

Also, for reference, I am running Windows 11 and am using the versions of python, node, and npm recommended in the README

cRz-Shadows commented 3 weeks ago

Sounds like it's constantly trying to replay a battle which is erroring out. First guess is you probably made a mistake when defining teams or pokemon builds, I'm guessing you defined your own?

esoccoli commented 3 weeks ago

Yeah. I defined my own builds. Most of them are copy pasted sets from Smogon, but there were some that I had to make myself.

esoccoli commented 3 weeks ago

Ok so after going through some of my builds, i discovered one pokemon that had 5 moves by accident, so that was probably at least part of the issue. Do you happen to know if there is any way to more easily validate the format of the builds? I haven't been able to find anything, but I would love to not have to go through all 1k+ builds manually and hope to spot all the issues (if there are any others still)

esoccoli commented 2 weeks ago

Ok so I have an update on this. I have now been running into the issue of the program hangs when it is fairly close to being done. I have tried changing the pokemon builds, changing the number of times each matchup is run, and also tried changing the number of threads that the program uses. However, no matter what I do, the program will always hang when it is getting close to being done.

I have tried multiple different attempts trying to simulate every gen 1 mon against each other. The first time, I tried having it run each match 100 times. This resulted in the estimated time from the logs being about 24 hours. I let it run, and it was the only thing running on my computer other than windows itself, and it worked fine for about 20 hours, and then the program seemed to hang. I tried waiting to see if it was just being slow, and left it going overnight. In the 8 or so hours I slept, it made zero progress. I then tried to see if I could debug it using the error checking scripts provided, but they kept giving me errors (though this may have been my fault bc i didn't quite understand what filepaths i had to change for it to work properly). Eventually, I gave up and aborted it. I changed some settings, notably changing the number of times each match is run from 100 to 25, and reducing the number of threads it uses to see if maybe the issue was that my computer just stopped being able to handle it. I let it run for about 5 hours, and it seemed to be going well, but then it stopped making progress with about 1 hour left. I waited for 2-3 more hours to see if anything would change, and no change.

At this point, I am completely at a loss as to what is happening. I have tried changing just about every setting I can think of, I have tried changing the pokemon builds, and I have closed as many other programs on my computer as I possibly could. However, despite that, no luck. I also don't think my CPU is the issue, because in one of the attempts, i checked my CPU usage in task manager while it was hanging, and it said that my CPU was at 90%.

Do you have any idea what is going on here? It has been completely impossible for me to get the program to finish fully, and I find this program to be really cool and I want to be able to use it.

cRz-Shadows commented 2 weeks ago

As I said, it is most likely one of your builds, likely near the end of the file causing the issue. If you just comment out the block of code in runSimulations which makes it retry on fail, it'll just skip the failing battles and you can look at the battle log by searching for "error" to see where and why it failed... though it probably won't be immediately obvious as the showdown error messages generally say something completely different which was inadvertently caused by some other issue.

esoccoli commented 2 weeks ago

I will try that, thank you!