by divVerent » Sat May 31, 2008 7:20 am
Benchmarks have shown that, except for the dedicated server, multithreading won't help DarkPlaces much. Even on a (to today's standards) low end computer, the client (renderer etc.) take less than 5% of the CPU power. Actually, in many cases, the CPU runs in power save mode while DP is running (and only switches to full clock speed while loading a map).
The dedicated server on the other hand could really make use of multithreading to evenly distribute load among the cores - but here the problem is with the Quake design. The language QuakeC, in which the game code is written, has no pointers or such stuff, and thus makes lots of use of global variables. Example function calls that write stuff to globals and thus can't be thread safe are traceline (uses trace_* globals), tokenize (uses argv(n) globals) and every single method call (one manually sets the "self" global before calling the method), some of which originate from the engine so the call convention can't be changed. So to make the server code multithreaded, one would have to change the language the game code is written in to support pointers/call-by-reference, and quite likely rewrite huge parts of it to make use of ways to transfer data without using global variables for everything - and in case one HAS to use a global, there'd need to be functions for locking data structures.
If however one succeeds in doing this, the maximum working player count for a "high end" server machine could increase from currently 32 to 128, if it is a quadcore (but probably just about 100, as it won't scale perfectly). Currently, the only way to fully utilize a quadcore machine as Nexuiz server is to run four servers on it - which sure is nice, but a well performing server with 128 players is far from possible yet.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again
You can vary the number of "MS", so you can clearly see it's MS which is causing it.