Page 1 of 1

starting at war

Posted: Sun Sep 23, 2012 3:49 pm
by Dilvish
Say, thought I'd mention, I much prefer changing EmpireManager::ResetDiplomacy() so it starts us all off in a state of war. I know the player can go ahead and declare war on the AI's right off anyways, but it seems to me they ought to start off at war with each other also :twisted: Perhaps there should be a checkbox in the galaxy setup dialog to specify if all the players start off at war or peace.

I expect I'd be able to write up the code for a starting_war checkbox if it's something that would be desired. What do you guys think?

Re: starting at war

Posted: Sun Sep 23, 2012 4:17 pm
by Geoff the Medio
When diplomacy gets more interesting, it might make more sense to start at peace, but for now I don't object to defaulting to at war. Alternatively, the AI scripts could be modified to declare war on the player when they meet, or when they want to attack.

Re: starting at war

Posted: Sun Sep 23, 2012 7:22 pm
by Vezzra
If you just want the AI empires to declare war on everyone, you could do something like the following:

Code: Select all

def declareWarOnAll():
    my_emp_id = fo.empireID()
    for emp_id in fo.allEmpireIDs():
        if emp_id != my_emp_id:
            msg = fo.diplomaticMessage(my_emp_id, emp_id, fo.diplomaticMessageType.warDeclaration)
            fo.sendDiplomaticMessage(msg)

Re: starting at war

Posted: Sun Sep 23, 2012 7:34 pm
by Geoff the Medio
Something should be done, as I'm presently getting this in the AI log files:

Code: Select all

2012-09-23 12:32:51,742 ERROR AI : InvadeOrder::ExecuteImpl given planet owned by an empire not at war with order-issuing empire

Re: starting at war

Posted: Sun Sep 23, 2012 9:42 pm
by Dilvish
this simplest change is to modify EmpireManager::ResetDiplomacy() -- it is only called at the start of a game so establish diplomatic status across the board. Changing line 256 of EmpireManager.cpp to refer to DIPLO_WAR instead of DIPLO_PEACE does the job.

Re: starting at war

Posted: Sun Sep 23, 2012 11:14 pm
by eleazar
Dilvish wrote:Perhaps there should be a checkbox in the galaxy setup dialog to specify if all the players start off at war or peace.
I don't think a check-box is warranted. The player currently can easily change the diplomatic state in game.

Starting at War is probably a bit more interesting, though not hugely significant. (see previous sentence)

Re: starting at war

Posted: Mon Sep 24, 2012 6:18 am
by Dilvish
The player can set themselves to war with the AI's, but currently has no way to make them war each other, and they currently suffer from incompetent diplomats. As Geoff noted above, the current status of AI warmongering seems to lead to them wasting effort trying to wage war while still actually at peace. Until someone revamps the AI diplomacy code, seems starting all at war would be best (or at least, there's a non-trivial reason to give the player a way to force that).

Re: starting at war

Posted: Mon Sep 24, 2012 2:37 pm
by eleazar
Dilvish wrote:...but currently has no way to make them war each other...
Good point, i missed that in your first post.

Re: starting at war

Posted: Mon Sep 24, 2012 2:52 pm
by Vezzra
Why not just add a few lines to the python AI scripts letting the AIs declare war on everyone? Unless you start a multiplayer game, this has everyone at war with everyone. Quick, easy, and should be sufficient for the time being...

Re: starting at war

Posted: Mon Sep 24, 2012 3:28 pm
by em3
Vezzra wrote:Why not just add a few lines to the python AI scripts letting the AIs declare war on everyone? Unless you start a multiplayer game, this has everyone at war with everyone. Quick, easy, and should be sufficient for the time being...
Wouldn't it result with a spam of something like "[UNKNOWN] empire declares war on you!"? I don't know if diplomacy goes to SitRep yet, but...

Re: starting at war

Posted: Mon Sep 24, 2012 3:31 pm
by Geoff the Medio
em3 wrote:Wouldn't it result with a spam of something like "[UNKNOWN] empire declares war on you!"?
AFAIK empires are never "unknown". See the empires list at the start of the game; your client has the info.

Re: starting at war

Posted: Mon Sep 24, 2012 5:00 pm
by Vezzra
em3 wrote:
Vezzra wrote:Why not just add a few lines to the python AI scripts letting the AIs declare war on everyone? Unless you start a multiplayer game, this has everyone at war with everyone. Quick, easy, and should be sufficient for the time being...
Wouldn't it result with a spam of something like "[UNKNOWN] empire declares war on you!"? I don't know if diplomacy goes to SitRep yet, but...
Geoff is right, all empires "know" each other right from the start. I've actually already tested the little script I've posted, works like a charm :)