Author Topic: (fixed)Ai does not work for annex in 3.8.0 Beta 1  (Read 2045 times)

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
(fixed)Ai does not work for annex in 3.8.0 Beta 1
« on: 27 June 2013, 21:06:12 »
Tested out 3.8.0 Beta 1 with Annex to find the AI no longer functions. Instead the AI only builds 5-6 Warehouses (structures that produce consumable resources) and that's all. I know that they have more than enough resources to produce the other structures.

Perhaps this is related to this bug mentioned here: https://forum.megaglest.org/index.php?topic=9105.0

Last version I Know Ai worked properly was rev 4401.
« Last Edit: 11 September 2013, 22:33:20 by titi »
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #1 on: 27 June 2013, 22:11:05 »
If you need custom behavior for Annex set the factions to behave the way you want using the XML tags documented somewhere in the forums. The changes relate to the ideas of consumable resources (typically food):

resource-producer-units

and fear each unit specify the tag:

minimum

Sorry I don't have time to look up the syntax but should be in the forums or wikia

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #2 on: 28 June 2013, 00:13:09 »
Tried with and with out Ai Behavior Tags still same result: Code I used for Alliance Faction:

Code: [Select]
<ai-behavior>
<worker-units>
<unit name="refinery" minimum="1"/>
</worker-units>
<warrior-units>
<unit name="battle_tank" minimum="4"/>
<unit name="eml_walker" minimum="3"/>
</warrior-units>
<building-units>
<unit name="barracks" minimum="1"/>
<unit name="factory" minimum="2"/>
<unit name="hangar" minimum="1"/>
<unit name="tech_lab" minimum="1"/>
<unit name="silo" minimum="1"/>
</building-units>
<upgrades>
<upgrade name="adv_weapons"/>
<upgrade name="energy_rods"/>
<upgrade name="ballistics"/>
<upgrade name="ai_assist"/>
<upgrade name="robotics"/>
<upgrade name="advanced_armor"/>
</upgrades>
</ai-behavior>
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #3 on: 28 June 2013, 14:17:51 »
I also think current AI does not play perfect regarding the ressource buildings. We will look at it for next version.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #4 on: 28 June 2013, 16:10:03 »
We will fix it before release in otherwords :)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #5 on: 28 June 2013, 22:18:04 »
yesss  ;D
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #6 on: 1 August 2013, 19:46:41 »
Ishmaru i just noticed that in your XML you did not use:

Code: [Select]
resource-producer-units
Please use that tag for resource producers.

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #7 on: 1 August 2013, 21:42:48 »
The AI behaves a lot different now in general. We should discuss this as it had more effects than expected.

for example:
Roman AI players build no or much less air defense buildings
Egypt mega AI builds much too much farms
Norsemen builds less trees
...( and maybe more )
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #8 on: 10 August 2013, 07:08:13 »
I have made some code changes in svn, but STILL you need to add some AI behavior tags for Alliance. Why? Because by default the min static resource value for a static resource is 20. To 'build' (not produce or morph) a resource bearing unit with minimum counts the way you want, you have two options in the ai-behavior xml section:

#1) This will tell the engine to BUILD a minimum of this many resource based units

                <resource-producer-units>
                        <unit name="warehouse" minimum="25"/>
                </resource-producer-units>

#2) This will tell the engine to BUILD resource based units unit this minimum amount of the static resource is reached

                <static-values>
                        <static type-name="MinStaticResourceCount" value="200"/>
                </static-values>


Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #9 on: 10 August 2013, 13:31:21 »
Edit:I tried out on latest test build, but honestly all is the same. Even with the changes to the static values the Ai does not function. Only change is instead of building 5 warehouses now AI produces 25 warehouses. I think i may not have been clear, the issue is not how many is built its that its is the ONLY thing the AI builds. Ai does NOT produce warriors, does NOT create structures that upgrade or produces units, and does NOT build base defenses. Just builds as many warehouses as it can to reach its quota than does nothing but collect resources.

Personally I don't think the issue can simply be solved by Ai behavior tags.  Honestly the Ai, even with the default values and with no Ai Behavior tags, functioned just fine until the 3.8.0 beta and beyond.

Note recently played Mr War's Sci Fi pack (downloaded via mod menu) on MG 3.8.0 beta and the Ai also shared similar issues as well.
« Last Edit: 10 August 2013, 14:40:37 by Ishmaru »
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #10 on: 10 August 2013, 16:39:15 »
Ishmaru probably writes about the two problems
1. with that AI builds too many "farms, etc." and this is a known problem,

2. but simultaneously the point is that the AI ​​can sometimes get stuck for a long time and don't build absolutely nothing or just only "farms" and "main buildings",

I personally saw such a case during AI behavior tests settings, here you can for e.g. do a mistake (force a bug) relies on that if you set a requirement to maintain a certain number of units with "high reguirements" of production (which are not met fast when game started) then AI completely go crazy.

I do not remember idealy details, but this bug can be very easily invoke in the following way.
For example, on the e.g. Indians. This setting is ok:
Code: [Select]
<warrior-units>
           <unit name="stick_fighter" minimum="5"/>
</warrior-units>

and these will most likely will result in getting AI stuck:
Code: [Select]
<warrior-units>
           <unit name="stick_fighter" minimum="5"/>
           <unit name="shaman" minimum="10"/>
