Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Call To Power II > CtP2-Source Code Project > AI : Army Movement
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
CivGroups
CTP2 Source Code Project (59): Not a Member - Join

bottom of page
  
Author
Thread   
Pages (4): [ 1   2   3   4   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:34
  Old Post 30-12-2004 13:11
Edit/Delete Message Reply w/Quote
#61 Report this post to a moderator
Full PM-box? Change here!

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.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 30-12-2004 22:44 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#62 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

quote:
Originally posted by LDiCesare
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.


Well something like this, but actual it is not very clever, you scan the whole map for possible goals. Tgis means the huger the map the slower the algorithm, better would be of course to send troops to the visibility frontier and continue there. However this isn't so simple anymore.

-Martin

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:34
  Old Post 30-12-2004 23:40
Edit/Delete Message Reply w/Quote
#63 Report this post to a moderator
Avatar Enlargement: We've got the solution

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 is offline Protra3211
Warlord

Jun 2003
time: 05:34
  Old Post 05-01-2005 12:37
Edit/Delete Message Reply w/Quote
#64 Report this post to a moderator
Get a bigger avatar today!

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.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 09-01-2005 20:55 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#65 Report this post to a moderator
Lose 30 kilos (of popups)

quote:
Originally posted by 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.


Well if you want the latest but unfinished version of this file, you can try this post. But note this file is unfinished and the AI still cannot do oversea invasions, but it should give you a beat on one continent only maps.

-Martin

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:34
  Old Post 09-01-2005 21:56 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#66 Report this post to a moderator
Increase the size of your Attachments

And if you DO finish and improve that script, also using the new SLIC functions, you will be our eternal hero .

Protra3211 is offline Protra3211
Warlord

Jun 2003
time: 05:34
  Old Post 10-01-2005 11:49
Edit/Delete Message Reply w/Quote
#67 Report this post to a moderator
Get a bigger avatar today!

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.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 10-01-2005 16:18 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#68 Report this post to a moderator
Put an end to popups!

quote:
Originally posted by Protra3211
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 .


Just tested the link in my previous post and it works and the link in that post I posted the link work as well. It should you lead you to an experimental version of GoodMod with the better Ai slic of v.0.99.

-Martin

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:34
  Old Post 10-01-2005 20:56 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#69 Report this post to a moderator
Support Apolyton buy from Amazon

Protra3211

I'm excited to see what you come up with. I'd love to see some better overseas invasions

but if you are feeling ambitious, two other AI movement things that should be added is the AI "seizing" tiles with goods on it and holding chokepoints.

Maybe using the slic HasGood or the Get water (to identify tiles with two or more sides of water) could help in that direction

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:34
  Old Post 10-01-2005 21:20 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#70 Report this post to a moderator
Inflate your Upload Space

Actually, getting a script for decent naval invasions that works would be an even stronger improvement that seizing goods at this point.

Protra3211 is offline Protra3211
Warlord

Jun 2003
time: 05:34
  Old Post 11-01-2005 01:07
Edit/Delete Message Reply w/Quote
#71 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

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.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 11-01-2005 03:19 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#72 Report this post to a moderator
Support Apolyton or Terrorists Win

quote:
Originally posted by E
but if you are feeling ambitious, two other AI movement things that should be added is the AI "seizing" tiles with goods on it and holding chokepoints.


Actual the AI should settle on choke points, to block them. Maybe there is a problem of defining a choke point, it is not only the question of how many borders of this choke point tile consists of strand but also how big are the resulting landmasses after removing this choke point.

Maybe we should also add for the Goals.txt a good type target.

-Martin

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:34
  Old Post 11-01-2005 03:43 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#73 Report this post to a moderator
Full PM-box? Change here!

That's the decisionmaking issue, is it always better to settle a chokepoint? If there's a tundra chokepoint, might be better to just have military units there without wasting the resources for a Settler, for instance.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 11-01-2005 23:34 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#74 Report this post to a moderator
Full PM-box? Change here!

quote:
Originally posted by Solver
That's the decisionmaking issue, is it always better to settle a chokepoint? If there's a tundra chokepoint, might be better to just have military units there without wasting the resources for a Settler, for instance.


Well we can give choke points a bonus like the good bonus.

-Martin

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:34
  Old Post 12-01-2005 03:17 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#75 Report this post to a moderator
Support Apolyton buy from Amazon

A random question, has anyone contacted this guy:

http://apolyton.net/forums/showthre...172#post2482172

or any of the other progammers in this thread?

just curious....

Solver is offline Solver
Apolyton Duke Of Something
Latvia, Riga
Sep 2000
time: 07:34
  Old Post 12-01-2005 03:37 Visit Solver<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#76 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Fair point. There's a number of people there that might be worth contacting.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:34
  Old Post 13-01-2005 23:11 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#77 Report this post to a moderator
Support Apolyton buy from Amazon

I found this in world.h

code:
void CalcChokePoints();


does this help anything?

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 14-01-2005 03:17 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#78 Report this post to a moderator
Full PM-box? Change here!

quote:
Originally posted by E
I found this in world.h

code:
void CalcChokePoints();


does this help anything?


Well this is the declaration the function that calculates the choke points, at least its name suggests this. To check wheather the choke points are calculated correctly, we have to check the implementation in the according *.cpp source file. Actual what I had in my was to add a field to strategy.txt that like the good settle bonus that contains a bonus for settling at choke points.

The task to do here are to add that flag to strategies.txt in a manner such that it has a default value so that it hasn't to be added to strategies.txt and the default value shouldn't overwrite explicitly set values when strategies are merged.

Then you have to find the code that uses this settle good bonus and you have to add in the same way like this good bonus the choke point settle bonus.

-Martin

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:34
  Old Post 15-01-2005 23:56
Edit/Delete Message Reply w/Quote
#79 Report this post to a moderator
Avatar Enlargement: We've got the solution

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.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 16-01-2005 03:03 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#80 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

At least it seems to be not a problem in respect to backwards compatibility, as it looks like that choke points are recalculated after every reload, at least the stuff is not explicitly stored, so we can use more numbers then 256 to measure their quality, but even with 256 quality classes we should be able to distinguish them.

-Martin

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:34
  Old Post 10-02-2005 20:41 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#81 Report this post to a moderator
Support Apolyton buy from Amazon

bump for sekel

sekel is offline sekel
Chieftain
São Paulo
May 2004
time: 05:34
  Old Post 10-02-2005 22:16
Edit/Delete Message Reply w/Quote
#82 Report this post to a moderator
Put an end to popups!

I´d just love to have a good C++ work environment here and start experimenting with the AI goals .... but I´ll have to wait till next week

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:34
  Old Post 10-02-2005 23:19 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#83 Report this post to a moderator
Avatar Enlargement: We've got the solution

sekel, I hope you stick to it, a lot of people have shown interest but unfortunately few have contributed

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 22-02-2005 04:14 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#84 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

OK, I nailed down the problem that caused these massive slow downs. It is this operator> from Squad_Strength:

code:
bool Squad_Strength::operator> (const Squad_Strength &squad_strength) const { bool greater = (m_attack_str > squad_strength.m_attack_str) || (m_defense_str > squad_strength.m_defense_str) || (m_transport > squad_strength.m_transport); bool greater_defenders = (m_defenders > squad_strength.m_defenders ); bool greater_ranged = (m_ranged > squad_strength.m_ranged); bool greater_ranged_str = (m_ranged_str > squad_strength.m_ranged_str ); bool greater_value = (m_value > squad_strength.m_value); bool greater_agents = (m_agent_count > squad_strength.m_agent_count); #if 0 && !defined (ACTIVISION_ORIGINAL) // Calvitix // Removed by Martin Gühmann // Causes a severe slow down on maps with more than one continent. // Needs therefore be reconsidered. That is also true for the // original code, only the greater variable is used. greater = false; // 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); sint16 ranged_nb = (m_ranged - squad_strength.m_ranged); sint16 defenders_nb = (m_defenders - squad_strength.m_defenders); sint16 transport_nb = (m_transport - squad_strength.m_transport); // 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) greater = true; // To be compatible with the original operator, test the // nb of transport too if (m_transport > 0 && transport_nb > 0) greater = true; // test the nb of agent too if (m_agent_count > 0 && squad_strength.m_agent_count > 0) { greater = greater || greater_agents; //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) { greater = greater_agents; } } #endif return greater; }


For now I just disabled Calvitix code, however I think that neither the original nor Calvitix' code are right. The original code evaluates this greater variable and returns it finally. In the middle it evaluates some other variables that aren't used. Calvitix just sets this greater variable afterwards it has been evaluated to false and evaluates it again. He also ignores the other greater variables evaluated before.

However there seems to be something wrong with this, maybe it lies inside of this operator or the problem is finally caused outside of the operator.

-Martin

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:34
  Old Post 22-02-2005 15:05
Edit/Delete Message Reply w/Quote
#85 Report this post to a moderator
Tired of ads?

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 is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 22-02-2005 20:02 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#86 Report this post to a moderator
Support Apolyton buy from Amazon

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 is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 22-02-2005 23:43 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#87 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

Well after some more testing it seems to be that the problem even with my version of the operator occurs. It seems to be that it is a problem with missing transports, and unreachable positions. For now I would consider this code as expreimental.

-Martin

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 10-03-2005 22:46 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#88 Report this post to a moderator
Remove this text

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 is offline Fromafar
Prince

May 2003
time: 06:34
  Old Post 11-03-2005 22:43
Edit/Delete Message Reply w/Quote
#89 Report this post to a moderator
Support Apolyton or Terrorists Win

It is not anti-symmetrical yet. When having both

  1. A.m_transport > B.m_transport > 0
  2. B.Sum(strenghts) > A.Sum(strengths)
you will have A > B (because of 1.) and B > A (because of 2.) return true.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:34
Post  Old Post 12-03-2005 23:11 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#90 Report this post to a moderator
Support Apolyton, buy Call to Power 2

What about this:

code:
bool Squad_Strength::operator> (const Squad_Strength &squad_strength) const { // Transport squads should always be always bigger: if(m_transport > squad_strength.m_transport) return true; else if(m_transport < squad_strength.m_transport) return false; // 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; }


Obviously transport squads should be always bigger, so only if the transport strength of both squads is equal, then the values should be tested.

By the way I didn't understand for what this nb_transport variable is and why Calvitix checks whether m_transport > 0 and transport_nb > 0, the first check should be included in the second one.

-Martin

 
Pages (4): [ 1   2   3   4   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:34.
Apolyton Time is 00:34.
    top of page
Rate This Thread:
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0647 seconds (91.63% PHP - 8.37% MySQL) with 36 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net