Author Topic: AI War sale mentioned on Reddit and Steam.  (Read 2962 times)

Offline Blahness

  • Jr. Member Mark III
  • **
  • Posts: 97
Re: AI War sale mentioned on Reddit and Steam.
« Reply #15 on: April 07, 2010, 04:59:12 pm »
I exploit the AI enough by building ion cannons (Don't even have to finish it, just plop it down at 1 hp) 80k away from anything, and laughing as I pick them off as they head to destroy that instead of my undefended home command station.
Signature out of date.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War sale mentioned on Reddit and Steam.
« Reply #16 on: April 07, 2010, 06:00:05 pm »
Hmm, with the ion cannon thing the logic should be prefering the higher priority irreplaceable (command station), will have to look into that.

On the insane command lag thing, it actually wasn't what I thought it was, but I did discover the cause: if a bunch of ships are heading to the exact same point, the game pre-emptively displaces their destination points to avoid a long period of collisions and displacement when they get there.  This involves checking every ship in the same-destination-set against every other ship in that set.  20,000 * 20,000 = 400,000,000 = OUCH.

That said, would you rather have 10-20 seconds of wait after the move order, or have the framerate tank for over a minute when the ships start colliding, until they all finish finding a place?

Anyway, there's a workaround that cuts down the time a lot if you are basically just moving blob x from point a to point b: use formation move (J+right-click) instead of normal move, and it will automatically maintain the relative position of each ship from the current "averaged center" of the blob.  This basically avoids all that pre-emptive displacement because assuming the ships are in a stable place right now they probably will be when they "land".  In my tests with a 10k blob this cuts the post-move-order lag down from 22ish seconds to less than 2.

If that workaround is feasible, it can be made easier by building the sticky-formations control node so that ships moved with J+right-click will from then on interpret normal move orders as formation moves until given a stop order (End key).

I'll look at having it do a less intensive pre-emptive displacement (basically, "If I'm moving X ships to point a where X > 500, just generate a square grid of 500 decently spaced points and use those as the actual destinations"), but I'm interested in knowing if the formation move workaround helps your case the way it helped in my tests.

Thanks :)
Keith
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: AI War sale mentioned on Reddit and Steam.
« Reply #17 on: April 07, 2010, 06:22:33 pm »
FYI, I investigated the thing I originally thought was causing it ( O(n) cumulative string concats ) and upon converting that to use a mutable string the 1.8 second delay after a 10k-ship-move-order dropped to something below half a second (not entirely how far below since other things became the bottleneck).

The ships still took another half second or so before actually changing direction, but the game didn't pause.
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 x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: AI War sale mentioned on Reddit and Steam.
« Reply #18 on: April 07, 2010, 07:17:25 pm »
Wonderful!  Ah, stringbuilder.  That's a great thought, I should have tried that before, too.  Usually I would, but I just don't expect a single command to generally be worth the overhead of the stringbuilder compared to the number of concats it would have to do.
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 RCIX

  • Core Member Mark II
  • *****
  • Posts: 2,808
  • Avatar credit goes to Spookypatrol on League forum
Re: AI War sale mentioned on Reddit and Steam.
« Reply #19 on: April 07, 2010, 07:19:59 pm »
If we give it a sense of proportion you'll exploit it ;)
If we give the AI so much as a stuffy nose some people exploit it ;)
Avid League player and apparently back from the dead!

If we weren't going for your money, you wouldn't have gotten as much value for it!

Oh, wait... *causation loop detonates*

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War sale mentioned on Reddit and Steam.
« Reply #20 on: April 07, 2010, 07:25:47 pm »
Yea, for small commands it's unnecessary... but by the same token it's not a ton of overhead (and can be reduced if necessary, I can even write a custom char buffer it really comes down to it).  But when you give an order to 10,000 units that's 10,000 concats (Edit: actually 20,000 since the comma characters are appended separately), each of which has to allocate memory for the entire working string plus the next item and then copy the contents to the new string, so the last 1000 concats could be consuming and copying around 7 * 9000 * 2 bytes _each_.  Anyway, I changed the move, transport, assist, attack, and wormhole list builders to use stringbuilders for now, will see if there are any others.

Also just finished with code that uses a "square move" algorithm very similar to arc-move except filled in (and, well, square since it doesn't require any trig calls) for any non-arc, non-formation move of over 500 units at once.  It totally avoids the huge cost of the preventative displacement, so the game can play relatively smoothly even with giving frequent move orders to 10k blobs.  It still slows down a fair bit when those ships "settle" as its having to do collision checks then, perhaps we could look into that later, but it's not an eons-long delay.

Anyway, commiting all that...
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: AI War sale mentioned on Reddit and Steam.
« Reply #21 on: April 07, 2010, 07:28:28 pm »
Oh, just have to share this :)
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 RCIX

  • Core Member Mark II
  • *****
  • Posts: 2,808
  • Avatar credit goes to Spookypatrol on League forum
Re: AI War sale mentioned on Reddit and Steam.
« Reply #22 on: April 07, 2010, 07:40:46 pm »
:)
Avid League player and apparently back from the dead!

If we weren't going for your money, you wouldn't have gotten as much value for it!

Oh, wait... *causation loop detonates*

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: AI War sale mentioned on Reddit and Steam.
« Reply #23 on: April 07, 2010, 07:42:11 pm »
Very nice!  And yeah, totally in agreement and was as soon as you mentioned it, but was just noting why it had not occurred to me in the past. :)
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!