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 > Alternative Civs > Clash of Civilizations > Military/econ user interface and the ai
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
04.Sep: `FC` 2.0.5 COMPLETED AND RELEASED
27.Jul: `FC` 2.0.4 COMPLETED AND RELEASED
16.Jul: `FC` 2.0.3 COMPLETED AND RELEASED

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 25-05-2003 15:13
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Military/econ user interface and the ai Enter the AD-FREE zone

I didn't really know in which thread this would belong best, so here goes:
I'm writing the code needed to allow the ai to decide what to build. Now I finally found how to do it, it all seems clear, and I think the player can benefit from it too, in terms of user interface.

Currently, ai and players say which kind of unit they want and how much production they want to put in each. This is fine, but maybe what they want is to have that proportion of armies, and when you get your legions killed but not the archers, you have to micromanage to get more legions produced than archers to keep the good proportions. Additionally, there's the fact that archers are listed before legions, so they get produced before.
Now, the player can change production orders when they like. The ai can too, but you must script it in the scenario file, which makes it not very responsive in general, unless you want to code all the ai in xml.

So what I am doing is writing an object that maps to a certain distribution of units. For the player, that would be pretty simple, he says I want 40% legion, 60% dreadnoughts, and how much globally the econ should spend on units, and voilá.
This, however, would require some econ changes, as I'd add an econ order like 'overall military spendings', whose production/kapital/food ratios vary depending on the player's input. I can always bypass this in a first coding attempt as there will be some waste (the same problem exists for walls, which share a single wall-building category).

And then there is the ai. I can also tell the ai to build units in proportion, so it will always have combined arms TFs rather than having mostly archers in an archer/legion case.

Last edited by LDiCesare on 25-05-2003 at 15:27

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 25-05-2003 15:26
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

Obviously, building units that are needed instead of yet another archer is a good thing for the ai, but how does it know it should build a new unit when one becomes available? Particularly, when such a unit doesn't obsolete a previous unit, but is something new (like cavalry when you didn't have any, or airplanes or ships...)?

I define for the ai use a set of unit abilities:
Right now, I picked:
Attack, defense, breach, cost, support, movement.
This defines a set of abilities which the ai will want.
For instance, you may say you want:
60% legion, 30% archers, 10% siege engines.
But you may also state it thus:
60% attack, 30% support, 10% breach.

These are not categories, however. I don't like categories a lot, because if you label an army as 'defender', ai's like civ2 use it as defender when they would sometimes make excellent attackers.
Additionnally, I put movement and cost in because you may want a mix of these. For instance, I may want a set of fast cheap units to use as scouts, a few strong attack units, even if they are slow and expensive, and a lot of relatively cheap attack units which can move a bit.
So I have categories, with weights in each category:
For example I could represent scouts/strong attackers/cheap fast attackers this way:

Scouts: Movement 10. Cost 1.
Strong attackers: Attack 1.
Cheap fast attckers: Attack 10. Movement 3. Cost 1.

The ai would then scan the available units, classify each available unit in each category, and decide which unit is best to build. If the system works well, humans could also use it (for instance, I will use it because I have to tune the ai).

Mapping of units to abilities would vary a bit:
Breaching is a yes/no ability, so it is not hard to find out when you want siege weapons. There are more extreme cases, like being an airplane or a ship, where you don't even have the breach strength value available.
Attack, defense... are numbers, so there will be a number crunching equation I haven't devised yet to find out how much a unit fits a certain role.

So this approach is to define a set of categories that the ai can use, categories which can be defined on the fly if needed (like I realize I need breachers to get through the wall of city XXX). What do you think of the approach for the ai? Should the player be able to use it too? Would you use such an interface as a player?

Last edited by LDiCesare on 25-05-2003 at 15:33

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:28
Thumbs up  Old Post 25-05-2003 18:38 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Hi Laurent:

Just to give you some quick feedback, your approach sounds reasonable to me. And I would certainly be interested in using a flexible system to set army levels like the one you propose. However, I can't say I have given the specifics of your proposal deep thought. I'll let you know if upon reflection I have any good ideas in regard to your proposal. Its certainly a step in the the right direction, and if it needs modifications, I don't think they'll be major.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 31-05-2003 21:22
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Put an end to popups!

All the infrastructure is coded. So now, the ai gets orders like this in the xml file (one of the following):

<AI>
  <buildOrders>
    <militaryProduction> 0.8 </militaryProduction>
    <unitsProfile>
    <production>
      <order> Phalanx</order>
      <level> 10 </level>
    </production>
    <production>
      <order> Bowmen</order>
      <level> 8 </level>
    </production>
    <production>
      <order> Elephant</order>
      <level> 1 </level>
    </production>
    </unitsProfile>
  </buildOrders>
</AI>

This one tells the ai to spend 80% of its income on military, in order to get proportions of 10$ of phalanx for 8$ of bowmen and 1$ worth of elephants at all times in its armies.

<AI>
  <buildOrders>
    <militaryProduction> 0.8 </militaryProduction>
    <abilityProfile>
      <production>
        <ability>
          <attack> 1 </attack>
          <cost> 1 </cost>
        </ability>
        <level> 2.0 </level>
      </production>
      <production>
        <ability>
          <support> 1 </support>
          </ability>
        <level> 1.0 </level>
      </production>
    </abilityProfile>
  </buildOrders>
</AI>

This one is funnier, as it orders to have low cost strong attack and strong (fire)support units. This currently results in siege weapons and light cavalry for carthaginians in Delenda scenario. The ai can use this and adapt itself, picking the best available unit as new units become buildable.
(Although I must tune the choice function because it's a bit bugged right now).

The ability objects can be named too, so I hope I can put something nice into a user interface when all the internals work fine:
I'd let the player choose to
-choose units per name (as now)
-choose units per abilities, where you could create and name your own set of abilities, and then the UI would tell you what's the unit that matches this profile best, and build it. When a better unit becomes available, it would switch production automatically, but you could still build the old unit if you liked through the econ orders UI.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:28
Thumbs up  Old Post 01-06-2003 03:03 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

Hi Laurent:

That looks outstanding! Can't wait to see it in action once you have the bugs kicked out!

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:28
  Old Post 03-06-2003 08:20
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Help yourself to an AD-FREE life

Laurent, it's wonderful to see you using tags that start with a lowercase letter!

Cheers

Mr. President is offline Mr. President
Emperor
The leaves that are green turn to brown
Jul 2001
time: 15:28
  Old Post 04-06-2003 04:12 Visit Mr. President's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Enter the AD-FREE zone

To my limited knowledge of programming, that system sounds interesting.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:28
Cool  Old Post 04-06-2003 06:20 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton buy from Amazon

Hi Gary, great to 'see' you on the forum again! Hope all's well with you and yours!

Mark

Mr. President is offline Mr. President
Emperor
The leaves that are green turn to brown
Jul 2001
time: 15:28
  Old Post 04-06-2003 12:13 Visit Mr. President's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

I appreciate the kind word, but I think you might have me confused with someone else. My name is Dave.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 06-06-2003 21:50
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Civilization 2

quote:
Laurent, it's wonderful to see you using tags that start with a lowercase letter!

Glad you like it!

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 06-06-2003 23:09
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Put an end to popups!

Here are (hopefully) screenshots of the UI.
Note it is not very good because:
- it is not exactly the correct type of window (should probably be dialogs instead of frames...)
- it lacks an edit function after you created the category
- it is not fully functional for it is based only on civ-wide orders and not province-only for example
- there are bugs (strange as it may sound):

Attachment: clashmilitary.gif
This has been downloaded 50 time(s).

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 06-06-2003 23:11
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton buy from Amazon

Here is the edit category panel.
Note that this allowed me to see that chariots are vastly overpowered in the Carthago scenario.
Using attack only, romans will build chariots, if you choose attack = 1 and cost = 1, they'll build legions (weaker but more cost-effective).
This screenshot is not sexy, so I think probably the figures should be replaced by sliders, as big values will screw my computations anyway so it'd be better to limit the possible values to 0/0.5/1/1.5/2 with a slider.

Attachment: clashcategory.gif
This has been downloaded 47 time(s).

Gary Thomas is offline Gary Thomas
Prince
New Zealand
Mar 2001
time: 17:28
  Old Post 09-06-2003 09:18
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Help yourself to an AD-FREE life

This is great stuff Laurent - I am really looking forward to trying it out.

Has anything been done about naval combat in my absence?

Cheers

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 09-06-2003 13:08
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Avatar Enlargement: We've got the solution

I answered about naval combat in the other thread. Shortly: yes, but there is no model beneath.

The screenshots are of functional windows, except there is a conflict with the econ UI somewhere. I mostly coded the UI to test the underlying classes gave correct results for the ai to use.

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:28
  Old Post 16-06-2003 01:17 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Got spare money?

Lookin' good Laurent, sorry I neglected to respond earlier! I'm looking forward to playing with the new gui stuff when its ready.

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 16-08-2003 11:38
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

This interface is available under a Mili. button in the code I last sent Mark.
(Does this look like a shameless bump?)

Richard Bruns is offline Richard Bruns
King
NC, USA
Nov 1999
time: 06:28
  Old Post 07-09-2003 23:55 Visit Richard Bruns's homepage!
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

This all looks very nice. Has it been released yet? The most current version I have (7.7) does not have any of this.

I also ran into a problem with getting orders hidden. I was able to use the economics.xml to hide the Food and Manufacturing tech orders, but I was not able to hide a new tech I made for a scenario:

code:
<!-- ===New, hidden technology to be used as a counter for victory== --> <technology> <name>Families Captured</name> <tier>3</tier> <growthrate>1</growthrate> <upkeep>0</upkeep> </technology> <activity> <name>Capture</name> <description>Kidnap families so they don´t fight</description> <recipient> <name>Families Captured</name> <proportion>1</proportion> </recipient> </activity> <govteconordersinfo> <ordertypename>Capture Tech</ordertypename> <orderclass>stub</orderclass> <hidden>true</hidden> </govteconordersinfo>


The player can still invest in the tech. What am I doing wrong?

Mark_Everson is offline Mark_Everson
Clash of Civilizations Project Lead
Canton, MI
Jan 1970
time: 00:28
  Old Post 08-09-2003 03:54 Visit Mark_Everson's homepage!
Edit/Delete Message Reply w/Quote
#18 Report this post to a moderator
Support Apolyton

Hi Richard, glad to see you going again on the scenarios!

quote:
Originally posted by Richard Bruns
This all looks very nice. Has it been released yet? The most current version I have (7.7) does not have any of this.


I have a version of the code that is about a week old. Let's hear from Laurent about what the best code to give you would be. My inclination is to simply take the code that has all the latest features he's discussed and the new xml commands, and realease it to you as a testbed. What do you think Laurent?

quote:
I also ran into a problem with getting orders hidden. I was able to use the economics.xml to hide the Food and Manufacturing tech orders, but I was not able to hide a new tech...

The player can still invest in the tech. What am I doing wrong?


I don't know. It could be the order in which the xml is being read. Send me the whole scenario xml, and I'll see what is going on. Probably won't be before next weekend though unless it is really simple.

Cya,

Mark

Richard Bruns is offline Richard Bruns
King
NC, USA
Nov 1999
time: 06:28
  Old Post 13-09-2003 04:39 Visit Richard Bruns's homepage!
Edit/Delete Message Reply w/Quote
#19 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

The files-all is declared before the code you just saw. Here's the scanario, though. And it is fairly small:

Attachment: onslaught.zip
This has been downloaded 1 time(s).

LDiCesare is offline LDiCesare
King
La Ferté sous Jouarre France
Jan 2001
time: 05:28
  Old Post 13-09-2003 13:03
Edit/Delete Message Reply w/Quote
#20 Report this post to a moderator
Support Apolyton

I'll setup a most-recent code version to use as a testbed. The version with that UI is not public yet.

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:28.
Apolyton Time is 00:28.
    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.0501 seconds (80.33% PHP - 19.67% MySQL) with 30 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