Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: Addressing the AI Precursor Bug

  1. #1
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Addressing the AI Precursor Bug

    This is a pretty quick tutorial, just explaining a concept.
    Some of you may have encountered the endless AI loop with 'reloading' after the AI suddenly switches into a from a fighting state with an enemy into a reloading state for no apparent reason.

    Instead of having to be stuck with this bug you can do something else in the export_descr_unit.
    It requires two things

    1) the cannot_skirmish attribute
    2) thrown after stat_pri_attr instead of prec

    Code:
    ; COMMENTS              First Cohors Reformata (Post-Marian Legionary First Cohort) / Unit ID 193 / Start exp: 0 / Refr rate: 0,048 / Pool cap: 6
    type                    roman infantry reformata first
    dictionary              roman_infantry_reformata_first
    category                infantry
    class                   heavy
    voice_type              General
    accent                  Roman_Latin
    banner faction          main_infantry
    banner holy             crusade
    soldier                 Marian_First_Cohort, 96, 0, 1.25, 0.3
    officer                 officer_roman_marian
    officer                 officer_roman_aquilifer
    officer					officer_roman_legion_vexillarius
    attributes              sea_faring, hide_forest, hardy, can_withdraw, command, cannot_skirmish
    move_speed_mod          0.83
    formation               0.89, 1.19, 2.7, 2.7, 4, square
    stat_health             1, 5
    stat_pri                20, 0, pilum, 60, 2, thrown, missile_mechanical, piercing, none, 0, 1
    stat_pri_attr           thrown
    stat_sec                10, 5, no, 0, 0, melee, melee_blade, piercing, sword, 0, 1
    stat_sec_attr           no
    stat_pri_armour         9, 6, 9, metal
    stat_sec_armour         0, 0, flesh
    stat_heat               3
    stat_ground             -1, -3, -3, -5
    stat_mental             7, disciplined, highly_trained
    stat_charge_dist        14
    stat_fire_delay         0
    stat_food               60, 300
    stat_cost               1, 2500, 625, 81, 591, 2500, 6, 625
    stat_stl                9
    armour_ug_levels        0
    armour_ug_models        Marian_First_Cohort
    ownership               f_rome, f_carthage, f_makedonia, f_epeiros, f_kh, f_seleukid, f_ptolemaioi, f_baktria, f_hayasdan, f_pontos, f_parthia, f_aedui, f_arverni, f_casse, f_lusotannan, f_sweboz, f_getai, f_saba, f_saka, f_sauromatae, f_numidia, f_pergamon, f_gandhara, f_lugia, f_bosporan, f_arevaci, f_boii, f_nabatu, slave, f_bellouakoi
    era 0                   f_rome
    era 1                   f_rome
    era 2                   f_rome, f_carthage, f_makedonia, f_epeiros, f_kh, f_seleukid, f_ptolemaioi, f_baktria, f_hayasdan, f_pontos, f_parthia, f_aedui, f_arverni, f_casse, f_lusotannan, f_sweboz, f_getai, f_saba, f_saka, f_sauromatae, f_numidia, f_pergamon, f_gandhara, f_lugia, f_bosporan, f_arevaci, f_boii, f_nabatu
    info_pic_dir            f_all
    card_pic_dir            f_all
    recruit_priority_offset 50

    Note you will be able to give the fake precursor units as many javelins as you want and they will use their javelins in a relatively realistic and effective manner. *Although the play testers/game mechanics team which tested this were not using vanilla/other AI files. So I am not sure whether it will be the same unless you use the BAI located in the Skynet AI resource.

    In any case, this was the solution that I came up with to help cut down on the behaviour we were having in EBII, hopefully it helps others as well with this issue. They're all very excited and happy with the results (especially getting to add more than one javelin/pilum, instead of the previous limit of just 1), so hopefully some of you will be as well.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  2. #2
    GRANTO's Avatar Domesticus
    Join Date
    Dec 2010
    Location
    glastonbury uk
    Posts
    2,207

    Default Re: Addressing the AI Precursor Bug

    Quote Originally Posted by z3n View Post
    This is a pretty quick tutorial, just explaining a concept.
    Some of you may have encountered the endless AI loop with 'reloading' after the AI suddenly switches into a from a fighting state with an enemy into a reloading state for no apparent reason.

    Instead of having to be stuck with this bug you can do something else in the export_descr_unit.
    It requires two things

    1) the cannot_skirmish attribute
    2) thrown after stat_pri_attr instead of prec

    Code:
    ; COMMENTS              First Cohors Reformata (Post-Marian Legionary First Cohort) / Unit ID 193 / Start exp: 0 / Refr rate: 0,048 / Pool cap: 6
    type                    roman infantry reformata first
    dictionary              roman_infantry_reformata_first
    category                infantry
    class                   heavy
    voice_type              General
    accent                  Roman_Latin
    banner faction          main_infantry
    banner holy             crusade
    soldier                 Marian_First_Cohort, 96, 0, 1.25, 0.3
    officer                 officer_roman_marian
    officer                 officer_roman_aquilifer
    officer                    officer_roman_legion_vexillarius
    attributes              sea_faring, hide_forest, hardy, can_withdraw, command, cannot_skirmish
    move_speed_mod          0.83
    formation               0.89, 1.19, 2.7, 2.7, 4, square
    stat_health             1, 5
    stat_pri                20, 0, pilum, 60, 2, thrown, missile_mechanical, piercing, none, 0, 1
    stat_pri_attr           thrown
    stat_sec                10, 5, no, 0, 0, melee, melee_blade, piercing, sword, 0, 1
    stat_sec_attr           no
    stat_pri_armour         9, 6, 9, metal
    stat_sec_armour         0, 0, flesh
    stat_heat               3
    stat_ground             -1, -3, -3, -5
    stat_mental             7, disciplined, highly_trained
    stat_charge_dist        14
    stat_fire_delay         0
    stat_food               60, 300
    stat_cost               1, 2500, 625, 81, 591, 2500, 6, 625
    stat_stl                9
    armour_ug_levels        0
    armour_ug_models        Marian_First_Cohort
    ownership               f_rome, f_carthage, f_makedonia, f_epeiros, f_kh, f_seleukid, f_ptolemaioi, f_baktria, f_hayasdan, f_pontos, f_parthia, f_aedui, f_arverni, f_casse, f_lusotannan, f_sweboz, f_getai, f_saba, f_saka, f_sauromatae, f_numidia, f_pergamon, f_gandhara, f_lugia, f_bosporan, f_arevaci, f_boii, f_nabatu, slave, f_bellouakoi
    era 0                   f_rome
    era 1                   f_rome
    era 2                   f_rome, f_carthage, f_makedonia, f_epeiros, f_kh, f_seleukid, f_ptolemaioi, f_baktria, f_hayasdan, f_pontos, f_parthia, f_aedui, f_arverni, f_casse, f_lusotannan, f_sweboz, f_getai, f_saba, f_saka, f_sauromatae, f_numidia, f_pergamon, f_gandhara, f_lugia, f_bosporan, f_arevaci, f_boii, f_nabatu
    info_pic_dir            f_all
    card_pic_dir            f_all
    recruit_priority_offset 50

    Note you will be able to give the fake precursor units as many javelins as you want and they will use their javelins in a relatively realistic and effective manner. *Although the play testers/game mechanics team which tested this were not using vanilla/other AI files. So I am not sure whether it will be the same unless you use the BAI located in the Skynet AI resource.

    In any case, this was the solution that I came up with to help cut down on the behaviour we were having in EBII, hopefully it helps others as well with this issue. They're all very excited and happy with the results (especially getting to add more than one javelin/pilum, instead of the previous limit of just 1), so hopefully some of you will be as well.
    Great work Z3n , that always bugged me in a few mods.

  3. #3
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Prec attribute confirmed works for cavalry (disables skirmish mode by itself without cannot_skirmish). Unit throws projectiles while running to enemy and charge without any additional animations or stooping.

    In another hand it finally proves that prec is not functional for infantry.
    Last edited by bitterhowl; May 13, 2019 at 12:11 AM.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  4. #4

    Default Re: Addressing the AI Precursor Bug

    Quote Originally Posted by bitterhowl View Post
    Prec attribute confirmed works for cavalry (disables skirmish mode by itself without cannot_skirmish). Unit throws projectiles while running to enemy and charge without any additional animations or stooping.

    In another hand it finally proves that prec is not functional for infantry.
    Sorry, in what respect is prec "not functional for infantry"? We're using it and it does exactly what you'd expect - units throw javelins then charge. They also behave much better than they do without it, insofar as actually performing charges.

  5. #5
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: Addressing the AI Precursor Bug

    Quote Originally Posted by QuintusSertorius View Post
    Sorry, in what respect is prec "not functional for infantry"? We're using it and it does exactly what you'd expect - units throw javelins then charge. They also behave much better than they do without it, insofar as actually performing charges.
    I believe what he refers to is the endless "reloading" loop which occurs when units have the prec attribute.
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  6. #6
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Does prec by itself disable skirmish mode in infantry units?

    This thread OP is about removing prec.
    Last edited by bitterhowl; May 14, 2019 at 12:07 AM.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  7. #7

    Default Re: Addressing the AI Precursor Bug

    Quote Originally Posted by bitterhowl View Post
    Does prec by itself disable skirmish mode in infantry units?
    No, but frankly that's a trivial matter given all you need to do is give them cannot_skirmish.

    Quote Originally Posted by bitterhowl View Post
    This thread OP is about removing prec.
    The only reason to remove it was to address the freezing bug - which in fact is mostly resolved by giving the unit 2 missiles. Removing prec causes a much worse problem than freezing, namely that charges don't work at all without it.

  8. #8
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Code:
    type roman infantry principes camillan
    dictionary roman_infantry_principes_camillan
    category infantry
    class spearmen
    voice_type General
    accent Roman_Latin
    banner faction main_spear
    banner holy crusade
    soldier Principes_Camillan, 64, 0, 1.1, 0.25
    officer officer_roman_camillan
    officer officer_roman_principes_sb
    attributes sea_faring, hide_forest, free_upkeep_unit, can_withdraw, cannot_skirmish
    move_speed_mod 0.83
    formation 0.9, 0.9, 0.9, 1.8, 8, square
    stat_health 1, 5
    stat_pri 20, 0, pilum, 60, 2, thrown, missile_mechanical, piercing, none, 0, 1
    stat_pri_attr thrown
    stat_sec 8, 4, no, 0, 0, melee, melee_simple, piercing, spear, 0, 1
    stat_sec_attr light_spear, spear_bonus_4
    stat_pri_armour 6, 6, 6, metal
    stat_sec_armour 0, 0, flesh
    stat_heat 3
    stat_ground -1, -3, -3, -5
    stat_mental 6, disciplined, highly_trained
    stat_charge_dist 14
    stat_fire_delay 0
    stat_food 60, 300
    stat_cost 1, 1650, 309, 82, 165, 1650, 6, 309
    stat_stl 9
    armour_ug_levels 0
    armour_ug_models Principes_Camillan
    ownership f_rome, f_carthage, f_makedonia, f_epeiros, f_kh, f_seleukid, f_ptolemaioi, f_baktria, f_hayasdan, f_pontos, f_parthia, f_aedui, f_arverni, f_casse, f_lusotannan, f_sweboz, f_getai, f_saba, f_saka, f_sauromatae, f_numidia, f_pergamon, f_gandhara, f_lugia, f_bosporan, f_arevaci, f_boii, f_nabatu, slave, f_belgai
    era 0 f_rome
    ;era 1 f_rome
    ;era 2 f_rome
    info_pic_dir f_all
    card_pic_dir f_all
    recruit_priority_offset 60
    I made many experiments in my own Westeros mod and find that charge is possible when after throwing unit situated in charge distance area. You have 60 and 14 here, also you got perfect throwing animation, when unit runs towards the enemy, so become closer after throwing. I use your animation and have 45 and 35 distance - and unit charges just fine. In my mod - with prec reloading bug persisted until I did as OP says.

    "Quod hominem tot sententiae", everyone has it's own mod, I'm just sharing my experience. With cavalry prec I saw how should it be ideally with infantry, but it doesn't (in my mod).

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  9. #9

    Default Re: Addressing the AI Precursor Bug

    Quote Originally Posted by bitterhowl View Post
    Code:
    type roman infantry principes camillan
    dictionary roman_infantry_principes_camillan
    category infantry
    class spearmen
    voice_type General
    accent Roman_Latin
    banner faction main_spear
    banner holy crusade
    soldier Principes_Camillan, 64, 0, 1.1, 0.25
    officer officer_roman_camillan
    officer officer_roman_principes_sb
    attributes sea_faring, hide_forest, free_upkeep_unit, can_withdraw, cannot_skirmish
    move_speed_mod 0.83
    formation 0.9, 0.9, 0.9, 1.8, 8, square
    stat_health 1, 5
    stat_pri 20, 0, pilum, 60, 2, thrown, missile_mechanical, piercing, none, 0, 1
    stat_pri_attr thrown
    stat_sec 8, 4, no, 0, 0, melee, melee_simple, piercing, spear, 0, 1
    stat_sec_attr light_spear, spear_bonus_4
    stat_pri_armour 6, 6, 6, metal
    stat_sec_armour 0, 0, flesh
    stat_heat 3
    stat_ground -1, -3, -3, -5
    stat_mental 6, disciplined, highly_trained
    stat_charge_dist 14
    stat_fire_delay 0
    stat_food 60, 300
    stat_cost 1, 1650, 309, 82, 165, 1650, 6, 309
    stat_stl 9
    armour_ug_levels 0
    armour_ug_models Principes_Camillan
    ownership f_rome, f_carthage, f_makedonia, f_epeiros, f_kh, f_seleukid, f_ptolemaioi, f_baktria, f_hayasdan, f_pontos, f_parthia, f_aedui, f_arverni, f_casse, f_lusotannan, f_sweboz, f_getai, f_saba, f_saka, f_sauromatae, f_numidia, f_pergamon, f_gandhara, f_lugia, f_bosporan, f_arevaci, f_boii, f_nabatu, slave, f_belgai
    era 0 f_rome
    ;era 1 f_rome
    ;era 2 f_rome
    info_pic_dir f_all
    card_pic_dir f_all
    recruit_priority_offset 60
    I made many experiments in my own Westeros mod and find that charge is possible when after throwing unit situated in charge distance area. You have 60 and 14 here, also you got perfect throwing animation, when unit runs towards the enemy, so become closer after throwing. I use your animation and have 45 and 35 distance - and unit charges just fine. In my mod - with prec reloading bug persisted until I did as OP says.

    "Quod hominem tot sententiae", everyone has it's own mod, I'm just sharing my experience. With cavalry prec I saw how should it be ideally with infantry, but it doesn't (in my mod).
    What we found with prec removed was that units would run up, stop a short distance away, switch weapons from their javelins and have no momentum whatsoever left in making the charge.

    Does a longer charge distance remove the issue with weapon-switching, because it happens further out?

  10. #10
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Got fresh news about prec/thrown (fresh for me, didn't noticed that before) - prec unit has "fire_at_will" button disabled by default, when prec changed to thrown "fire_at_will" enables back by default.

    As for charge_distance, I set it to high numbers according to an old Rome tutorial, and noticed strange thing with missile infantry - they switched to secondary wearpon and stopped firing while enemy was on charge distance area. I spent some time before find out what happened. Also knight charge was broken with charge_distance 145 - they swithed to secondary just before enemy instead continuing lance strike. Charge_distance lower 70 healed that for knights in my case.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  11. #11

    Default Re: Addressing the AI Precursor Bug

    Interesting; we used short charge distance, because that seems to result in better cohesion.

  12. #12
    Razor's Avatar Licenced to insult
    Join Date
    Apr 2004
    Location
    Deventer, The Netherlands
    Posts
    4,075

    Default Re: Addressing the AI Precursor Bug

    Ok, so what's the update on this issue? This back and forth between you two is all a bit confusing to me.

  13. #13
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug


    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  14. #14
    Razor's Avatar Licenced to insult
    Join Date
    Apr 2004
    Location
    Deventer, The Netherlands
    Posts
    4,075

    Default Re: Addressing the AI Precursor Bug

    Ah, so no definite conclusions as of yet. Thanks for the link.

    I see that this is being tested with the EBII mod. I'm curious to see if we can get similar results on vanilla M2TW without the (IMO annoying) throwing animation of EBII which causes units to move forward.

  15. #15
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Without EB2 animation we should make throw distance even less (about 35) and charge distance about 25 - now we just wait for enemies that comes closer during their attack. Don't forget about cannot_skirmish attribute. I did prec effect like this for my mod before adding new animation.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  16. #16

    Default Re: Addressing the AI Precursor Bug

    The testing we're doing in EBII is on charge distances, not the presence/absence of prec.

  17. #17
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Well, seems I got some progress here. My Ironbors fire their axes then run to enemy, no manually scripted behavior.

    https://youtu.be/fMVX-70_hwo

    Just copied Rome I EDU settings for pilum unit, + set horde instead square (in square sometimes only first line fought in melee, and back tryed to fire volleys and only then fight).

    Spoiler Alert, click show to read: 
    type Dismounted Huscarls
    dictionary Dismounted_Huscarls ; Warriors
    category infantry
    class heavy
    voice_type Heavy
    banner faction main_infantry
    banner holy crusade
    soldier Dismounted_Huscarls, 48, 0, 1
    attributes sea_faring, hide_forest, very_hardy, can_withdraw, frighten_foot, frighten_mounted, ;cannot_skirmish
    move_speed_mod 1.1
    formation 1.2, 1.2, 2.4, 2.4, 4, horde
    stat_health 1, 3
    stat_pri 11, 1, iron_axe, 35, 2, thrown, missile_mechanical, slashing, axe, 35, 1
    stat_pri_attr prec, thrown, ap, launching
    stat_sec 5, 3, no, 0, 0, melee, melee_blade, slashing, axe, 25, 1
    stat_sec_attr ap
    stat_pri_armour 4, 10, 4, metal
    stat_sec_armour 0, 0, flesh
    stat_heat 4
    stat_ground 2, -4, 0, 0
    stat_mental 7, impetuous, untrained
    stat_charge_dist 30
    stat_fire_delay 5000
    stat_food 60, 300
    stat_cost 1, 850, 175, 290, 70, 850, 4, 170
    armour_ug_levels 2, 3, 4
    armour_ug_models Dismounted_Huscarls, Dismounted_Huscarls_ug1, Dismounted_Druchima_ug1, ;Norse_Swordsmen_ug2
    ownership hre, slave
    era 0 hre
    recruit_priority_offset 8


    When I set only prec without thrown first throw was correct, then unit ran to enemy but then I mentioned that back lines stood still with constant "reloading" mark, so unit was uneffective in close combat. I already wanted to leave prec mechanics but then made last try to copy Rome I EDU. Made about 10 tests, everything works as on video.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  18. #18

    Default Re: Addressing the AI Precursor Bug

    That seems great Bitter, +1 rep from me. I will test that myself today!

  19. #19

    Default Re: Addressing the AI Precursor Bug

    Indeed, I have just confirmed what bitterhowl said, setting horde instead of square completely fixes the issue with infantry charges.
    I tested it several times with 6 units vs 6 units in which half had a horde formation and the other half had square formation (3 squares and 3 hordes vs 3 squares and 3 hordes).
    Time and time again the units with the square formation charged incorrectly or badly, sometimes they didn't charge at all. The units with horde always charged correctly at the enemy units. The only issue I could report is that when running at the enemy the units would get behind the leaders and would divide in corridors which would leave some spaces open but that was really temporary. They also seem to penetrate more on the enemy unit and try to surround them more.

  20. #20
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Addressing the AI Precursor Bug

    Well, have to say that once again I made my common mistake - posting before fully testing. So, in a battle 1 on 1 everything works as on video. When we have more units reload bug appears again, it has no system, sometimes units fight as they should after throwing, sometimes they just constantly reload even being surrounded by player's units. I changed this line from 40

    <heavy-infantry>
    <max-engage-dist>70</max-engage-dist>
    </heavy-infantry>

    And units act more adequate. When I set EDU as in OP everything work just fine without any reloads, but no prec charge on enemy, as you understand. Need more ingame experience with that to close this theme.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •