When to Use Threads

Use threads whenever it will provide a more enjoyable experience for the user. This means any time some code can stall or take a long time, run the code in another thread so the user doesn't think your game has stalled. For example, use threads in these situations:

  • When loading lots of files from the local file system
  • When doing any network communication, such as sending high scores to a server
  • When doing any massive calculations, such as terrain generation


   
Comments