</warrior-units>
because AI tries to immediately produce shamans when doesn't have yet for this reguired buildings and made upgrades.

If will be such that the AI begins to produce shamans only when it has the possibility and previously just ignore this entry it would be perfect in my opinion.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #11 on: 10 August 2013, 18:16:25 »
I can't help but feel that in this case, the use of the AI behavior tags should be necessary. The AI worked fine with Annex in previous versions of MegaGlest until some change in the engine broke it. Shouldn't finding this change be the solution instead of dancing around the problem with AI behavior tags?
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

filux

  • MegaGlest Team
  • Draco Rider
  • ********
  • Posts: 310
  • was OpenSuse x64, is Debian testing x64
    • View Profile
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #12 on: 10 August 2013, 18:56:30 »
...Shouldn't finding this change be the solution ...

Yes but those changes are probably the changes in the AI which have gone in the right direction such as bug fixing of "dying of hunger" so I think the withdrawal isn't an serious option.

From my point of view we just need find and correct additionaly these problems which have revealed later.

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #13 on: 10 August 2013, 20:08:39 »
Ishmaru probably writes about the two problems
1. with that AI builds too many "farms, etc." and this is a known problem,

2. but simultaneously the point is that the AI ​​can sometimes get stuck for a long time and don't build absolutely nothing or just only "farms" and "main buildings",

I personally saw such a case during AI behavior tests settings, here you can for e.g. do a mistake (force a bug) relies on that if you set a requirement to maintain a certain number of units with "high reguirements" of production (which are not met fast when game started) then AI completely go crazy.

I do not remember idealy details, but this bug can be very easily invoke in the following way.
For example, on the e.g. Indians. This setting is ok:
Code: [Select]
<warrior-units>
           <unit name="stick_fighter" minimum="5"/>
</warrior-units>

and these will most likely will result in getting AI stuck:
Code: [Select]
<warrior-units>
           <unit name="stick_fighter" minimum="5"/>
           <unit name="shaman" minimum="10"/>
</warrior-units>
because AI tries to immediately produce shamans when doesn't have yet for this reguired buildings and made upgrades.

If will be such that the AI begins to produce shamans only when it has the possibility and previously just ignore this entry it would be perfect in my opinion.

This still wouldn't explain why AI still only produces warehouses when there is no Ai behavior tags enabled. Also I have to say ever since the Ai tags were introduced many versions ago, they haven't had a big impact to what the Ai does naturally. Which is why I really don't think Ai behaviors aren't a solution.

I'm not saying to revoke the fixes either just find out what else is broke along the way.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #14 on: 12 August 2013, 03:09:52 »
Thanks to filux testing out various ai options, Annex has functioning Ai in latest svn.
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #15 on: 12 August 2013, 09:15:59 »
Can we get more details ?
What did you do ( in the xml ) ?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #16 on: 13 August 2013, 20:33:52 »
Filux Added these AI tags to Alliance,  Shadow now has a similar set as well.

Code: [Select]
<ai-behavior>
<worker-units>
<unit name="worker" minimum="10"/>
</worker-units>
<warrior-units>
<unit name="grunt" minimum="5"/>
<unit name="ifv_rocket" minimum="1"/>
<unit name="harvester" minimum="4"/>
</warrior-units>
<resource-producer-units/>
<building-units>
<unit name="refinery" minimum="1"/>
<unit name="barracks" minimum="1"/>
<unit name="factory" minimum="1"/>
<unit name="warehouse" minimum="2"/>
<unit name="hangar" minimum="1"/>
<unit name="silo" minimum="1"/>
<unit name="tech_lab" minimum="1"/>
</building-units>
<upgrades>
<upgrade name="adv_weapons"/>
</upgrades>
<static-values>
<static type-name="MinStaticResourceCount" value="10"/>
<static type-name="ScoutResourceRange" value="25"/>
<static type-name="MinBuildSpacing" value="3"/>
</static-values>
</ai-behavior>

Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #17 on: 26 August 2013, 15:22:25 »
I just realized that despite AI working (though still not as good as before 3.8.0), these changes to faction xml breaks some things fundamental to Annex.

I didn't realize that in order for AI to work plane_unit resource (aircraft population cap) must be set to 10 from the start which essentially negates the point for that resource to even exist, to limit that resource is to limit 3 aircraft per hangar. Setting default value to 0 (how it should be) causes AI to no longer function, AI just aimlessly collects crystals...

I know MG Development is shorthanded so for now Ill release Annex on 3.7 to not stall MG next release any further, but i really need this fixed after.

Thanks!
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #18 on: 29 August 2013, 22:36:56 »
I reverted the AI-resource behaviour to something we had in january. This should work now, please try it without any extra switches for the AI, just use it the way you did it with 3.7.2
tell me if its fixed now. ( a new exe is still building ... )

The behaviour we had trying to fix starving AI players is still in the code and can be enabled with a bool switch in the ini file called:  NewResourceBehaviour=true
« Last Edit: 30 August 2013, 09:36:54 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #19 on: 30 August 2013, 00:08:21 »
thanks titi will definitely try this out tommrow!
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: Ai does not work for annex in 3.8.0 Beta 1
« Reply #20 on: 31 August 2013, 00:32:32 »
Tested and works! Thanks!
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer