Page 1 of 1
Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 7:56 pm
by schpidi
Hi all,
I searched for the topic, but I found nothing accurate...
Currently I am playing 500 stars 20 AI and I am running into performance issues, because I only have a medium sized system.
I found that each AI client has its own windows process.
So I had the idea not to attack them parallely.
I thought if I would kill them completely one after the other, I would get some free computer resources again.
But I saw that the AI client remains as windows process, even if AI empire is completely defeated.
For my big game this means around 100MB per AI client.
Is it possible / useful to implement something like this:
- if AI has no planets and no fleets any more -> shutdown process
This would release some resources, which could be reused for GUI or other AI processes.
What do you think about this?
Cheers,
schpidi
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 8:19 pm
by Zireael
Oh yeah, great idea!
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 9:12 pm
by Bigjoe5
I'm surprised that the AI is slowing down the game after it's defeated. Is it actually using up CPU, or is it just holding on to memory?
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 9:27 pm
by Geoff the Medio
Bigjoe5 wrote:Is it actually using up CPU, or is it just holding on to memory?
It probably still is deserializing its latest known galaxy state info each turn, but I'd expect it's more of a memory issue. The downside of having independent AI processes is the extra memory use.
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 9:56 pm
by schpidi
Bigjoe5 wrote:I'm surprised that the AI is slowing down the game after it's defeated. Is it actually using up CPU, or is it just holding on to memory?
I assume it is not wasting too much CPU, because no buildings, production, fleets calculation etc.
But for my big game it is still writing a 5-10MB AI log file for defeated ones, which is not necessary in my eyes.
And it still remains in the memory.
Geoff the Medio wrote:It probably still is deserializing its latest known galaxy state info each turn, but I'd expect it's more of a memory issue. The downside of having independent AI processes is the extra memory use.
But isn´t it possible to end the process completely?
I assume currently there is working some kind of garbage collector which free up the memory by some time?
Couldn´t we call the same shutdown routines like on closing the game?
If an empire is dead, it doesn´t need any info about the galaxy any more
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 10:01 pm
by Geoff the Medio
schpidi wrote:But isn´t it possible to end the process completely?
Lots of things are possible, but require other stuff to be implemented first. In this case, there's nothing implemented to decide when an AI empire is defeated / can be excluded from future turns.
Edit: Also, doing this during a game would likely require some adjustment of various other code to keep track of the reduced number of empires, on the server (so that it doesn't wait forever for not-coming empire turn orders) and on the client (so it knows to update the UI appropriately). Also, would the gamestate remember that the previous empire existed, or just remove all traces of it? Presumably the in-game pedia should have some record, and old sitrep messages would still need to have access to the old empire's info...
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 10:23 pm
by schpidi
Geoff the Medio wrote:schpidi wrote:But isn´t it possible to end the process completely?
Lots of things are possible, but require other stuff to be implemented first. In this case, there's nothing implemented to decide when an AI empire is defeated / can be excluded from future turns.
Edit: Also, doing this during a game would likely require some adjustment of various other code to keep track of the reduced number of empires, on the server (so that it doesn't wait forever for not-coming empire turn orders) and on the client (so it knows to update the UI appropriately). Also, would the gamestate remember that the previous empire existed, or just remove all traces of it? Presumably the in-game pedia should have some record, and old sitrep messages would still need to have access to the old empire's info...
Ok, then I misunderstood. When translating I found the message EMPIRE_DEFEATED and I assumed that this is an implemented event already.
Logically an empire is defeated for me if
- it is not transzendent (otherwise it would have won
)
- it has no planets
- it has no fleets
But I don´t know the internal class structure of the game and what info is available and what not.
Re: Shutdown windows process (AI client) if defeated
Posted: Mon Feb 18, 2013 10:35 pm
by Dilvish
schpidi wrote:Bigjoe5 wrote:I'm surprised that the AI is slowing down the game after it's defeated. Is it actually using up CPU, or is it just holding on to memory?
I assume it is not wasting too much CPU, because no buildings, production, fleets calculation etc.
But for my big game it is still writing a 5-10MB AI log file for defeated ones, which is not necessary in my eyes.
And it still remains in the memory.
You don't want to delete the logfile from disk in the middle of a game just because the respective AI was defeated. After defeat, an AI only adds about 100 lines per turn to the log file if you don't have verbose logging on, and takes about 0.2 seconds elapsed per turn (on my machine anyway) to review its situation and decide it has nothing to do.
But isn´t it possible to end the process completely?
I assume currently there is working some kind of garbage collector which free up the memory by some time?
Couldn´t we call the same shutdown routines like on closing the game?
If an empire is dead, it doesn´t need any info about the galaxy any more
Even though we don't have it currently, there easily could be some kind of Effect that gives ships to a "dead" empire, or to a random one, and revive it from apparent defeat.
Re: Shutdown windows process (AI client) if defeated
Posted: Tue Feb 19, 2013 12:02 am
by unjashfan
there's nothing implemented to decide when an AI empire is defeated / can be excluded from future turns.
I think an empire can be considered defeated when said empire has no colonies, no colony class ships, and no troop ships remaining on the map. Basically all methods of colonization/invasion must be unavailable to that empire. Any remaining ships such as warships could remain on the map either as stationary objects in which they will get in the way of other players. Or, to make things more fun, the lost empire will receive a fleet of highly stealthed ghost warships for the sole purpose of seeking revenge and messing the other players up
.
Re: Shutdown windows process (AI client) if defeated
Posted: Tue Feb 19, 2013 1:38 am
by Bigjoe5
There's also been some discussion of using diplomacy or other means to revive previously defeated empires, though I think if an empire is really defeated and has no assets whatsoever, it should probably be out of the game.
However, an empire could hypothetically survive without any planets or ships, and still be operating with spies in enemy empires, "stealing" or otherwise acquiring enough influence output to continue funding his espionage efforts.
Re: Shutdown windows process (AI client) if defeated
Posted: Tue Feb 19, 2013 8:09 am
by em3
Bigjoe5 wrote:However, an empire could hypothetically survive without any planets or ships, and still be operating with spies in enemy empires, "stealing" or otherwise acquiring enough influence output to continue funding his espionage efforts.
I like that - at least in theory; I'm afraid that such burrowed empire would not have any means to stand on its own again, though, not to mention winning the game...
... well, unless the ultimate influence/espionage project would be "imperial takeover"
.
Re: Shutdown windows process (AI client) if defeated
Posted: Tue Feb 19, 2013 9:47 pm
by Bigjoe5
em3 wrote:Bigjoe5 wrote:However, an empire could hypothetically survive without any planets or ships, and still be operating with spies in enemy empires, "stealing" or otherwise acquiring enough influence output to continue funding his espionage efforts.
I like that - at least in theory; I'm afraid that such burrowed empire would not have any means to stand on its own again, though, not to mention winning the game...
... well, unless the ultimate influence/espionage project would be "imperial takeover"
.
While "Imperial Takeover" is unlikely, there's a realistic possibility of being able to take over ships and planets via espionage. Furthermore, empire A, which has thoroughly infiltrated empire B, is likely to be of great utility to empire C, who is at war with empire B, and who might offer empire A ships, planets or resources in return for its services.
Re: Shutdown windows process (AI client) if defeated
Posted: Wed Feb 20, 2013 12:19 pm
by em3
Bigjoe5 wrote:While "Imperial Takeover" is unlikely, there's a realistic possibility of being able to take over ships and planets via espionage. Furthermore, empire A, which has thoroughly infiltrated empire B, is likely to be of great utility to empire C, who is at war with empire B, and who might offer empire A ships, planets or resources in return for its services.
That does sound awesome. I'm not sure if we can expect such scenarios outside multiplayer games with role-playing humans.
Re: Shutdown windows process (AI client) if defeated
Posted: Wed Feb 20, 2013 8:53 pm
by Bigjoe5
em3 wrote:Bigjoe5 wrote:While "Imperial Takeover" is unlikely, there's a realistic possibility of being able to take over ships and planets via espionage. Furthermore, empire A, which has thoroughly infiltrated empire B, is likely to be of great utility to empire C, who is at war with empire B, and who might offer empire A ships, planets or resources in return for its services.
That does sound awesome. I'm not sure if we can expect such scenarios outside multiplayer games with role-playing humans.
I'm sure Dilvish is up to the challenge of making the AI diplomatically savvy enough to make this kind of arrangement with a player - assuming we have an adequately robust diplomacy system. The concept of a "contract" will probably be very difficult to pull of.