starting at war

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

Moderators: Oberlus, Oberlus

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

starting at war

#1 Post by Dilvish » Sun Sep 23, 2012 3:49 pm

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?
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
Geoff the Medio
Programming, Design, Admin
Posts: 12482
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: starting at war

#2 Post by Geoff the Medio » Sun Sep 23, 2012 4:17 pm

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.

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

Re: starting at war

#3 Post by Vezzra » Sun Sep 23, 2012 7:22 pm

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)

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

Re: starting at war

#4 Post by Geoff the Medio » Sun Sep 23, 2012 7:34 pm

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

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

Re: starting at war

#5 Post by Dilvish » Sun Sep 23, 2012 9:42 pm

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.
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
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: starting at war

#6 Post by eleazar » Sun Sep 23, 2012 11:14 pm

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)

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

Re: starting at war

#7 Post by Dilvish » Mon Sep 24, 2012 6:18 am

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).
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
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: starting at war

#8 Post by eleazar » Mon Sep 24, 2012 2:37 pm

Dilvish wrote:...but currently has no way to make them war each other...
Good point, i missed that in your first post.

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

Re: starting at war

#9 Post by Vezzra » Mon Sep 24, 2012 2:52 pm

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...

User avatar
em3
Vacuum Dragon
Posts: 599
Joined: Sun Sep 25, 2011 2:51 pm

Re: starting at war

#10 Post by em3 » Mon Sep 24, 2012 3:28 pm

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...
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

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

Re: starting at war

#11 Post by Geoff the Medio » Mon Sep 24, 2012 3:31 pm

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.

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

Re: starting at war

#12 Post by Vezzra » Mon Sep 24, 2012 5:00 pm

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 :)

Post Reply