babaktr / async-deep-flappybird

Using Asynchronous Deep Reinforcement Learning to play Flappy Bird from pixel input.
30 stars 7 forks source link

What is the magic to make PyGame capable for multithreading? #1

Open DarkForte opened 7 years ago

DarkForte commented 7 years ago

Hi,

Thank you for your wonderful work on FlappyBird A3C!

I surveyed some other solutions training FlappyBird with A3C on Github, and tried out my own as well. I found many people argue that PyGame does not support multithreading (here), and so if you want to use A3C you have to do it by multiprocessing and implement the troublesome communication between processes. But I see you are just using multithreading here and it works well. Would you please share your idea on how did you achieve it?

Thank you!

babaktr commented 7 years ago

Hey @DarkForte! Thanks for you kind comments! I can't take full credit for all of it though, as it was based on this wonderful implementation of A3C!

To be honest, I didn't even know that it wouldn't be possible - so I simply did it without knowing that! Strange thing that it works though, I didn't really have any specific strategy to achieve it! 😮

Thank you again for your kind words and enjoy any further experimenting with this!