Author Topic: Multi-core  (Read 2455 times)

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Multi-core
« on: January 16, 2012, 07:21:53 pm »
Is there a setting I need to change to get the game to run multi-core/multi-thread?  Larger battles will hang the system nearly completely for up to 5 minutes while it tries to figure out the next step.  I've got three sleeping threads and one cpu maxxed off.
... and then we'll have cake.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Multi-core
« Reply #1 on: January 16, 2012, 07:24:12 pm »
Nope, the main game logic is single-core only.  The AI thread already runs on a second core without your having to do anything (as do other secondary things like sound, background image loading, etc).  Having it hang for 5 minutes is not remotely normal, though; I'm not sure what sort of scale you're talking about of battle, but that sort of timing doesn't tend to happen until you get into several million units and they have to be combined into carriers, general.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Multi-core
« Reply #2 on: January 16, 2012, 08:15:36 pm »
Yea, that kind of slowdown is abnormal.  If you post a save I may be able to see if there's some bug causing a bottleneck, or if there's something particular nasty about your scenario.  4000 fighters vs 4000 fighters isn't so bad, for instance, but 4000 zenith beam frigates vs 4000 zenith beam frigates is an awful lot of line-intersect-with-circle checks, etc.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Re: Multi-core
« Reply #3 on: January 16, 2012, 09:10:39 pm »
Battle scale is ~10,000 ships on 1/2 ship settings.  AI usually spawning 4-6 carriers carrying 400-800 ships a piece.  About 3k ships friendly, about 4.5k in the air AI + carriers.

Majority of ships are mirrors, youngling commandos, and Missile Frigs from the AI.  My lot is a mixed mess of spawners, snipers, a ton of turret, 60 or so riot starships, standard triangle, parasites, and a few other mixed additional ships.

If I can find a good way to drop a save file off and attach here I will.

Slowdowns are variable.  If I do *nothing* it'll stop for ~20 seconds, then start up again, and freeze again say 15-20 seconds later.  This will happen until fleet mass gets down to around 8000 across all parties.  If I try to do anything it can nearly perma-freeze (I've been trying to figure out what the primary causes are), particularly if I get rambunctious.
... and then we'll have cake.

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Re: Multi-core
« Reply #4 on: January 25, 2012, 03:31:27 pm »
This game is from .020, but had the problems described above.  Whipping boy is back at "Kiss", which when the waves hit are the primary issue for lag.  Exos running down the 'pipe' don't cause as much of an issue, but combined with the wave hits it gets pretty bad.

Side note: I lost this game, so anyone hoping to use it as a reference can for strategical purposes but I spent too long trying to protect the southern colonies and got tied up trying to bring AIP down heavily via the SuperTerminal on the eastern wall.  I believe it does have 3 Hubs going though at this point though, and a sickening amount of Spire Flagships.  IE: I was using groups of 40 frigates as local 'meh, whatever' defenders.  It didn't work as well as I'd hoped.  It's an AI9/9 game.
... and then we'll have cake.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Multi-core
« Reply #5 on: February 04, 2012, 04:12:17 pm »
*Loads Game*

"This is absurd."
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Multi-core
« Reply #6 on: February 04, 2012, 05:03:09 pm »
This has been a good reminder to me of why not to encourage players to play 8 homeworlds.  The savegames make my computer die in fire.

And this was with low caps.

Ok, I used some manual profiling (which is the best we can do in Unity; it has an automatic per-method profiler but that almost immediately dies when run with AIW due to the complexity of the app).

Before the 5000-ship collection of waves hit, the frames averaged from 100ms to 140ms long with spikes of about 240ms (that's probably the DoRecalculations frames).  That's slow, but it was on the high performance profile and there's some overhead from the profiling too.  The main culprits here were MovePlayerUnit (5-15% of total load) and CheckForTargetListUpdate and TryAttack (currently in the same profile group, may split them up) occasionally jumping in over it.  But those are basically the functions in which the... well, game, happens.  So nothing too alarming given the scale.

After the waves spawned, the normal frames were 260ms to 280ms long with the recalc spikes at about 440ms.  Here MovePlayerUnit continued to be pretty bulky and the targeting/attacking functions jumped up a lot, but another part popped up that surprised me; I need to split out exactly which functions in that part were responsible for what.

And then there was a 1335 ms frame that was 2/3rds targeting and attacking, heh.  And later a 9423ms frame that was 97% targeting and attacking, wow.  And a bit later another 5000ms+ frame mostly the same thing.


So there's some room for further investigation and I'm grateful for the test case.  In the meantime I suggest fewer homeworlds :)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Re: Multi-core
« Reply #7 on: February 04, 2012, 07:20:12 pm »
*Loads Game*

