• Advertisement
Sign in to follow this  

[C#/C++]Multithreading

This topic is 1908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For those of you who havent heard, EVE Online encountered a massive 2800+ player fight the other day, which resulted in a less than perfect battle, I wont bother going in to details about the fight or game, however it generated a lot of complaints, the main one being "the game only uses one core, why not all?".

 

The game is built using stackless python and C++

 

Now a spokes person for CCP responded with "...there's no simple way to make something multithreaded..." among other things.

 

Ok so my question is (baring in mind I do ALL my multithreading work in C#), how accurate is this statement? I am not trying to cause a flame war or anything I just find this comment 'unusual' and feel it is invalid but due to limited experience in C++ it would be wrong of me to even assume this, help me understand what he means.

 

The link is here: https://forums.eveonline.com/default.aspx?g=posts&m=2541374#post2541374

 

Thanks in advance

 

PS: The reason I havent asked CCP myself is simply because they are terrible at replying and put very little effort in responding

Share this post


Link to post
Share on other sites
Advertisement

the main one being "the game only uses one core, why not all?"

 

I was under the impression that the main issue was server load, not client?

 

"...there's no simple way to make something multithreaded..."  ...  how accurate is this statement?

 

I would say it's pretty accurate. You can't really just flick a switch and turn on multi-threading. While some optimising compilers can parallelise some loops if they can determine there are no side effects, in general you have to actually write multi-threaded code. 

 

That's not too bad if you're starting from scratch. While multi-threaded code still has it's gotchas, more widespread use of the last few years has brought about some patterns and principles that ease the burden.

 

But refactoring an existing code base to be multi-threaded? That's very rarely easy. 

Share this post


Link to post
Share on other sites
Writing multithreaded code is easy, writing multithreaded game code that actually performs better than its singlethreaded counterpart is a bit harder and modifying a huge 10 year old serial codebase to execute well in parallell ... well ... thats borderline insanity.

Efficient parallell code is extremely different from efficient serial code, since EvE is a fairly old game there might be some low hanging fruit to pick but to get the big performance increases it might be cheaper to just start over from scratch with a new client engine.

Share this post


Link to post
Share on other sites
I don't know what kind of multithreading you did in C#, but from my experience it's not easier than in C++. So if you say, that multithreading in C# for all your needs is easy than either a) you're a freaking genius or b) your problems were perfectly fitted for multithreading.

Our brain is just designed in a way that it thinks sequential. Once multithreading comes into play, it's hard to even imagine what might happen and to think of all possible scenarios. Andrei Alexandrescu from the C++ consorptium pretty much naiiled it: "Multithreading is just one damn thing after, before, or simultaneous with another". And that's all we know.

When the code based is not designed for parallelism from the start it is a great step to adapt.

The funny thing is, that most of those people complaining about only one core being used would shut up, if you'd just create <number of cores>-1 threads in your program doing nothing but an infinite loop so they see 100% of CPU usage.

What I am trying to say is, that saying "...there's no simple way to make something multithreaded..." is very accurate. Usually, the first 2 or 3 attempts to parallelize a previously sequential algorithm/architecure will lead in full CPU usage but in slower execution. Edited by brx

Share this post


Link to post
Share on other sites

I don't know what kind of multithreading you did in C#, but from my experience it's not easier than in C++. So if you say, that multithreading in C# for all your needs is easy than either a) you're a freaking genius or b) your problems were perfectly fitted for multithreading.

 

Just to clear things up a bit, what I meant by my comment was I am only familiar with multithreading in C#, and since his comment was referring to C++ I was wondering what he meant. Oh and I should mention I wasnt a poster in that thread, and only became aware of it when it was moved. I dont actually 'play' but I do make use of their API so it made very little difference to me, this was simply curiosity more than anything :)

 

Anyway thanks everyone for answering, I sometimes word things wrongly but this truly was a "if in doubt ask" moment

Share this post


Link to post
Share on other sites

Yeah, that thing is a pain... our old build system was based on Python which basically meant all build 'setup' was single threaded (which involved working out a dependency graph; quick on small asset counts but as the assets increased so a comedy wait time was introduced before it started building) and while the external tools were run outside python because of how it was designed you had to spin up 100s of threads in order to launch and wait for them to finish... (GIL is released when waiting on an external process.)

 

Fortunately this became a big enough problem that a C#/.Net re-write was allowed \o/

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement