AI Surrender issues

For topics that do not fit in another sub-forum.

Moderator: Oberlus

Message
Author
User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

AI Surrender issues

#1 Post by Dilvish »

Several months ago, Morlic proposed a PR to allow a near-dead AI to surrender. It would seem in keeping with our vision of the game, a number of players have explicitly requested it, plus it would let us simplify some AI code. We seemed to agree that the AI should surrender after it lost its last actual colony, and that it should gift its last ships and outposts. The big question we did not get resolved, though, was how to decide which empire would receive those gifts. It doesn't really seem that we disagreed, just that we decided we should talk about it more here, but never did. So...

For reference, here are what look to me to be the substantive posts on this remaining issue:
Dilvish wrote:And just to clarify/expand a bit more on the gifting idea, there are at least a few ways I can think of for the AI to decide which player to decide which player to surrender to. My preference would probably be that when the AI realizes it lost its last colony it checks its sitreps to see which players conquered colonies from it that last turn and then if there were multiple it would choose among them (if it had a Capital colony that was conquered that last turn then whoever got it should probable be the chosen one, otherwise it could be a random choice or eventually based on influence).

Other possible ways could be the the AI to keep track of its major colony (independent of the empire.CapitalID property since that depends on a palace) and then surrender to whoever took that. Or the selection could be based on influence or even totally random regardless of whether that empire even captured a colony from the surrendering one could be OK.
Vezzra wrote:IMO surrendering to the enemy that conquered the last colony is somewhat problematic. This might, in situations where several empires conquer another one, encourage tactics where everyone tries to isolate one small colony within the portion they conquered, and only finally conquers it once they think all the other empires have wiped out the rest.

Leading to a situation where everyone waits on everyone else. Doesn't sound like fun.

The best approach IMO is the one taking influence into account. However, until that's implemented, how about surrendering to the enemy that took the most colonies (maybe within the last 10-20 turns)?
I agree with Vezzra that Influence, once implemented, should at least be a very significant part of the decision. In the meantime, his proposal to surrender to the enemy that captured the most colonies in the past 10-20 turns sounds totally fine to me.

What say ye?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: AI Surrender issues

#2 Post by Oberlus »

For now (until FO 0.5) I would do it just random, or anything very very KISS.

To whom the AI surrendered its last ships (and colonies) in GalCiv2 was, IIRC, very elegant and fun for the game: it depended on the personality of the species surrendering and its relations with the remaining species/empires. Thus, a warring species that praise strength in combat, whom you have been tormenting the whole game mercyless, could in the end decide to give you all their remaining assets and nothing to other, more pleasant neighbours even being those in an alliance with the defeated empire. And the opposite could happen too, so that you bring down to its knees an empire and in the last moment it gives all its assets to the empire/s that has better chances against you, just because the people of that defeated empire hate your guts.
As commented by Vezzra, this kind of decision made by an AI will require the influence mechanics and its expected empires/species relationships.

If plain random is too shabby for you:
- Considering a little locational info: Random among the empires with colonies nearby (<N hops).
- Pretending to help balance between empires: Choose the neighbouring (<N hops) empire that has the least military strength.
- Focused on human-AI balance and fun: give it to the human player if it is not the strongest (military strength? PP+RPs per turn?) one in the game and had contact with the human player, otherwise give it to the strongest contacted AI empire.

Also, I wouldn't wait until there are no more colonies of the soon-to-be-defeated empire before surrendering. Make it based on differences on PP+RP per turn, or total population, or number of colonies, or estimated military strength... between the surrendering empire and the strongest one among those that have contacted it, so that an empire surrenders when it has less than say 10% of the colonies of another enemy empire.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI Surrender issues

#3 Post by Dilvish »

