 |
|  |
 |
|  |
 |
|  |
 |
|
Cube
|
 |
El Paso, Tx
Nov 2000 time: 22:15
|
|
How about making AIs swap techs with each other when they're behind and making the chances of this happening increase the farther they are behind. Bluevoss suggested this in the medmod thread, and I thought it was a good Idea.
Also, In MedMod AIs are going broke, but they don't ask for money. How about making them ask for money once they get below 10,000 gold. I like the war Idea, how about making it so if one of the civs has lost more than 3 or 4 cities, the victim starts sending cease fires, and the atacker starts to consider it.
Edit: I was just reading diplomod(yes, I can read slic, just can't write it well) and saw DIP_request == number. It tells the AI to consider a proposal, but I don't know which proposals represent what number. Could someone tell me what number represents which proposal? I read all the readmes for for diplomod, and can't find this anywhere.
Last edited by Cube on 27-09-2001 at 02:46
|
|
|  |
 |
|  |
 |
|  |
 |
|
Dale
|
 |
Sir! Why do you keep clicking on me?
Dec 2000 time: 15:15
|
|
AI treaties/alliances
This is how CTP2 works for AI-AI treaties/alliances:
- For alliance to even be considered, trust AND regard must be over 400. (AI loves and trusts you)
- For normal treaties (except withdraw and peace), trust AND regard must be over 150. (AI likes and respects you)
- For everything else, trust AND regard must be over -250.
- Anything under -250 is war and embargo and demands.
There ARE exceptions to the rules though. The AI diplomacy is not as stupid as it makes itself seem. It will usually accept things that it needs (though the human might not be able to determine why it needs it [see below for explanation of requesting what you just offered]). Hence why some diplomacy tactics of the AI seem stupid. 
SLICing AI diplomacy
When it comes to SLICing the AI's proposals, there is NO way we can force the AI into anything. All we can do is try to make the proposal so good that it can't refuse. Hence the "request priority". If we make regard, trust and the request priority high enough, the AI will consider anything. However, this still doesn't guarentee it'll accept. That is determined by the overall goals and wishes of the AI. I don't know any way to affect the goals and wishes of the AI. BTW, these are not the strategic goals and wishes. The overall goals and wishes of the AI determine which strategy-stance, diplomacy-stance, eco-stance, science-stance, military-stance, etc is used. All we can do is influence the decisions of an AI into a certain way. For example, we can't tell the AI which strategic goal to use from goals.txt, but we can make it extremely attractive. This is the same for diplomacy.txt and the others. It's a pity really. The overall top-level is THE one level we could make the biggest leaps in AI advancement.
AI offers back what it just refused
The AI tries to max out the regard/trust bonuses. This causes the "Human requests blah refused, AI offers blah back accepted". When a human initiates certain proposals, the AI doesn't get any regard/trust change. The AI will refuse and propose the same thing in opposite terms if IT gets the regard/trust bonus.
EG: Human offers maps for AI's maps. No regard/trust bonus for AI, Human gets the regard/trust bonus. AI refuses and offers maps for Human maps. AI gets the regard/trust bonus, Human gets no bonus.
Influencing the AI's diplomacy
This is where my theory on what to do in SLIC to force the AI into things comes in.
- We know we can't "tell" an AI what to do, only influence it.
- We know that the AI requires certain levels of trust/regard before certain proposals are even considered.
- We know that the AI considers things via it's overall goals and wishes based on priorities.
- We know that AI diplomacy is always trying to max out trust/regard bonuses for it.
If we add all these points together, we get a very clear picture on how the AI can be influenced a lot better. This is where I was heading with the Diplomod. By changing values in the settings of the AI's diplomacy I was trying to make certain proposals look so attractive it couldn't refuse. All through the Diplomod are examples of where I've tried to influence the AI's into more realistic diplomacy using the above 4 points, but sometimes CTP2's bugs/deficiencies got in the way. I believe I got extremely close to what we needed for CTP2, but AI-AI alliances always alluded me. I did get the AI proposing AI-Human alliances though, that's something new in Civ-genre games. 
I hope all this helps out in some way. 
|
|
|  |
 |
|
player1
|
 |
Belgrade, YU
Sep 2001 time: 06:15
|
|
Ripped from an old tread (apolyton pack v1.0, page 2) by Petter Triggis:
"What I would have liked to do is to add a new New Proposal: Embassy Treaty."
...
"Next, to get the AI to send a request to establish mutual diplomatic relations, I used the ReactionMotivation event:
code:--------------------------------------------------------------------------------
HandleEvent(ReactionMotivation)'NewDipProposal' pre {
if (!HasAgreement(player[0], player[1], 37) && !AtWarWith(player[0],player[1])
&& HasAdvance(player[0], ID_ADVANCE_BUREAUCRACY)
&& HasAdvance(player[1], ID_ADVANCE_BUREAUCRACY) ){
ConsiderNewProposal(player[0].owner,playe[1].owner,2000,37,0,ID_NONE,ID_NONE,ID_NONE);
}
}
--------------------------------------------------------------------------------
So if they don't have embassys and aren't at war, then as soon as player[0] gets BUREAUCRACY (and player[1] already has it), player[0] will send a New Proposal to player[1] asking to establish diplomatic relations. Then I intercept this message in the NewProposal event:
code:--------------------------------------------------------------------------------
int_t first_type; //initial proposal
int_t second_type; // 'in exchange' proposal
HandleEvent(NewProposal)'RespondToNewProposals' pre {
first_type = GetLastNewProposalType(player[0], player[1], 0);
second_type = GetLastNewProposalType(player[0], player[1], 1);
if ( first_type==37 || second_type == 37 ) {
if (!IsHumanPlayer(player[0]) ){
Event:Accept(player[0], player[1]);
}
}
}
--------------------------------------------------------------------------------
As it stands the default condition is to accept. But I want to work out some more responses so that if it's the human player who's sending the proposal, the AI player may counter with a demand for an advance or gold or something. Anyway, having accepted the proposal it only remains to establish embassys:
code:--------------------------------------------------------------------------------
HandleEvent(Accept)'NewProposalHasBeenAccepted' post {//post
first_type = GetLastNewProposalType(player[0], player[1], 0);
second_type = GetLastNewProposalType(player[0], player[1], 1);
if (first_type == 37 || second_type == 37) {
Event:EstablishEmbassy(player[0],player[1]);
Event:EstablishEmbassy(player[1],player[0]);
}
}
--------------------------------------------------------------------------------
I've just tried this line of thought with the Alliance treaty. It seems to work: you can control when one AI civ will propose an Alliance to another. I guess it's just a matter of writing up the appropriate 'Response logic'. "
LOOK last paragraph! It's maybe posible to FORCE AI alliance! 
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:15
|
|
Looks like I was wrong about this. What I had in mind was something like:
code:
HandleEvent(ReactionMotivation) 'WarAndAllianceProposals' pre {
if(!IsHumanPlayer(player[0]) && !IsHumanPlayer(player[1])){
if (TurnsAtWar(player[0],player[1])>0) {// 0 for test
// offer cease-fire
ConsiderNewProposal(player[0],player[1], 9000,32,0,ID_NONE,ID_NONE,ID_NONE);
}
if (HasAgreement(player[0], player[1],32) && !HasAgreement(player[0], player[1],33) ) {
//if they have a cease-fire but not a peace treaty, offer one
ConsiderNewProposal(player[0], player[1], 2000, 33, 0,ID_NONE,ID_NONE,ID_NONE);
}
if(AtWarWith(player[0],1) && AtWarWith(player[1],1)){// 1 being the Human
//if both sender and recipient are at war with the Human
if (!HasAgreement(player[0], player[1],33) ) {
//if they don't have a peace treaty, offer one
ConsiderNewProposal(player[0], player[1], 2000, 33, 0,ID_NONE,ID_NONE,ID_NONE);
}
if(HasAgreement(player[0], player[1],33) && !HasAgreement(player[0], player[1],38)){
//if they have a peace treaty but not an alliance, offer one
ConsiderNewProposal(player[0], player[1], 2000, 38, 0,ID_NONE,ID_NONE,ID_NONE);
}
}
}
}
In theory this should get AI civs to send proposals to each other, and if you take out the "&& !IsHumanPlayer(player[1])" from the first line, you (the Human) will get these proposals. That's what led me to think that it was just a matter of writing up the response logic: if it's sending the proposals to me it must be sending them to the AI civs. But it's not: they won't send them to each other! The instructions for getting the AI to send new proposals are:
quote:
At the beginning of every player turn the ReactionMotivation and possibly one or both of the FearMotivation or DesireMotivation events will be triggered. To add a rule which can trigger the sending of a new proposal you should write a SLIC function to handle one of these events. For simplicity it is best to write your handles to be triggered by the ReactionMotivation event. For all of these events, player[0] is the player whose turn it is, and player[1] is the foreigner that would receive the new proposal.
You should access the current diplomacy state for the player using the GetNewProposalPriority function and also call any other functions needed to determine whether or not the player should send a particular new proposal.[b] If it is determined that the proposal should be sent, then call the function ConsiderNewProposal. [\b]If multiple calls to ConsiderNewProposal are made, then the proposal with the highest priority will be sent.
|
It seems to me that the above code is consistent with these instructions and I can't see why an AI civ will send one of the above proposals to the Human but not another AI. I tried several things this afternoon to see if I could get at their motivations. For example, I tried defining a new strategy;
code:
STRATEGY_GET_OUT_OF_WAR{
//
// DIPLOMACY
//
// priority for fear motivations
FearInvasion 5000
FearCityDefense 5100
FearPiracy 900
FearScienceRank 800
FearMilitaryRank 4800
FearTradeRank 800
FearPollution 900
// priority for desire motivations
DesireAttack 800
DesireGold 900
DesireScience 900
DesireMakeFriend 1000
DesireEnlistFriend 1100
}
which has some hugely increased fear motivations and which I loaded in at the appropriate circumstances. But it didn't make any difference.
I also tried guessing at the 'ConsiderMotivation' function:
code:
HandleEvent(ComputeMotivations)'TestComputeMotivat
ions' pre {
ConsiderMotivation(player[0].owner, 5000, 1);//1=FearInvasion?
ConsiderMotivation(player[0].owner, 1000,11);// 11=DesireMakeFriend?
message(1,'TestComputeMotivationsM');
}
but again no luck. And here I'm not sure about what that last parameter does. With different numbers I got the 'Wrong type of argument error'. Does anybody know how this one works?
So there you have it. The instructions I quoted above (from the AI Customization via SLIC document) certainly make it look like we ought to be able to get AI civs to send new proposals to each other. If only they'd given some examples!
BTW: note that this entails that DIPLOMOD's 'DIP_MainRoutine' handler can't be working properly, it uses the ConsiderNewProposal function in the same way.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:15
|
|
I don't think so. I had another handler that supposedly deals with the AI's responses:
code:
int_t NP_FIRST_TYPE;
HandleEvent(NewProposal) 'AcceptWarAndAllianceProposals' pre {
int_t first_type; //initial proposal
first_type = GetLastNewProposalType(player[0], player[1], 0);
NP_FIRST_TYPE=first_type;
message(1,'proptype');
if(!IsHumanPlayer(player[1]) && !IsHumanPlayer(player[0]) ) {
if ( first_type==32 ) {
//WHENEVER an AI civ offers a cease fire to another
ConsiderResponse(player[1], player[0], 3000, 2);//2=accept
ConsiderResponse(player[0], player[1], 3000, 2);//2=accept
Event:EstablishEmbassy(player[0], player[1]);//cease fires entail diplomatic relations
Event:EstablishEmbassy(player[1], player[0]);
}
if ( first_type==33 ) {//WHENEVER an AI civ offers a peace treaty to another
ConsiderResponse(player[1], player[0], 2000, 2);//2=accept
}
if(AtWarWith(player[0],1) && AtWarWith(player[1],1) && !AtWarWith(player[0],player[1]) ){
// Whenever two AI civs are at war with the Human
if (first_type==38) {
ConsiderResponse(player[0], player[1], 2000, 2);//2=accept
}
}
}
}
messagebox 'proptype' {
show();
Text (ID_M_proptype) ;
// M_proptype "sender={player[0]} receiver={player[1]} type={NP_FIRST_TYPE}"
}
The message 'proptype' should pick up any proposal that any civ sends to any other one. But I only got proposals to and from the Human: no AI-AI diplomacy at all. This doesn't seem reasonable because they must at least exchange maps occasionally. Hmm, I wonder if it had anything to do with the fact that I was working in the Cradle mod and all the AI civs either were at war or at least hated each other. What MOD are you using? How about putting:
code:
int_t NP_FIRST_TYPE;
HandleEvent(NewProposal) 'AcceptWarAndAllianceProposals' pre {
int_t first_type; //initial proposal
first_type = GetLastNewProposalType(player[0], player[1], 0);
NP_FIRST_TYPE=first_type;
message(1,'proptype');
}
messagebox 'proptype' {
show();
Text (ID_M_proptype) ;
// M_proptype "sender={player[0]} receiver={player[1]} type={NP_FIRST_TYPE}"
}
into it to see what you get.
|
|
|  |
 |
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:15
|
|
OK, it is possible to get AI-AI diplomacy, but it ain't all that pretty. It's the motivation settings in the strategies in combination with the priorities for the proposal in diplomacy.txt that should determine whether or not a New Proposal is sent. But this happens in the three motivation events: FearMotivation, DesireMotivation, and ReactionMotivation. Each of these has a player[0] (the sender) and a player[1] (the receiver) parameter and no matter what I tried I couldn't get the events occur with anything other than the human as player[1].
So, as they say, here's a workaround. Just prior to these motivation events the NextDiplomaticState event occurs, again with player[0] and player[1] parameters, and here the game does take player[1] in a loop through all the other players that player[0] has contact with. There's two tricks involved: first, you work in this event rather than the motivation events we're supposed to be working in, and second, immediately after telling the sender to consider a new proposal you generate a NewProposal event. Here's an example test handler:
code:
HandleEvent(NextDiplomaticState)'Test_AI_AI_Diplom
acy' pre {
if (!IsHumanPlayer(player[0]) && !IsHumanPlayer(player[1])) {
if (TurnsAtWar(player[0],player[1])>25 ) {// 0 for test
// offer cease-fire
LogRegardEvent(player[0],player[1], 500, 0, ID_NONE, 0);
ConsiderNewProposal(player[0],player[1], 2000,32,0,ID_NONE,ID_NONE,ID_NONE);
Event:NewProposal(player[0],player[1]);
}
if (HasAgreement(player[0], player[1],32) && !HasAgreement(player[0], player[1],33) ) {
//if they have a cease-fire but not a peace treaty, offer one
LogRegardEvent(player[0],player[1], 500, 0, ID_NONE, 0);
ConsiderNewProposal(player[0], player[1], 2000, 33, 0,ID_NONE,ID_NONE,ID_NONE);
Event:NewProposal(player[0], player[1]);
}
if(AtWarWith(player[0],1) && AtWarWith(player[1],1)){// 1 being the Human
//if both sender and recipient are at war with the Human
if (!HasAgreement(player[0], player[1],33) ) {//are these mutual?
//if they don't have a peace treaty, offer one
ConsiderNewProposal(player[0], player[1], 2000, 33, 0,ID_NONE,ID_NONE,ID_NONE);
Event:NewProposal(player[0], player[1]);
}
if(HasAgreement(player[0], player[1],33) && !HasAgreement(player[0], player[1],38)){
//if they have a peace treaty but not an alliance, offer one
ConsiderNewProposal(player[0], player[1], 2000, 38, 0,ID_NONE,ID_NONE,ID_NONE);
Event:NewProposal(player[0], player[1]);
}
}
}
}
I doubt that anyone would really want to use this as it stands. It might be called 'The_Second_Coming_Handler': I've only tested it over a short term but it's effect is to establish World Peace amongst AI civs quite rapidly. On the other hand, I think it does show the route towards getting AI-AI diplomacy.
Oh, and you also have to have a handler like the 'AcceptWarAndAllianceProposals' one I posted above to get them to accept the proposals.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:15
|
|
quote:
I would rather like AI alliance against other AIs or the human
|
The last part of the handler should give the result that any two AI's that are at war with the human will enter into an alliance, but I didn't test it that far.
quote:
And another question would it the effect of this line:
code:
if(AtWarWith(player[0],1) && AtWarWith(player[1],1)){// 1 being the Human
equal to this line:
code:
if(AtWarWith(player[0],(IsHumanPlayer(g.player))) && AtWarWith(player[1],(IsHumanPlayer(g.player)))){// 1 being the Human
|
Yes, provided the human player is player 1, so it's not really what you're after. A better way of doing it (I think this was Wombat's idea) is:
code:
int_t THE_HUMAN;
HandleEvent(BeginTurn)'NumofPlayers' pre {
int_t i;
NUM_PLAYERS= preference("NumPlayers");
for(i=1; i
so that you can use 'THE_HUMAN' instead of '1'.
quote:
message((IsHumanPlayer(g.player)), 'DestroyCityMSG');
|
The trouble is that 'IsHumanPlayer(g.player)' will return either 1 or 0, so this message will either go to player 1 (who's usually the human) or the Barbarians. If you use 'THE_HUMAN' you should get the generality you want.
quote:
So Dale's main rotine would also work if it looks like:
|
When you go to test this, I strongly recommend that for testing purposes you put the following handler into your file:
code:
int_t NP_FIRST_TYPE;
HandleEvent(NewProposal)'TestNewProposal' pre {
int_t first_type;
first_type = GetLastNewProposalType(player[0], player[1], 0);
NP_FIRST_TYPE=first_type;
message(1,'proptype');
}
messagebox 'proptype' {
show();
Text (ID_M_proptype) ;
// M_proptype "sender={player[0]} receiver={player[1]} type={NP_FIRST_TYPE}"
}
This will pick up any pick up any message that any player sends to any other player and tell you about it. So you can see what kind of diplomacy is going on all the time.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:15
|
|
Here's the bit that got missed out above:
Yes, provided the human player is player 1, so it's not really what you're after. A better way of doing it (I think this was Wombat's idea) is:
code:
int_t THE_HUMAN;
HandleEvent(BeginTurn)'NumofPlayers' pre {
int_t i;
NUM_PLAYERS= preference("NumPlayers");
for(i=1; i < NUM_PLAYERS; i=i+1){
if (IsHumanPlayer(i)) {
THE_HUMAN=i;
}
}
}
so that you can use 'THE_HUMAN' instead of '1'.
[ Did you know that if you try to print "i<", it won't print the next few lines?]
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:15. Apolyton Time is 00:15. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|