Question on future performance

AlphaWolfAlphaWolf Join Date: 2003-01-11 Member: 12175Members
edited December 2012 in NS2 General Discussion
I'm noticing that for both dedicated servers and pure clients, the game uses at most two cores, maxing out one and making little use of the other. Does UWE plan on changing this? That is, utilization of more cores (all of my systems have four) or at least better distribution of work to the second core?

Comments

  • DavilDavil Florida, USA Join Date: 2012-08-14 Member: 155602Members, Constellation
    Lua doesn't do a very good job working with multiple cores. Soooooo I dunno
  • CommunistWithAGunCommunistWithAGun Local Propaganda Guy Join Date: 2003-04-30 Member: 15953Members
    <!--quoteo(post=2052965:date=Dec 29 2012, 12:54 PM:name=Davil)--><div class='quotetop'>QUOTE (Davil @ Dec 29 2012, 12:54 PM) <a href="index.php?act=findpost&pid=2052965"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Lua doesn't do a very good job working with multiple cores. Soooooo I dunno<!--QuoteEnd--></div><!--QuoteEEnd-->

    Which is pathetic. This isn't 1989.
  • DwavenhobbleDwavenhobble Join Date: 2012-12-14 Member: 175044Members
    <!--quoteo(post=2052965:date=Dec 29 2012, 06:54 PM:name=Davil)--><div class='quotetop'>QUOTE (Davil @ Dec 29 2012, 06:54 PM) <a href="index.php?act=findpost&pid=2052965"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Lua doesn't do a very good job working with multiple cores. Soooooo I dunno<!--QuoteEnd--></div><!--QuoteEEnd-->
    Gives me hope my old single core 3.6gigahertz CPU might be worth reviving after all
  • Kommunism Must LiveKommunism Must Live Join Date: 2012-12-29 Member: 176682Members
    edited December 2012
    <!--quoteo(post=2052943:date=Dec 29 2012, 11:00 AM:name=AlphaWolf)--><div class='quotetop'>QUOTE (AlphaWolf @ Dec 29 2012, 11:00 AM) <a href="index.php?act=findpost&pid=2052943"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm noticing that for both dedicated servers and pure clients, the game uses at most two cores, maxing out one and making little use of the other. Does UWE plan on changing this? That is, utilization of more cores (all of my systems have four) or at least better distribution of work to the second core?<!--QuoteEnd--></div><!--QuoteEEnd-->


    Hi AlphaWolf;

    i have two core 3.0 processor and game before the patch all detail is full i taking 77-80 fps and after the last patch i taking 91-95 fps with same graphic setup...
    this last patch is the bestest perfect performance patch i guess. developers fixing the ns2's performance problem.

    really perfect performance patch.

    ty to developer/s...
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands Join Date: 2003-05-13 Member: 16271Members, NS2 Playtester, Squad Five Blue
    clock for clock the old singlecores are slower though compared to even the C2D era... Also apparently its not that easy to thread game logic, NS2 does offload some things that can be easily offloaded. And as such multithreading isn't a magic bullet to make games perform better either...
  • Katana314Katana314 Join Date: 2012-11-03 Member: 166379Members
    <!--quoteo(post=2052979:date=Dec 29 2012, 02:37 PM:name=CommunistWithAGun)--><div class='quotetop'>QUOTE (CommunistWithAGun @ Dec 29 2012, 02:37 PM) <a href="index.php?act=findpost&pid=2052979"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Which is pathetic. This isn't 1989.<!--QuoteEnd--></div><!--QuoteEEnd-->
    An ideal lua-based system wouldn't put any of the core programming in Lua...it would just try to give it the parts that might change often, while the heavy load is handled by the other cores and the engine itself. I don't know how effective this engine is at that sort of thing...
  • SquishpokePOOPFACESquishpokePOOPFACE -21,248 posts (ignore below) Join Date: 2012-10-31 Member: 165262Members, Reinforced - Shadow
    Multithreading programming is a pain in the ass anyways... gotta worry about locks and parallel instructions that give ya the wrong answer if you don't do it right. Annoying to non-clever people such as myself.
  • AlphaWolfAlphaWolf Join Date: 2003-01-11 Member: 12175Members
    edited December 2012
    <!--quoteo(post=2053028:date=Dec 29 2012, 05:07 PM:name=Kouji_San)--><div class='quotetop'>QUOTE (Kouji_San @ Dec 29 2012, 05:07 PM) <a href="index.php?act=findpost&pid=2053028"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->clock for clock the old singlecores are slower though compared to even the C2D era... Also apparently its not that easy to thread game logic, NS2 does offload some things that can be easily offloaded. And as such multithreading isn't a magic bullet to make games perform better either...<!--QuoteEnd--></div><!--QuoteEEnd-->

    Well I'm not *that* concerned about the client (mine runs at a higher FPS than I even need) but I was looking at setting up a server, and it looks like even high end server hardware will struggle to keep a decent tick rate for high pop.

    I've got a xeon 3470 3.0ghz server (not cheap) on my hands, and from what I'm able to determine (based on reports from others) it isn't ideal for anything more than 12 players. Unless the reports are wrong? They are over a few months old (pre-release.)
  • DavilDavil Florida, USA Join Date: 2012-08-14 Member: 155602Members, Constellation
    The best servers were actually just running off of i7's OC'ed to around 4.2ghz during the beta.
  • AzaralAzaral Join Date: 2012-11-19 Member: 172408Members
    Multithreading can be a pain in the ass nightmare. Many pitfalls can happen. Plus in game programming a lot of stuff has to happen in order. In order for C to get done, B has to be done, which needs A to be done.
  • _Necro__Necro_ Join Date: 2011-02-15 Member: 81895Members, Reinforced - Shadow
    Yeah, Multi threading isn't the best answer.

    I think they could win much performance in profiling the code in late game and translate the functions that create the most load into the c++ part of the engine.
  • evohunzevohunz Join Date: 2012-12-07 Member: 174448Members
    if the CPU is the bottleneck, multithreading can be huge performance boost.

    It can be annoying, but I have faith in those who made their own engine for a game.

    They could use Haskell for easy parallelization, it can be interleaved with C code.
  • _Necro__Necro_ Join Date: 2011-02-15 Member: 81895Members, Reinforced - Shadow
    You can't just multi thread something. Some calculations need the results of other calculations. Splitting them into parts that can be calculated on different cores would only make it slower in this case. Because the 2 calculations have to wait on each other anyway, but now you created overhead that needs to calculate when what thread gets what core. Multi-Threading isn't some magic mumbo jumbo you just "add" and than the game gets faster. It depends on what calculations can be possibly parallelized. And it bears some really bad ways for errors. Errors that will occur very irregularly making it extremely difficult to find them or even notice them while testing the game.
  • VittuLimaVittuLima Join Date: 2012-12-25 Member: 176227Members
    I don't understand what is this nonsense about NS2 only using 2 cores, my i5-3570k 4 core loads are almost identical when i play NS2 :O
  • DavilDavil Florida, USA Join Date: 2012-08-14 Member: 155602Members, Constellation
    edited December 2012
    The way this game uses multithreading with Lua, is that it's divided into several VM's. Each VM gets it's own thread and it's up to the operating system to determine what core will get what thread. That's the way using several cores works pretty much everywhere, the OS decides what gets priority and assigns a cpu core for it. As far as NS2 not using all cores, that's not true necessarily. I'm not saying it doesn't happen, but if it is happening it's because the OS is deciding that. Link to a screen shot showing NS2 being used on 4 threads which are each on a different core below.

    <a href="http://an.davidsirritation.com/NS2.png" target="_blank">NS2 on several cores</a>

    *Edit: I realize I'm not showing up to core 7 but that's because it won't fit on the screen
  • NeoRussiaNeoRussia Join Date: 2012-08-04 Member: 154743Members
    edited December 2012
    It always uses around 25% of your CPU, no matter what. I tried actually disabling cores and multithreading and did a test of NS2 running on only 2 cores, the difference in fps was so minimal I'm guessing it was from background applications running on those cores that was slowing it down.

    <a href="http://puu.sh/1HfWt" target="_blank">http://puu.sh/1HfWt</a>

    You can expand the frames using the "views" dropdown. Here is the second screen on my monitor with my i7 3770k running at 4.2ghz, getting about 80 average ingame in a 18p server.
  • kaoDkaoD Join Date: 2005-01-07 Member: 33289Members, Constellation
    edited December 2012
    Games don't use CPU cores and will never do. Deal with it. That's just how game programming works.

    There's no way to parallelize game computations. A render thread and a logic thread, that's what you're seeing and what you'll see in 99% of games.
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands Join Date: 2003-05-13 Member: 16271Members, NS2 Playtester, Squad Five Blue
    <!--quoteo(post=2053093:date=Dec 29 2012, 11:35 PM:name=AlphaWolf)--><div class='quotetop'>QUOTE (AlphaWolf @ Dec 29 2012, 11:35 PM) <a href="index.php?act=findpost&pid=2053093"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Well I'm not *that* concerned about the client (mine runs at a higher FPS than I even need) but I was looking at setting up a server, and it looks like even high end server hardware will struggle to keep a decent tick rate for high pop.

    I've got a xeon 3470 3.0ghz server (not cheap) on my hands, and from what I'm able to determine (based on reports from others) it isn't ideal for anything more than 12 players. Unless the reports are wrong? They are over a few months old (pre-release.)<!--QuoteEnd--></div><!--QuoteEEnd-->
    The thing is that during beta as mentioned by Davil, the good servers are still the ones that are running on a single thread (multiple servers that way ;), on overclocked i5's and i7's Sandy or Ivy bridge, running at 4.2+Ghz. Those servers can easily handle 18 players at a constant 30 ticks. I've not played much on 20-24 player servers, not because of performance, but because of balance (maps too small, teams not scaling and such). SO I don't know for sure if this uber rigs can run at least at 28+ticks at a constant rate.

    You simply need that amount of Ghz to get a server running smoothy, anything below that magic 4.2Ghz mark is asking to be run at only 12 players afaik...
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands Join Date: 2003-05-13 Member: 16271Members, NS2 Playtester, Squad Five Blue
    <!--quoteo(post=2053093:date=Dec 29 2012, 11:35 PM:name=AlphaWolf)--><div class='quotetop'>QUOTE (AlphaWolf @ Dec 29 2012, 11:35 PM) <a href="index.php?act=findpost&pid=2053093"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Well I'm not *that* concerned about the client (mine runs at a higher FPS than I even need) but I was looking at setting up a server, and it looks like even high end server hardware will struggle to keep a decent tick rate for high pop.

    I've got a xeon 3470 3.0ghz server (not cheap) on my hands, and from what I'm able to determine (based on reports from others) it isn't ideal for anything more than 12 players. Unless the reports are wrong? They are over a few months old (pre-release.)<!--QuoteEnd--></div><!--QuoteEEnd-->
    The thing is that during beta as mentioned by Davil, the good servers are still the ones that are running on a single thread (multiple servers that way ;), on overclocked i5's and i7's Sandy or Ivy bridge, running at 4.2+Ghz. Those servers can easily handle 18 players at a constant 30 ticks. I've not played much on 20-24 player servers, not because of performance, but because of balance (maps too small, teams not scaling and such). SO I don't know for sure if this uber rigs can run at least at 28+ticks at a constant rate.

    You simply need that amount of Ghz to get a server running smoothy, anything below that magic 4.2Ghz mark is asking to be run at only 12 players afaik...
  • NeoRussiaNeoRussia Join Date: 2012-08-04 Member: 154743Members
    Most of the official servers are laggy at least 50% of the time, and they run 18p on OC'd hardware.
  • DavilDavil Florida, USA Join Date: 2012-08-14 Member: 155602Members, Constellation
    <!--quoteo(post=2053358:date=Dec 30 2012, 10:01 AM:name=kaoD)--><div class='quotetop'>QUOTE (kaoD @ Dec 30 2012, 10:01 AM) <a href="index.php?act=findpost&pid=2053358"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Games don't use CPU cores and will never do. Deal with it. That's just how game programming works.

    There's no way to parallelize game computations. A render thread and a logic thread, that's what you're seeing and what you'll see in 99% of games.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Not true, it depends on the game. Very very very very very few are actually optimized for it though. The only actual example I can think of is Flight Simulator X and Witcher2 that will use all 4. Most other games end up using 2 or 3, BF3 uses 2, Skyrim 2, Bulletstorm 3, Crysis 2 uses 3 on high settings. So no not true at all.
  • DeathshiningDeathshining Join Date: 2012-11-14 Member: 170977Members
    <!--quoteo(post=2053385:date=Dec 30 2012, 07:59 PM:name=Davil)--><div class='quotetop'>QUOTE (Davil @ Dec 30 2012, 07:59 PM) <a href="index.php?act=findpost&pid=2053385"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Not true, it depends on the game. Very very very very very few are actually optimized for it though. The only actual example I can think of is Flight Simulator X and Witcher2 that will use all 4. Most other games end up using 2 or 3, BF3 uses 2, Skyrim 2, Bulletstorm 3, Crysis 2 uses 3 on high settings. So no not true at all.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Well Bioshock, which is a bit older uses a lot of multithreading according to their lead programmer:

    - simulation update (1 thread)
    - UI update (1 thread)
    - rendering (1 thread)
    - physics (3 threads on Xenon, 1 or more on PC)
    - audio state update (1 thread)
    - audio processing (1 thread)
    - texture streaming (1 thread)
    - file streaming (1 thread)

    Also, the operating system has a lot of influence on how threads get divided onto each available cpu core. Windows XP for example had quite a lot of problems with more than 2 CPU cores.

    Multithreading a game still is a pain, as there are so many systems that depend on each other and some even will fail or cause big stalls when they do not get their result in time or before another process wants to run that depends on the one waiting.
  • DavilDavil Florida, USA Join Date: 2012-08-14 Member: 155602Members, Constellation
    <!--quoteo(post=2053470:date=Dec 30 2012, 04:01 PM:name=Deathshining)--><div class='quotetop'>QUOTE (Deathshining @ Dec 30 2012, 04:01 PM) <a href="index.php?act=findpost&pid=2053470"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Well Bioshock, which is a bit older uses a lot of multithreading according to their lead programmer:

    - simulation update (1 thread)
    - UI update (1 thread)
    - rendering (1 thread)
    - physics (3 threads on Xenon, 1 or more on PC)
    - audio state update (1 thread)
    - audio processing (1 thread)
    - texture streaming (1 thread)
    - file streaming (1 thread)

    Also, the operating system has a lot of influence on how threads get divided onto each available cpu core. Windows XP for example had quite a lot of problems with more than 2 CPU cores.

    Multithreading a game still is a pain, as there are so many systems that depend on each other and some even will fail or cause big stalls when they do not get their result in time or before another process wants to run that depends on the one waiting.<!--QuoteEnd--></div><!--QuoteEEnd-->

    There's a big difference between cores and threads. A thread is run on a core, more or less a core is like the factory and the thread is like the conveyor in/out of the factory. If you have a ton of conveyors but now much production nothing will come out, similarly if you have tons of production but no throughput the factory(core) is waiting to send things out.
  • Soylent_greenSoylent_green Join Date: 2002-12-20 Member: 11220Members, Reinforced - Shadow
    There's nothing that inherently prevents games from being efficiently multithreaded. There are three major ways to have a go at the problem:

    1) You can split up <b>different, independent tasks</b> into different threads; you'll have networking in one thread, sound processing in another, particle simulations in another etc. This will not give a big speed up and it doesn't scale to more cores because most of the heavy tasks have to occur in a specific order.

    2) You can "pipeline" dependent tasks and run them at the same time. E.g. You are rendering the current frame, calculating the physics for the next frame and doing the game logic for next next frame. This promises big speed ups, but it introduces horrible input latency and responsiveness issues and it doesn't scale to dozens of cores.

    3) You can parallelize the individual tasks. E.g. a hydra is dependent on the player positions having been updated(unless you cheat and use last frame's) but it is not dependent on other hydras; you can sort objects into a couple of buckets within which gamelogic for objects is independent and can be run in parallel. This often doesn't work because there is a overhead associated with splitting up a task across many threads, if the task is too small it's not worth it.

    #3 is still the most promising because there are two important changes happening, games are becomming more complex(=more stuff that can run in parallel) and context switching overhead keeps getting smaller with each new generation of CPU. This is most common way games on the PS3 use the cell processor, even if it is a pain in the ass for programmers(it's even worse, SPEs are in-order, deeply pipelined and balanced towards SIMD).
  • OnosFactoryOnosFactory New Zealand Join Date: 2008-07-16 Member: 64637Members
    Wow, that post had so much info presented in an understandable manner, I learnt alot. Brilliant!
  • AlphaWolfAlphaWolf Join Date: 2003-01-11 Member: 12175Members
    The thing is, CPU's these days are hitting a pretty hard limit with regard to how fast single cores can perform due to heat and physical die size limits. Everything is ultimately moving towards parallelization. In order for games to advance any further, it WILL become necessary to code accordingly. The question is who can come up with a genius solution to allow for games to parallelize better. I'm sure there's a way, we just haven't thought of it yet.
  • Soylent_greenSoylent_green Join Date: 2002-12-20 Member: 11220Members, Reinforced - Shadow
    edited January 2013
    <!--quoteo(post=2053640:date=Dec 31 2012, 05:38 AM:name=AlphaWolf)--><div class='quotetop'>QUOTE (AlphaWolf @ Dec 31 2012, 05:38 AM) <a href="index.php?act=findpost&pid=2053640"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->In order for games to advance any further, it WILL become necessary to code accordingly. The question is who can come up with a genius solution to allow for games to parallelize better. I'm sure there's a way, we just haven't thought of it yet.<!--QuoteEnd--></div><!--QuoteEEnd-->

    It's usually the other way around, at least when it comes to super computers and very consciously so.

    Amhdahl's law gives you the expected speed up when some fraction of the time is spent in code that is sequential and not easily parallelized. Battling Amhdahl's law is hard.

    Gustafsson's law in effect tells you that you can always make a problem easily paralellizable by adding more stuff that is easily parallelizable, so that the sequential fraction becomes smaller. You're making the problem much bigger, but you'll use your extra computing power efficiently. This is much easier; first you figure out what can easily be done in parallel, then you figure out how to cram more of that into your games in a way that is interesting to the player; you don't achieve a speed up in the frames per second sense, but you can churn through more work per frame, which hopefully provides some value to the player.
  • derWalterderWalter Join Date: 2008-10-29 Member: 65323Members
    edited January 2013
    <!--quoteo(post=2053026:date=Dec 29 2012, 11:06 PM:name=Kommunism Must Live)--><div class='quotetop'>QUOTE (Kommunism Must Live @ Dec 29 2012, 11:06 PM) <a href="index.php?act=findpost&pid=2053026"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Hi AlphaWolf;

    i have two core 3.0 processor and game before the patch all detail is full i taking 77-80 fps and after the last patch i taking 91-95 fps with same graphic setup...
    this last patch is the bestest perfect performance patch i guess. developers fixing the ns2's performance problem.

    really perfect performance patch.

    ty to developer/s...<!--QuoteEnd--></div><!--QuoteEEnd-->

    which graka, which resolution, what ingame graphic settings?

    wanted it to be a PM, sry forum :/
  • kaoDkaoD Join Date: 2005-01-07 Member: 33289Members, Constellation
    <!--quoteo(post=2053385:date=Dec 30 2012, 07:59 PM:name=Davil)--><div class='quotetop'>QUOTE (Davil @ Dec 30 2012, 07:59 PM) <a href="index.php?act=findpost&pid=2053385"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Not true, it depends on the game. Very very very very very few are actually optimized for it though. The only actual example I can think of is Flight Simulator X and Witcher2 that will use all 4. Most other games end up using 2 or 3, BF3 uses 2, Skyrim 2, Bulletstorm 3, Crysis 2 uses 3 on high settings. So no not true at all.<!--QuoteEnd--></div><!--QuoteEEnd-->

    That's what I meant with 99%. Logic + render + AI (if applicable) is the standard setup.
Sign In or Register to comment.