Search code examples
pythonpygamepython-multithreading

Is using Threading in Pygame good Idea to make the game faster?


I recently made a few games with Pygame but I found out that it is quite slow and laggy also there isn't any bug in my game. I tried everything apart from creating multiple threads in my game but I am wondering if creating them could lead to some glitches or trouble in my game.


Solution

  • In theory, it could be used very sparsely and if you really know what you are doing. Threading is really not a beginner concept and threading + pygame is most likely a bad idea, will cause more problems than it solves.

    So short answer is "no", don't use threading. If your games are laggy that probably comes from your programming skills. Perhaps you could create a new post with a more specific example, sharing some code of yours, I'm sure the community would give you tons of advise to improve your coding.

    You can check out "DaFluffyPotato" on youtube. He is one of the best content creator when it comes to making complexe/advance games with pygame and pygame optimization.