There's this post, it's highest voted answer got me curious about the many ways of threading games.
My game has input update, game logic update, user interface update and expensive operations methods. Usually the game runs smoothly, but sometimes the user triggers a very expensive method that makes the game freeze for a few seconds, which is of course unacceptable for release, but the method serves development purposes. I hope the freezing can be resolved by threading, so that expensive method may be used in release.
Everyone says the UI thread must have the highest priority, but I'd like it to be second to the input update thread, so the interface (as well as player controls) is as responsive as it can be. But maybe I'm wrong and it doesn't work as I'm imagining, I haven't really succeeded in trying out either way, since XNA is a bit different from a normal C# application (always running Update method instead of just going down the code).
Which threading option (ThreadPool, Thread or BackgroundWorker) should I use (and how) to achieve maximum responsiveness, while not letting the game freeze when doing occasional expensive operations?
Stuff to read on threading:
ThreadandBackgroundWorker, and it still causes severe lags, but over time, instead of a constant freezing. Maybe there are some parameters to tune them, but I couldn't find a nice tutorial that tells me how to do this without causing lags. – user1306322 Feb 27 at 23:12