DB is single threaded because it is written in Visual Basic 6.0, which only allows the creation of single threaded executables. In coming months, I may explore porting the VB code to a more modern version of VB. A newer version would allow for the addition of additional threads of execution which would allow the program to do multipel thigns independently without blockign the entier propram.
This port would be relativly straight forward, certainly must less work than say, porting the current code to another language altogether such as C++ or C# and would entail a minimum of rewriting and rearchitecting. In particular, this kind of same-language port is unlikly to introduce large numbers of new bugs like a cross-language port with rearchitecture would. I'm confident stability could be maintained. Once on this new platform, making incremental enhancements to take advantage of multiple processors, not block the mainline sim on internet operations and so on would be relatively easy.
The way IM works currently is that the code does a series of syncronous file operations across the network using the FTP protocol - upload each bot file, down load the incoming ones, upload the local population file, download the others from the other sims. Each one of these file oeprations is independent and has a timeout of 30 seconds each. The cumulative timeout is why DB appeaprs to hang for minutes when the server is not responding. That is, the code gives the server 30 seconds to respond for each request and because of the single threading, the sim blocks, waiting for the operations to complete.
If you hit the IM button to switch out of IM mode, the sim should "release" once the current operation times out and should return to normal non-IM operation within a minute or two (it may have to wait for multiple operations to time out).
I need to do a better job of not doing the rest of the operations when one times out but the main problem is that either our server or the VB6 FTP control that handles the client side communiciaton or both is flaky. I want to move us to a real FTP server ASAP. Then I want to port to a newer VB version, make DB multi-threaded and perhaps move to a different underlying protocol other than FTP (for scalability reasons). One day, we will have to write/run our own custom server I expect but that's a long term plan.