 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:34
|
|
Thanks a lot Peter. So the algorithm is easy, the ai is looking to explore every square 5 spaces apart. This means in theory with units which have a view of 2 you would see at least 96% of the map when all explore goals are completed.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:34
|
|
Yes I see that it's scanning the whole map everytime. I have adjusted the version by in my game. There is a difference between clash and CtP for the moment Clash gives orders to individual units (units obey to a strategy but have a lot of individual latitude right now) whereas CtP gives overall goals and then matches units and goals. The first approach lacks strategy, the second may overlook important things too if the stack best matching an important goal is far from it.
Anyway I look for the nearest neighbour square that is unexplored, and limit the number of acceptable squares to 1 every 3 squares, which lets the whole map be seen. The nearest neighbour is expensive too, but at least it's done only on a few squares rather than trying to match all goals.
|
|
|  |
 |
|
Protra3211
|
|
Better AI 94
Is there a slc file- Better ai -I could downlode and try?
I think the most improvements have been for diplomacy like 3.6 Diplomod.I use this in the 1.11 version and it works well.
Giving the ai the skill it needs to stay one step ahead of the human player must take alot of tweaking of files. But I recall there were some slc files to give the ai a slight boost in the first wave of attacks sometimes catching you off balance. Not the Frenzy mod 2.1.
|
|
|  |
 |
|  |
 |
|
Protra3211
|
|
Thank you Martain for responding!
The link didnt work but found a site that had your file on it. BureauBerts CtP2 modifacation site Better AI script v0.94 verison. Have to try it out. Also there is Clearorders slc by Locutus .
Been depending alot on the production cheats I could give the ai in DiffDB file and tweaking force matchs numbers to see what I could come up with.
Would like to cut back on these numbers a bit and use these slc files as way of making better game play.
What do think about raising the priority for Patrol in Goals and Strategies files ? Would like to see ai take control of open areas as a way of hemming in human player. AI stettles alot better now but if ai could push more units at your borders it would have a shot at taking cities you just made near enemies border. Well thank you again good luck on the patch your working on.
|
|
|  |
 |
