Author Topic: System.OutOfMemoryException (3.1.2.0)  (Read 6175 times)

Offline dumpsterKEEPER

  • Sr. Member Mark II
  • ****
  • Posts: 361
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #15 on: May 18, 2010, 02:02:22 pm »
Ah, I see. I guess I'll have to read up on that further at some point. I must have either missed or forgotten about the other thread. I haven't programmed under Windows in quite some time, but I still find it interesting to learn about how other operating systems handle things. Thanks for the additional detail, I appreciate it.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #16 on: May 18, 2010, 02:07:44 pm »
The key is that 2^32 = 4294967296, and addresses need not be signed ;)
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 Spymine

  • Jr. Member
  • **
  • Posts: 53
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #17 on: May 20, 2010, 12:42:35 am »
Wouldnt it be much easier that upon hitting a certain ship amount (eg. 200.000 units) a new building ("AI reserve") is spawned for each AI on an AI held world and the excess ships would be stored in there until
- the reserve is destroyed
- the command station on the planet of the reserve is destroyed
- the AI for this ships is destroyed (like the "Avenger" - in addition to the battle station you now get swamped by thousands of ships too)

Just my two cents - since I dont want to wait now for several months for completing my game  ;)
Also - i think that this implementation should not be that hard to realise (or?) and would make the performance of the game better when lots of ships are involved (less ships - less computing to do, right).

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #18 on: May 20, 2010, 01:14:09 am »
Actually, the game starts combining ships north of 70k units. You have more ships than we have literally ever seen, and more than I thought possible to get in the game. There was one other player that had 202k ships, and then everyone else that I know of has had 160k at absolute most. And that's at most a handful of players there, I would guess 99% of all players never even go north of 90k or so, which is more what the game was designed for -- the assumption had been that you would be dead or have won long before it ever hit that volume. The north of 70k combining logic is such that it should have kept it's ships to a minimum unless you really push it beyond the limits... which you have more than anyone else I know of.

Doing that sort of reserve is not as simple as you might think, because it would literally have to remove the original units from the game to have any savings on the savegame size. That in itself is not tragic, but that would also then play with things like the ship cap on the individual planets (ie acting as a multiplier), which is the surest way I can think of to insure that the ai kills you when it otherwise would not have. ;) given that other players in more normal-sized games also rely on the ai cap per planet logic for balance, that would be a pretty destructive change to then try to balance.

I hate to say it, but you're just really on the super extreme end of things, where you're the only person out of 20,000 some players with this issue. ;) Even the guy with 202k ships we were able to optimize for so that this issue was skipped. In your case it is going to take those other changes mentioned, as we've pushed the memory efficiency as far as we can with the current approach withot fundamentally changing the game.