Oberlus wrote:For now (until FO 0.5) I would do it just random, or anything very very KISS. ...
Also, I wouldn't wait until there are no more colonies of the soon-to-be-defeated empire before surrendering. Make it based on differences on PP+RP per turn, or total population, or number of colonies, or estimated military strength... between the surrendering empire and the strongest one among those that have contacted it, so that an empire surrenders when it has less than say 10% of the colonies of another enemy empire.
Surrendering while the AI still has one or more actual colonies is something that could make more sense once we have Influence and the AI has stronger diplomatic handling in general, but is not so fitting now, I think. My expectation is to do this near-dead surrender, then work on having the AI be able to make meaningful alliances, and then that alliance code could be extended to consider surrendering/merging before near-death.
- Considering a little locational info: Random among the empires with colonies nearby (<N hops).
I agree that would be fine and viable. As an additional tweak for it I think I'd prefer to consider just any empire that the surrendering AI had actually had contact with (it may not have a very good idea who is really still within N-hops anyways).
- Pretending to help balance between empires: Choose the neighbouring (<N hops) empire that has the least military strength.
- Focused on human-AI balance and fun: give it to the human player if it is not the strongest (military strength? PP+RPs per turn?) one in the game and had contact with the human player, otherwise give it to the strongest contacted AI empire.
I think a sort of combination of these would be my favorite-- Surrender to the second-strongest empire that the AI has had contact with (making no distinction between human player or AI, although that's perhaps not a formal rule of ours, it is an informal rule of mine). I would base strength on PP + 2*RP, which I think more fairly represents the scarcity and value of research points.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Morlic
AI Contributor
Posts: 296
Joined: Tue Feb 17, 2015 11:54 am

Re: AI Surrender issues

#4 Post by Morlic »

How about we go for the simplest approach for the first implementation (and possibly 0.4.8) - simply eliminate the empire and remove ownership of all its objects. Pending PR #2001 adds server side support for human players surrendering on those terms. Seems it could be reused for the AI.

Everything else seems more complicated and in need of more finetuning:
For example, consider the AI chosen to receive the remaining assets is disconnected from that part of the universe (for example there is an empire in between them, possibly the actually conquering player). Then the received gifts are perfectly useless. There is no additional challenge - it still will be completely tedious to clean up the remaining assets because there will be no reinforcements coming from the new owner.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Oberlus
Cosmic Dragon
Posts: 5715
Joined: Mon Apr 10, 2017 4:25 pm

Re: AI Surrender issues

#5 Post by Oberlus »

Now I must agree with Morlic.

LGM-Doyle
Programmer
Posts: 219
Joined: Mon Feb 29, 2016 8:37 pm

Re: AI Surrender issues

#6 Post by LGM-Doyle »

I was going to suggest scrapping the ships a simpler alternative, however PR #2001 looks solid.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI Surrender issues

#7 Post by Dilvish »

Morlic wrote:How about we go for the simplest approach for the first implementation (and possibly 0.4.8) - simply eliminate the empire and remove ownership of all its objects. Pending PR #2001 adds server side support for human players surrendering on those terms. Seems it could be reused for the AI.
I agree that would be fine and make plenty of sense for the very first implementation of it. I don't think that we should feel constrained to not also try putting together something more interesting for 0.4.8, though.
Everything else seems more complicated and in need of more finetuning:
For example, consider the AI chosen to receive the remaining assets is disconnected from that part of the universe (for example there is an empire in between them, possibly the actually conquering player). Then the received gifts are perfectly useless. There is no additional challenge - it still will be completely tedious to clean up the remaining assets because there will be no reinforcements coming from the new owner.
I had already considered that general situation before I posted just above, and I would disagree that the assets would be totally useless in that situation-- any outposts would have the opportunity to begin construction of some things (like exobots) in reliance on the Imperial Stockpile, and either they are likely to be close enough be supply-connectable with some attention, or if farther inside the perimeter then they might provide some interesting visibility and/or create a bit of pressure for military forces to be rerouted. Not hugely valuable for sure, but likely enough to have at least some value to make them interesting, it seems to me. I'd rather have them than not :D
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Gault.Drakkor
Space Floater
Posts: 40
Joined: Sat Jul 01, 2017 4:54 am

Re: AI Surrender issues

#8 Post by Gault.Drakkor »

I would argue that AI should surrender to close (physical or influential) ally, as first choice.

With that not available, I like the suggestion of surrender to no one. (perhaps auto scrap ships?)
Surrender to conquerer? Why surrender to the hated enemy?

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI Surrender issues

#9 Post by Vezzra »

Assuming we're aiming for a stop-gap solution anyway (until we can come up with something more sophisticated incorporating Influence), the simplest approach would probably be for the surrendering AI to just scrap all it's remaining assets. After all, the main thing we want to accomplish here is to avoid having to hunt down every last remaining ship of an utterly defeated AI.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI Surrender issues

#10 Post by Dilvish »

Vezzra wrote:Assuming we're aiming for a stop-gap solution anyway (until we can come up with something more sophisticated incorporating Influence), the simplest approach would probably be for the surrendering AI to just scrap all it's remaining assets. After all, the main thing we want to accomplish here is to avoid having to hunt down every last remaining ship of an utterly defeated AI.
yes, I am pretty sure that is what the new multiplayer game concede button does, and we were going to have the AI use that same underlying order (just skipping the UI button). In addition to scrapping ships/buildings (which the AI could do on its own) it reassigns any remaining outposts to unowned.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: AI Surrender issues

#11 Post by o01eg »

I supposed it in other thread but maybe it more suitable for this one:
o01eg wrote:About every single ship I think it's issue with the elimination check. Currently empire considered eliminated only when it has no assets. But it possible to check only colonies and ship parts could create colonies like troops, colony pods and so on. I think it better to make it unconditional rule of the game to scrap any assets of any player if he hasn't colonies and cann't create one.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI Surrender issues

#12 Post by Geoff the Medio »

I find the concept of an AI that surrenders in the general case a bit strange. To me, the point of an AI player is to play the other empires as long as the human(s) want to keep playing a game. The AI doesn't get bored with a game that goes on too long, or get frustrated with a clearly losing situation, or decide it's clearly won and so doesn't need to keep playing to be satisfied. It just moves around the AI-empire stuff and gives the human an opponent (or punching bag) as long as they want to keep playing.

Avoiding situations in which players needing to tediously hunt down every last ship or planet of one or all other empires to win would be best implemented by having victory conditions that don't require it. For example, if it controls 75% of all planets in the galaxy, an empire is declared the victor (or the player just gets the control 75% "You Win!" achievement). Some players might enjoy the challenge of actually hunting down all the ships though, so it should remain a possibility.

There can also be "lose conditions", such as that an empire that loses its starting capital or all its planets is ejected from the game, and all its ships allocated to other players depending on influence considerations (though this would need to be adjusted if / when ship-only empires are possible). This would resolve the noted issue with the AI code expecting there to be planets. Preferably the AI code would be able to handle this situation, but until then, just having no-planet empires be eliminated would be reasonable. This would be a game mechanic / rule, though... not a decision the AI script makes... and would also affect human players.

The AI players should not decide who to give its ships (or planets) to when eliminated, though... Influence, and species-empire relations, are game mechanics to which AIs might react given how it affects their empire during a game. But a player cannot, for example, spend influence to make an AI do something, and AIs should not decide how to allocate ships when conceding based on influence-related considrations. Instead, influence-related gamestate could be used by the game engine (ie. not by the AI script, ie. a player in the game) when an empire is eliminated but still has stuff that can be given to other empires. This could be done automatically based on the relevant species-empire opinions, or the ships could be left in the universe unowned but easy to take control of using standard in-game influence mechanics. I think someone wrote about concerns that having formerly-allied ships suddenly turn rogue when an empire is eliminated being a problem, but I doubt this would be a major issue if an empire is being eliminated, and even if it is, then that's part of the risk of allying with and having ships around from an empire that's about to be eliminated.

That all said, if implementing a game rule that no-planet empires are eliminated is too complicated for now, and something is needed immediately to avoid no-planet empires throwing errors, then I suppose an empire conceding when it has no planets is reasonable. In that case, all the empires' ships should just be left unowned and hostile, with possible exception that any ship that could be gifted to an empire allied to the eliminated empire is so gifted. I don't see a reason to scrap / destroy / depopulate everything en empire owned instantly if it is eliminated... Could someone reiterate or point me to that rationale in a post?

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: AI Surrender issues

#13 Post by Dilvish »

Geoff the Medio wrote:I find the concept of an AI that surrenders in the general case a bit strange. To me, the point of an AI player is to play the other empires as long as the human(s) want to keep playing a game....I don't see a reason to scrap / destroy / depopulate everything en empire owned instantly if it is eliminated... Could someone reiterate or point me to that rationale in a post?
We are talking about having the AI surrender at a point when the AI is so crippled that it is meaningless/boring to play against it-- As Mat said in the referenced PR discussion,
MatGB wrote:Couldn't it just gift remaining assets to the conquering player?
I think I'd prefer that than a rump ally with unusable outposts.
Regardless, something of this nature definitely needed, the cleanup phase of a conquest is always dull.
(emphasis added)

Geoff, although I appreciate that you seem to have tried to explain your thoughts, in that you at least wrote a fair bit about possible other things to do, and your thoughts that the AI "shouldn't" or "can't" do various things, I'm not seeing any actual explanation of the reasons for such beyond "AI's don't get tired so why should they quit," which I think is rather missing the point.
Geoff wrote:The AI players should not decide who to give its ships (or planets) to when eliminated, though... Influence, and species-empire relations, are game mechanics to which AIs might react given how it affects their empire during a game. But a player cannot, for example, spend influence to make an AI do something, and AIs should not decide how to allocate ships when conceding based on influence-related considrations.
You offer up these strong statements without anything that I can really see as a reason. I would say nearly the very opposite-- that the AI should be able to make the full range of diplomatic decisions that any player might make. My reasoning is mostly that such would make it more like a real player and would make for a more interesting game in my opinion. It also would seem fine to me for it to at least consider Influence, and maybe that part would seem fine to you also; was the Influence part of your objection only about something being determined entirely by Influence?

Although a fair bit of time has passed without much progress on this front since I first started talking about more significance AI diplomacy, it is certainly still a long term plan of mine, and at that time you were quite open to the AI making such decisions
Geoff wrote:...Which behaviour / goal is preferable / chosen by AIs might be a matter of the personality of the AI scripts being used.
Conceding is just one little part of the range of diplomatic decisions that an AI might make. One of the less interesting pieces, I think, but also one of the simpler ones which I suppose is why we are coming to it before the more interesting ones. (Which does not portend well for reaching a stable design consensus when it comes to those more interesting ones, yikes!)

I'll grant that perhaps I have not really elucidated much more reasoning in support of my position than you had offered for yours, so I'll offer some fallbacks: Trust me, I'm a doctor? Everything will work out if you let it in your heart? These are not the droids you are looking for?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI Surrender issues

#14 Post by Vezzra »

Geoff the Medio wrote:I find the concept of an AI that surrenders in the general case a bit strange. To me, the point of an AI player is to play the other empires as long as the human(s) want to keep playing a game. The AI doesn't get bored with a game that goes on too long, or get frustrated with a clearly losing situation, or decide it's clearly won and so doesn't need to keep playing to be satisfied. It just moves around the AI-empire stuff and gives the human an opponent (or punching bag) as long as they want to keep playing.
Yeah, well, no one ever said we want to give the AIs the ability to surrender for their sake, so they don't feel bored, or abused, or whatever, because they have to continue to play a game that has become pointless to them. ;)

As Dilvish pointed out (citing Mat), when waging war against an AI empire there almost always comes the "mop-up phase" before an AI is completely vanquished, and that phase tends to be exceedingly dull. To stay with your image of the punching ball: As long as the AI can be compared to an opponent which is still actively putting up a fight, everything is fine. Once it becomes nothing but a punching ball, not so much.
Some players might enjoy the challenge of actually hunting down all the ships though, so it should remain a possibility.
Which, AFAICT, everyone agrees to. Hence the game rules for conceding. A player who enjoys beating a dead horse simply turns off conceding completely, and have their fun. :D
There can also be "lose conditions", such as that an empire that loses its starting capital or all its planets is ejected from the game, and all its ships allocated to other players depending on influence considerations (though this would need to be adjusted if / when ship-only empires are possible).
That goes already far beyond the simple stop-gap solution we want to provide with the current proposals. But for a future approach these ideas are certainly interesting.
Preferably the AI code would be able to handle this situation, but until then, just having no-planet empires be eliminated would be reasonable.
Well, that's more or less most of us have agreed on so far, AFAICT. So I guess we should proceed accordingly?
This would be a game mechanic / rule, though... not a decision the AI script makes... and would also affect human players.
And also a bit more complicated to implement than just do that within the AI code for now. Which is why, as far as I understand, the current proposals are only meant as a stop-gap solution, until the game engine supports more sophisticated rules regarding conceding/surrendering. With how things are planned now, the AI would only surrender at a point where every human player most likely would have surrendered long ago.
The AI players should not decide who to give its ships (or planets) to when eliminated, though... Influence, and species-empire relations, are game mechanics to which AIs might react given how it affects their empire during a game. But a player cannot, for example, spend influence to make an AI do something, and AIs should not decide how to allocate ships when conceding based on influence-related considrations.
Agreed - assuming you mean that a human player shouldn't be able to make an AI do something by spending in-game resources anymore than they can make a human opponent make anything do that way.

Unless we can make sure human players and AIs are affected in the same way by a mechnic that allows e.g. to spend influence to make an opponent to do something. Such a mechnic would be ok IMO.
Instead, influence-related gamestate could be used by the game engine (ie. not by the AI script, ie. a player in the game) when an empire is eliminated but still has stuff that can be given to other empires. This could be done automatically based on the relevant species-empire opinions, or the ships could be left in the universe unowned but easy to take control of using standard in-game influence mechanics.
Yep, exactly that. However, these mechanics aren't available yet, so have no relevance for the simple AI surrendering currently proposed.
I think someone wrote about concerns that having formerly-allied ships suddenly turn rogue when an empire is eliminated being a problem, but I doubt this would be a major issue if an empire is being eliminated, and even if it is, then that's part of the risk of allying with and having ships around from an empire that's about to be eliminated.
Meh. Maybe not a major issue, but still annoying and definitely not fun. The risk in allying yourself with somebody (be it human opponent or AI) should be the possibility of being betrayed. That is an important, interesting and fun concept. Having to be wary of your ally because they are at the point of being defeated and their ships suddenly becoming hostile for no other reason than their empire having fallen doesn't sound very appealing to me.
That all said, if implementing a game rule that no-planet empires are eliminated is too complicated for now
Well, the proposal is to allow a player to concede once they have no planets left, and to have the AI do that. As a stop-gap solution, that should be good enough? As I said above, a human player most likely would have surrendered long before they reach that point, so AIs doing this wouldn't give human players any problematic/unbalancing advantages...?
and something is needed immediately to avoid no-planet empires throwing errors, then I suppose an empire conceding when it has no planets is reasonable. In that case, all the empires' ships should just be left unowned and hostile, with possible exception that any ship that could be gifted to an empire allied to the eliminated empire is so gifted. I don't see a reason to scrap / destroy / depopulate everything en empire owned instantly if it is eliminated... Could someone reiterate or point me to that rationale in a post?
Well, having left over ships suddenly turning hostile towards former allies is the main reason why scrapping them has been suggested, if I understand correctly. So gifting them to the former allies would take care of this, however, that introduces the problem of having to choose which ally to gift the ships to (which brings us back to square one, more or less). Just scrapping them seems to be the easiest solution. I at least would definitely prefer that (and the minor balance issues connected with it) to them turning hostile on allies.

Depopulating colonies isn't an issue if the condition for conceding is not having any colonies left. The suggestion for outposts is making them unowned anyway, so it's just the ships which seem to be the major issue.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: AI Surrender issues

#15 Post by Vezzra »

Dilvish wrote:Geoff, although I appreciate that you seem to have tried to explain your thoughts, in that you at least wrote a fair bit about possible other things to do, and your thoughts that the AI "shouldn't" or "can't" do various things, I'm not seeing any actual explanation of the reasons for such beyond "AI's don't get tired so why should they quit," which I think is rather missing the point.
To be fair, I don't think that this is his only/main point. I got the impression that he is most worried about ideas like investing in-game resources to make an AI to give its ships to me in case it surrenders instead of another player.
I would say nearly the very opposite-- that the AI should be able to make the full range of diplomatic decisions that any player might make. My reasoning is mostly that such would make it more like a real player and would make for a more interesting game in my opinion.
Although I can't read Geoffs mind, I think the both of you actually want the same. Like I said above, I think Geoff is concerned with ideas that would make an AI do things a human player would not. E.g. when surrendering and deciding which opponent to gift my ships to, or if I should scrap all my ships, as a human I couldn't care less about how much influence my opponents invested in swaying me. AIs should work the same.
It also would seem fine to me for it to at least consider Influence, and maybe that part would seem fine to you also
That's only acceptable if it works the same way on human players. Which would mean a player doesn't get to decide what happens to their assets when they surrender, instead there are certain game rules which determine that. As long as the same rules/mechanics apply to humans and AI. However, it might be difficult or even impossible to enforce that, as you just could do whatever you want to do with your assets one turn prior to your surrender.
(Which does not portend well for reaching a stable design consensus when it comes to those more interesting ones, yikes!)
Well, if my assessment that Geoffs and your position actually aren't this far apart, things don't look as bleak as that... ;)

Post Reply