|
Protra3211
|
|
Have the file BetterAI 99 version
Dont know why the link didnt work before but have it now. Thanks again .Never played the Good mod.
|
|
|  |
 |
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:34
|
|
I cheked that file quickly (gs/world/WrldCont.cpp).
The computation seems to be done on neighbours only. There are several passes, but only neighbours are cheked. (I don't know what values you get when there is an isthmus.)
The result is a map of (0,1) for land and water. Thus it's binary, either you are a choke point or not. There's no way of knowing whether it's a 2-direction or 3-direction chokepoint for instance, and the land masses aren't considered because the algorithm only checks neighbours.
It would be simple to change that by removing the chokepoints from the map, computing the size of the landmasses separated by the landpoints, and giving a weight to the chokepoint as a function of that...
But then I'm not going to do it so I'd better keep lurking.
Good luck to you all.
|
|
|  |
 |
|
LDiCesare
|
|
La Ferté sous Jouarre France
Jan 2001 time: 05:34
|
|
Did you try replacing the end by
if ((attack_cpr + defense_cpr + ranged_cpr + value_cpr) > 0)
return greater;
// To be compatible with the original operator, test the
// nb of transport too
if (m_transport > 0 && transport_nb > 0)
return true;
// test the nb of agent too
if (m_agent_count > 0 && squad_strength.m_agent_count > 0)
{
//when only agent count is as criterion : (for special units for example)
if (m_attack_str + m_defense_str + m_ranged_str + m_value == 0)
{
return greater_agents;
}
}
return false; // or 0 or FALSE I don't know the relevant defines
?
The logic is exactly the same but you don't do useless computations. That and putting the original code in a #ifdef/#else so you don't use the other useless variables?
(back to lurker mode).
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:34
|
|
Well I came up with this code, it is a cleaner version. And it seems to help the AI. However it still causes a slow down that spontaniously disappeared. It is less severe but it is still there.
code:
bool Squad_Strength::operator> (const Squad_Strength &squad_strength) const
{
// To be compatible with the original operator, test the
// nb of transport too
sint16 transport_nb = (m_transport - squad_strength.m_transport);
if(m_transport > 0 && transport_nb > 0)
return true;
// Attack difference
sint16 attack_cpr = (m_attack_str - squad_strength.m_attack_str);
// Defense difference
sint16 defense_cpr = (m_defense_str - squad_strength.m_defense_str);
// ranged difference
sint16 ranged_cpr = (m_ranged_str - squad_strength.m_ranged_str);
// value difference
sint16 value_cpr = (m_value - squad_strength.m_value);
// the addition of all differences has to be greater than 0
// it is certainly better than only testing attack or defense
// but can be improved (for exemple, by applying a ratio on the greater score
if((attack_cpr + defense_cpr + ranged_cpr + value_cpr) > 0)
return true;
// test the nb of agent too
if(m_agent_count > 0 && squad_strength.m_agent_count > 0){
//when only agent count is as criterion : (for special units for example)
if (m_attack_str + m_defense_str + m_ranged_str + m_value == 0){
return (m_agent_count > squad_strength.m_agent_count);
}
}
return false;
}
Otherwise my test game ran fine, the AI filled the whole map with cities, I saw sea activity, maybe some more coordinated activity for oversea invasion would be good. But maybe the AI should first conquer its neighbors. Unfortunatly I cannot continue the game the game had to crash during saving the autosave, that left me with a autosavegame of 9kb and that is definitely to small for a save game, and I have no idea what happened as I don't have a crash.txt of that event. ANother thing I saw is that the AI doesn't attack cities without defenders.
quote: Originally posted by LDiCesare
return false; // or 0 or FALSE I don't know the relevant defines
|
The difference is that false is of type bool, it has the same size as a char of 1 byte IIRC. BOOL is a typedef of int and that is bigger bool. BOOL needs 4 byte, and FALSE is just 0 also an int. I know you can also see it as a short.
The main difference is the size, and the operator should return a bool therefore false is more appropiate. However you can also use FALSE that is then casted to false, but using false directly is cleaner code.
quote: Originally posted by LDiCesare
The logic is exactly the same but you don't do useless computations.
|
Well I don't thing that the logic is the same, in your version and also in my version, once the transport thing is true, the operator returns true, in Calvitix version the return value could still change, however I think that our logic is the better logic as it restores the compatibility with the transport stuff, Calvitix version doesn't do this. I think that the slowdown is caused by the outcome of the operator not by the number of steps it does.
For the original version I can clearly say that this could happen:
(A > B) == true
(B > A) == true
And instance if attack strength of A is bigger than of B, and if defence strength B is bigger than of A. That's a kind of logic that worries me. I didn't check whether this could happen to the new version as well, but I doubt that this should be possible.
-Martin
|
|
|  |
 |
|
Martin Gühmann
|
 |
Berlin, Germany
Mar 2001 time: 06:34
|
|
OK here is another version of that operator, it should now be correct and assymetrical, well except for the case A == B, then it should return false as well as for B == A.
code:
bool Squad_Strength::operator> (const Squad_Strength &squad_strength) const
{
// To be compatible with the original operator, test the
// nb of transport too
sint16 transport_nb = (m_transport - squad_strength.m_transport);
if(m_transport > 0 && transport_nb > 0)
return true;
// Attack difference
sint16 attack_cpr = (m_attack_str - squad_strength.m_attack_str);
// Defense difference
sint16 defense_cpr = (m_defense_str - squad_strength.m_defense_str);
// ranged difference
sint16 ranged_cpr = (m_ranged_str - squad_strength.m_ranged_str);
// value difference
sint16 value_cpr = (m_value - squad_strength.m_value);
// The addition of all differences has to be greater than 0
// it is certainly better than only testing attack or defense
// but can be improved (for exemple, by applying a ratio on the greater score
if((attack_cpr + defense_cpr + ranged_cpr + value_cpr) > 0)
return true;
// Test the nb of agent too
if(m_agent_count > 0 && squad_strength.m_agent_count > 0){
//If only agent count is a criterion : (for special units for example)
if(m_attack_str + m_defense_str + m_ranged_str + m_value == 0
&& squad_strength.m_attack_str + squad_strength.m_defense_str + squad_strength.m_ranged_str + squad_strength.m_value == 0
){
return (m_agent_count > squad_strength.m_agent_count);
}
}
return false;
}
#endif
I modified the final squad size test, so that it only returns true if the size of the first squad is bigger than the size of the other squad, if the values of both are 0. That means two squads are equal in strength if their values are equal irrespective of their size. Or are equal if these values are all in both squads 0 and their size is equal.
I tested this operator against the original operator in a late game. The AI turn times seem to be equal, however this doesn't indicate that the sorting results during the game create the same length of AI turn tedium.
However I don't think that this operator is the real problem of the AI slowness. I think it has still to do something with the AI transport capacity. As AIs without the need of transporting a lot of units are much faster and aren't a problem.
Well any comments about this version of the operator. Seems it be fine. Is it error free, has it the claimed assymetry?
Some other notes about the AI, if an AI has no idea what it should do with its units it puts them on their roads, you see a lot of units sleeping on their roads. Of course that are all single units and the tiles aren't filled to the tile limit of 12 units. An easy goal for an attacker and something that is another possible AI turn time slow down.
-Martin
|
|
|  |
 |
|
Fromafar
|
|
It is not anti-symmetrical yet. When having both- A.m_transport > B.m_transport > 0
- B.Sum(strenghts) > A.Sum(strengths)
you will have A > B (because of 1.) and B > A (because of 2.) return true.
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:34. Apolyton Time is 00:34. |
top of page
|
|
|
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
|
|
|
|
|
|