I suppose we could do some sort of reserves thing when the ai starts getting more than around 150k units or so, but that's likely to just make those games impossible in the end...   
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: System.OutOfMemoryException (3.1.2.0)
« Reply #19 on: May 20, 2010, 01:34:04 am »
Oh, one other note: a big part of the reason for the recently-added "border aggression" mechanic (aside from all of the more obvious benefits to gameplay, the AI's realism, etc) is that it is also intended to prevent these sorts of uber-high ship counts from ever becoming possible.  Instead of storing up quite that many ships, the AI would be attacking you with what amounts to continuous cross-planet attacks long before you'd ever hit that point.  Either that would wear you down and kill you, or you'd have to neuter planets that were getting too tough, and not be able to get to that sort of late-game scenario.

In other words, really this sort of uber-unit-count game shouldn't exist, the game is supposed to make you die first or kill the AI first.  You've just managed to push it further than anyone else, ever, and that comes with some perils.  Frankly, I think most player's CPUs would melt before they even hit the point where this sort of thing was a RAM issue.  With the other player with 202k ships, he had something like a 3.6 ghz quad core.  You must have a beast of a machine, as well!

Anyway, my point is that I really hate saying "there's not much we can do at the moment," but that's kind of where we are with this one -- in most respects we already have addressed that, in the sense that border aggression would probably have prevented your game from ever getting to this state had you started your game in 3.120.  That doesn't make your existing game playable, which stinks, but on the bright side if you start it up in 3.120, then disable autosave for a while, the AI would be attacking you with so very many ships that you could probably get your numbers down to 200k or even 150k within a while, if you survive all that (and your CPU does), which would let you save again.  That would be my best guess, anyway...
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 Spymine

  • Jr. Member
  • **
  • Posts: 53
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #20 on: May 20, 2010, 03:06:11 am »
Well i am sorry to disappoint you - i already had the idea to disable the autosave. After posting in here i continued playing without Save and it really dropped at first to 245.000 Units. But yesterday After like another 20 hours of Not saving i was at 310.000 Units (and then the pc hung itself up). The Things is that the Ships don't go directly at me -the ai collects them at warp Points until there are like 10.000 - 15.000. If those ships wouldnt Hang around at Warp points i could get the amount down  :(
Any idea how to let the ai Rush me with cheats disabled?

Offline RCIX

  • Core Member Mark II
  • *****
  • Posts: 2,808
  • Avatar credit goes to Spookypatrol on League forum
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #21 on: May 20, 2010, 06:27:37 am »
Drop some light starships in the wormhole you need, really anything that is cheap and has the "AI Will Abandon Post To Pursue" flag on 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 x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #22 on: May 20, 2010, 10:06:06 am »
We're talking about a few AI additions that might make sense here as a way to definitely prevent this.  Will get back to you later today -- thanks!
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: System.OutOfMemoryException (3.1.2.0)
« Reply #23 on: May 20, 2010, 03:06:18 pm »
Sounds a lot like the CPA-stopping up bug that comes up occasionally.  I've put in some changes to try to fix that in general in the next version, and there are two other changes that should specifically be a help in curtailing these ultra-massive games so that they don't get to the stage of having out of memory exceptions.  To whit:

Updates in 3.149:

    *  Some of the internal calculations for how ships wait at wormholes have been reworked, in hopes of making them never get accidentally stuck in cold storage or stuck just waiting permanently at a wormhole.
          o For super-high AI Progress games there was a check in particular that was causing issues here.
          o Freed AI ships are now vastly more effective at traveling between their own planets in fluid groups now.

    * AI players are no longer allowed to reinforce their planets if there are more than 175,000 ships currently in the game.

    * A semi-major new "Scrap Wave" mechanic has been added for the AIs. Any time there are more than 150,000 ships currently in the game, and comparably little is going on in terms of threat/attack/wave counters, the AI will scrap a large number of its ships and then send a wave that is half the size of the number of ships scrapped.
          o The AI is prejudiced toward scrapping and sending the lowest-tech mobile military it has, but that will really vary based on what it has available. If all the AI has is Mark V stuff, this will be a much worse event than if the AI still has a lot of lower-tech stuff.
          o In general, the size of these waves is 1,000 ships multiplied times the difficulty of the first AI player. The number of scrapped ships will be about twice that.
          o Generally if there are more than about 1,000 threat/attack/wave ships already out in the galaxy, then the AI won't do a scrap wave. Otherwise it will do continuously scrap waves, one after the next, until it is back down to fewer than 150,000 ships.
          o In the end, if you're like most AI War players you'll never-ever see this mechanic at all. But if you've got a beast of a machine and love playing 30+ hour-long games on the largest maps, then this will help keep things from bogging down completely.
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 Spymine

  • Jr. Member
  • **
  • Posts: 53
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #24 on: May 20, 2010, 05:24:45 pm »
Great - Thanks
I already tried it out and the unit number is shrinking \o/
If I run into another problem you will be the first to know

Oh...and btw...from now on my PC will bear the name "Beast"  ;D

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #25 on: May 20, 2010, 07:28:13 pm »
Great! :)
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 Spymine

  • Jr. Member
  • **
  • Posts: 53
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #26 on: June 01, 2010, 02:29:28 pm »
I noticed that with 3.1.5.4 the "Special Forces Alarm Post " seems to be not working anymore. I have like 160.000 enemy ships, and when I blow out the command station in the system with the post (or the neighbouring) nothing happens - i get no additional threats (zero, zilch, nada, nothing). With 3.1.2 with 250.000 ships I got like 30.000 special ships sent at me.

I am not complaining - just wanted you to know ;-)

Just noticed the bug forum - will post it there (sorry  ::))
« Last Edit: June 01, 2010, 03:15:24 pm by Spymine »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.OutOfMemoryException (3.1.2.0)
« Reply #27 on: June 01, 2010, 10:37:47 pm »
Thanks for the report!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!