"This is absurd."

ROFL.  I'm still laughing imagining the look on your face... XD
... and then we'll have cake.

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Re: Multi-core
« Reply #8 on: February 04, 2012, 07:24:24 pm »
This has been a good reminder to me of why not to encourage players to play 8 homeworlds.  The savegames make my computer die in fire.

And this was with low caps.
Ayuuuup.  Glad it wasn't just me then.  Did you like the Spire Fleet Armada?

Quote
Before the 5000-ship collection of waves hit, the frames averaged from 100ms to 140ms long with spikes of about 240ms (that's probably the DoRecalculations frames).  That's slow, but it was on the high performance profile and there's some overhead from the profiling too.  The main culprits here were MovePlayerUnit (5-15% of total load) and CheckForTargetListUpdate and TryAttack (currently in the same profile group, may split them up) occasionally jumping in over it.  But those are basically the functions in which the... well, game, happens.  So nothing too alarming given the scale.
Yeah, it's bascially fine until the waves land.

Quote
After the waves spawned, the normal frames were 260ms to 280ms long with the recalc spikes at about 440ms.  Here MovePlayerUnit continued to be pretty bulky and the targeting/attacking functions jumped up a lot, but another part popped up that surprised me; I need to split out exactly which functions in that part were responsible for what.

And then there was a 1335 ms frame that was 2/3rds targeting and attacking, heh.  And later a 9423ms frame that was 97% targeting and attacking, wow.  And a bit later another 5000ms+ frame mostly the same thing.
Seems fast to me, but I might not have an equivalent graphics card to handle some of that lifting.

Quote
So there's some room for further investigation and I'm grateful for the test case.  In the meantime I suggest fewer homeworlds :)

AWWWWW!!!  ;D  Okiedoke.
... and then we'll have cake.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Multi-core
« Reply #9 on: February 04, 2012, 07:50:09 pm »
Did you like the Spire Fleet Armada?
Haha, yea, that thing had more firepower than hitting something with a moon at 90% of lightspeed.

My first guess is that it was just all those photon lances (the spire capital ship main-gun continuous beam weapons) because those are basically the most performance-demanding weapons in the game.  But simply watching it visually those were going off in tremendous quantity (blurring the line between vector-aoe and radial-aoe) before things actually got bad.  They may still have been the problem, dunno, but it didn't seem so thus far.

But fwiw, the performance cost of those is such that you're not supposed to have 500 of them (whatever it was) going off at once ;)

Quote
Seems fast to me, but I might not have an equivalent graphics card to handle some of that lifting.
I'm on an integrated graphics card, actually, but I was also running the profiling while looking at the galaxy map to avoid graphics load.  In any event, the graphics load would not cause 10+ second lag, or spikes of lag, it just generally slows stuff down if you get into something with too much going on.  This was a genuine case of "even modern machines cannot perform that much arithmetic that fast".
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Re: Multi-core
« Reply #10 on: February 06, 2012, 02:25:32 pm »
GUDare, Destroyer of AIs. You continously push the boundaries of what this game (and YOU) can and can't do. :P
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Re: Multi-core
« Reply #11 on: February 06, 2012, 02:31:54 pm »
GUDare, Destroyer of AIs. You continously push the boundaries of what this game (and YOU) can and can't do. :P

Heheh, if you never fall off the edge how do you learn to fly?
... and then we'll have cake.

Offline Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Re: Multi-core
« Reply #12 on: February 07, 2012, 12:48:20 pm »
Truer words have not often been spoken. ;)
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!