Debugging Concurrent Code
Debugging concurrent code is hard. The current debugging paradigms are not very well suited for multiple threads or processes manipulating the same data.
But of course, we shouldn’t be debugging in the first place - we should be writing tests, which we all know reduce the need for debugging tremendously. But the same goes for testing. Testing concurrent code is also hard, and the usual unit tests tend to lose some of their worth since they, too, might fail only one in a thousand times if there is a problem.
Our game code at Flux Studios features lots of threads and when playing multiplayer, it also runs on lots of computers. Keeping state in synch across these boundaries is not trivial. Which is why we developed a small tool that helps us a little in the process.
StateAid
is a utility that allows you to inspect states in your code in a non-linear fashion. It does so by parsing a log file which is then visualized, allowing you to inspect the state at a certain point in time. It is currently in a very early stage so it doesn’t do very much but at times it can really come in handy.