Unknown Worlds is a self-funded, independent game company in San Francisco, CA. Our goal is simple: to unite the world through play.

Report RSS Multi-threading in Natural Selection 2

As Max explains, Natural Selection 2 is already multi-threaded. The renderer, game logic, map loader, sound, and physics all run in different threads. If you alt-tab out of NS2 during gameplay, and look at Task Manager, you will see it happily gobbling up clocks from several CPU cores.

Posted by on

Since the Pentium 4 introduced the mainstream consumer to the concept of having more than one thread, people have grown more and more accustomed to that idea that multithreading a program always means better performance. The video below was recorded on Dec 7 2011, in the Unknown Worlds office. In it, Max, Brian No.1 and Dushan discuss the different implementations of multi-threading in Natural Selection 2.


As Max explains, Natural Selection 2 is already multi-threaded. The renderer, game logic, map loader, sound, and physics all run in different threads. If you alt-tab out of NS2 during gameplay, and look at Task Manager, you will see it happily gobbling up clocks from several CPU cores.

However, running everything on different cores is not always the best option. On Dec 7, Max was experimenting with a unique and rarely used case: The listen server. A listen server is a server running on the same machine as a client.

For example, I could host an NS2HD server, and play with you all in it while it is running. You get the option to create a listen server in the 'Create' menu. When you do, you create a client and server that run in a single, intertwined thread.

Us players don't often need or want to create listen servers. But the developers create them all the time, to experiment with new features, check gameplay, and test changes. Max hoped that by multi-threading the listen server, effectively separating client and server, the he and his fellow developers could realise a speed boost in their day to day work.

Unfortunately, like so many things to do with computers, it did not work as expected. While simple in theory, the two threads did not behave well in practice. Max found the game became hitchy and unplayable. While Unknown Worlds could have spent another day trying to work out what was happening, Max made the decision that it would be better to spend time working on other tasks, such as client performance.

Thanks for watching and reading, and look out for more NS2 videos in the near future!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: