Announcement

Collapse
No announcement yet.

Calling all Mathematicians!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling all Mathematicians!

    I am in need of some help.

    I have been interested in using improper values in the rules.txt since I found that costless units glitch. What I seem to have done is to *almost* circumvent the stupid role problem with civ.

    You know, the one where even when the AI should be able to build a unit (techwise), the unit does not appear in the build list because it is fooled into thinking there is a better one out there. I don't particularly know the forumla, but I saw it posted the other day...

    What I have done is to first load up the game and see which units the AI has trouble building based on stats alone. This turns out to be many of the armour and sp arty in the game. Then I went in and added a role value greater then 0-7 and wouldn't you know they begin to appear in the AI build lists!

    I set all of the human player's taks to a role value of 19, a role unique to the German tanks. One by one I adjusted some stats and have mabaged to get all of the units desired to show up in build lists. This is great because I am using lots of simmilar type units wich should be canceling one another out.

    I saved and let the AI have a turn at building these units and to my dismay, both the soviets and Americans lose their entire unit build lists (though the game continues to function)! A bit of frustration insued, but I patienly tinkered with the soviet units such that they can indeed withstand a turn inthe build list of the AI. The British have no issues, and all of their desired units remain in the build list at all times. The German human player has no issue of course either.

    Now all I am stuck on is the pesky Americans. Their units are wiped from the build list after one turn of movement and for the life of me, I cannot get them to stay.

    I am not a mathematical person, so i am trial and erroring my way through this. Could any of you mathermaticians see a pattern involved in this and perhaps off me a suggestion? Perhaps a new set of rules can be established that could let us easily bypass this annoying AI trait of losing buildable units? It would truly be a blessing for those who'd like to have armour heavy scenarios.

    Here is the section of the rules.txt that is need for futher examination of this issue. I will also attatch the rules file in case any of you would like to play around.

    @UNITS
    G.I.'s, X1, 0, 1.,0, 7a,6d, 1h,1f, 2,0, 0, nil, 100100001000001
    Infantry, X7, 0, 1.,0, 7a,6d, 1h,1f, 2,0, 0, nil, 100100001000001
    Landser, X6, 0, 1.,0, 4a,5d, 1h,1f, 3,0, 1, nil, 100100001000000
    Red Army, X3, 0, 1.,0, 5a,5d, 1h,1f, 1,0, 0, nil, 100000001000001
    Jalkaväki, U3, 0, 1.,0, 7a,5d, 1h,1f, 1,0, 0, nil, 100000001000001
    Soldati, X4, 0, 1.,0, 5a,4d, 1h,1f, 3,0, 0, nil, 100000001000000
    Impassable Border,nil, 0, 0.,0, 1a,75d, 9h,1f, 1,0, 1, no, 000000000000000
    PzKw VI auf B, no, 0, 2.,0, 15a,9d, 3h,3f, 30,0, 19, no, 100000000000001
    Jagdpanzer V, X6, 0, 2.,0, 15a,6d, 3h,2f, 6,0, 19, nil, 100000000000000
    PzKw VI, X6, 0, 2.,0, 13a,7d, 3h,2f, 7,0, 19, nil, 100000000000000
    Kv-1, X3, 0, 2.,0, 14a,9d, 3h,2f, 5,0, 0, nil, 100000000000001
    Sherman Firefly, X7, 0, 3.,0, 15a,6d, 3h,2f, 4,0, 3, nil, 100000000000001
    Su-152, X3, 0, 2.,0, 18a,8d, 3h,2f, 4,0, 0, nil, 100000000000001
    M-10, X1, 0, 2.,0, 18a,5d, 3h,3f, 4,0, 17, nil, 100000000000001
    Achilles, X7, 0, 2.,0, 18a,5d, 3h,3f, 4,0, 10, nil, 100000000000001
    T-34, X3, 0, 3.,0, 11a,7d, 3h,2f, 3,0, 16, nil, 100000000000011
    M4A3 Sherman, X1, 0, 3.,0, 15a,6d, 3h,2f, 4,0, 8, nil, 100000000000001
    Katyushas, X3, 0, 3.,0, 14a,4d, 2h,3f, 4,0, 0, nil, 100000001000001
    StugG III, X2, 0, 3.,0, 10a,5d, 3h,2f, 4,0, 18, nil, 100000000000000
    Hetzer 38t, no, 0, 3.,0, 10a,5d, 3h,2f, 1,0, 10, no, 100000000000000
    Cruiser Mk VI, X7, 0, 2.,0, 11a,6d, 3h,2f, 3,0, 13, nil, 100000000000001
    Churchill, X7, 0, 2.,0, 13a,6d, 3h,2f, 4,0, 8, nil, 100000000000001
    Sexton, X7, 0, 2.,0, 14a,4d, 2h,3f, 4,0, 9, nil, 100000001000001
    Is-2, X3, 0, 2.,0, 18a,11d, 4h,3f, 6,0, 1, nil, 100000000000001
    105mm Hummel, X6, 0, 2.,0, 12a,3d, 2h,3f, 6,0, 19, nil, 100000001000001
    Priest, X1, 0, 2.,0, 14a,4d, 2h,3f, 4,0, 15, nil, 100000001000001
    150mm Long Tom, X1, 0, 2.,0, 16a,4d, 3h,4f, 6,0, 11, nil, 100000001000001
    Me 262, X6, 1, 8.,1, 14a,5d, 2h,2f, 10,0, 3, Gen, 110000000010001
    Lancaster, X5, 1, 15.,3, 14a,4d, 2h,3f, 8,0, 0, nil, 100000000000001
    Halifax, X5, 1, 15.,3, 13a,4d, 2h,3f, 7,0, 0, nil, 100000000000001
    Supermarine Spitfire, X7, 1, 13.,1, 9a,4d, 2h,2f, 6,0, 3, Gen, 100000000010001
    B-17 G, X5, 1, 15.,3, 14a,4d, 2h,3f, 9,0, 0, nil, 100000000000001
    B-24 Liberator, X5, 1, 15.,3, 13a,4d, 2h,3f, 8,0, 0, nil, 100000000000001
    P-51 Mustang, X5, 1, 15.,3, 1a,4d, 2h,3f, 7,0, 0, Too, 100000000010001
    P-47 Thunderbolt,X1, 1, 15.,1, 12a,2d, 3h,3f, 6,0, 0, nil, 100000000000001
    Il-2 Sturmovik, X3, 1, 13.,1, 12a,5d, 3h,3f, 6,2, 0, nil, 100000000000001
    Macchi C200, X4, 1, 8.,2, 8a,4d, 2h,2f, 5,0, 3, nil, 100000000010001
    Battleship, nil, 2, 12.,0, 14a,10d, 5h,5f, 17,0, 2, Eng, 100000000001001
    Heavy Cruiser, nil, 2, 15.,0, 10a,8d, 4h,2f, 15,0, 2, Eng, 100000000001001
    Destroyer, nil, 2, 18.,0, 8a,6d, 3h,1f, 12,1, 2, Feu, 100000000000001
    Type-XXI U-Boat, X6, 2, 5.,0, 12a,3d, 3h,2f, 10,0, 2, X5, 100000000001000
    Bf 109, X2, 1, 9.,1, 10a,4d, 2h,2f, 6,0, 3, nil, 100000000010001
    Fw190, X6, 1, 10.,1, 11a,5d, 2h,2f, 7,0, 3, nil, 100000000010001
    Landing Crafts, nil, 2, 6.,0, 0a,4d, 2h,1f, 5,8, 4, nil, 100000000000001
    Army Rangers, X1, 0, 1.,0, 7a,7d, 2h,1f, 4,0, 0, nil, 100001001000111
    Paratroops, X7, 0, 1.,0, 7a,6d, 2h,1f, 4,0, 0, nil, 100000101000011
    Combat Engineers,X1, 0, 1.,0, 7a,6d, 2h,1f, 3,0, 0, nil, 100100001000001
    Heavy Infantry, X7, 0, 1.,0, 7a,6d, 2h,1f, 3,0, 0, nil, 100100001000001
    Schwere Truppen, X6, 0, 1.,0, 7a,6d, 2h,1f, 4,0, 0, nil, 100000001000001
    Critical Supplies, X6, 0, 2.,0, 0a,4d, 2h,1f, 4,0, 7, nil, 100000000000000
    Airborne, X1, 0, 1.,0, 7a,6d, 2h,1f, 4,0, 0, nil, 100000101000011
    Red Guards, X3, 0, 1.,0, 8a,6d, 2h,1f, 3,0, 0, nil, 100100001000011
    88mm MP Gun, X6, 0, 2.,0, 9a,6d, 3h,2f, 5,0, 0, nil, 100000000000000
    PzKw V, X6, 0, 3.,0, 11a,8d, 3h,2f, 7,0, 19, nil, 100000000000000
    SdKfz-251, X6, 0, 3.,0, 5a,6d, 2h,1f, 5,0, 10, nil, 100000000000001
    Motorized Troops, X3, 0, 3.,0, 6a,6d, 2h,1f, 3,0, 2, nil, 100000000000001
    Mechanized Inf., X1, 0, 3.,0, 6a,6d, 2h,1f, 3,0, 14, nil, 100000000000001
    Bren Gun Carrier, X7, 0, 3.,0, 6a,6d, 2h,1f, 3,0, 14, nil, 100000000000001
    Sturmtruppen, X6, 0, 1.,0, 8a,6d, 2h,1f, 3,0, 0, nil, 100001001000011
    PzKw IV, X6, 0, 3.,0, 10a,7d, 3h,2f, 6,0, 19, nil, 100000000000000
    Volksturm, X6, 0, 2.,0, 9a,6d, 1h,4f, 2,0, 0, nil, 101110000000010
    Nebelwerfer, X6, 0, 2.,0, 14a,2d, 2h,3f, 4,0, 0, nil, 100000000000001


    Hopefuly we can get somethign going here that works out. Oh also, during the turn of play I let the AI have, even the units with bizzare entires for roles attacked and defended as though they were normal units...

    Thanks.
    Attached Files

  • #2
    I wouldn't be the one to know if roles are stores in a byte or a double word or a whatever.

    Have you tried 24, 32, etc?
    Blog | Civ2 Scenario League | leo.petr at gmail.com

    Comment


    • #3
      Just tried 24, 32 and even 256... same thing, ami's list gets wiped.

      Comment


      • #4
        I tested the AI-won't-build-this-unit effect extensively 1 1/2 years ago and came to the following results (of which 1. and 2. differ from the Sleague tip - might be version dependent). I basically found 3 rules:

        1. (applies to both human and AI civs)
        If a civ owns the tech in the gunpowder-slot (Gun), it will lose the ability to build units with role 1 having a defense less than the unit in the musketeer slot. (Note: It's irrelevant which units are made available by the tech Gun; in the tip it says "The game will not let any nation (computer- or player-controlled) build any unit other than the one in the musketeer slot if it can be built or if a nation controls just one such unit!" which doesn't seem to apply).

        2. (applies to both human and AI civs)
        If a civ owns the prerequisite for the unit in the knight slot (not necessarily in the chivalry slot!) it won't be able to build any units which meet the following requirements:
        role=0 AND move=2 AND attack value worse than the unit in the knight slot AND defense value worse than the unit in the knight slot

        3. (applies only to AI civs)
        (you wanted a mathematical answer?)
        Define a equivalence relation as follows: We say two units belong to the same equivalence class if they have the same role and have either both 1 movement or both a movement factor >1 (domain and anything other don't count).

        The AI will only build units which are
        a) among the best attackers of all available units of their equivalence class. ("among the best" meaning: they all share the same attack value)
        or
        b) among the best defenders of all available units of their equivalence class
        Civilization Webring Forum

        Comment


        • #5
          Originally posted by SCDARS
          I tested the AI-won't-build-this-unit effect extensively 1 1/2 years ago and came to the following results (of which 1. and 2. differ from the Sleague tip - might be version dependent). I basically found 3 rules:

          1. (applies to both human and AI civs)
          If a civ owns the tech in the gunpowder-slot (Gun), it will lose the ability to build units with role 1 having a defense less than the unit in the musketeer slot. (Note: It's irrelevant which units are made available by the tech Gun; in the tip it says "The game will not let any nation (computer- or player-controlled) build any unit other than the one in the musketeer slot if it can be built or if a nation controls just one such unit!" which doesn't seem to apply).
          Okay, I have of course avoided gunpowder tech slot so no civs have that. No units are set with that as a prereq.

          2. (applies to both human and AI civs)
          If a civ owns the prerequisite for the unit in the knight slot (not necessarily in the chivalry slot!) it won't be able to build any units which meet the following requirements:
          role=0 AND move=2 AND attack value worse than the unit in the knight slot AND defense value worse than the unit in the knight slot
          I have avoided using the knight slot as well. I was planning on being fancy with these 2 slots, making them no no as usual but then granting some to the human through events. Don't know if that'll work, because they will still be unbuildable. That hasnt happened yet, so as far as we're concerned they are both no,no.

          3. (applies only to AI civs)
          (you wanted a mathematical answer?)
          Define a equivalence relation as follows: We say two units belong to the same equivalence class if they have the same role and have either both 1 movement or both a movement factor >1 (domain and anything other don't count).

          The AI will only build units which are
          a) among the best attackers of all available units of their equivalence class. ("among the best" meaning: they all share the same attack value)
          or
          b) among the best defenders of all available units of their equivalence class
          And when you say 'the ai will only build units when...' do you mean it is their 'conscious' choice because they are picked from various units on that AI's unit availability menu, or do you mean that all units fitting the 'wont build' statistical requirements will fall from their list, dissapear?

          If it is the latter, the fact that it slips from their list , then I think I may have found a way to get around that as 5 of the 6 AI's can build units which by your findings should be imposible for them to do.

          It cant be fully tested yet, as I all of the cities in game are empty as far as improvements go, so lots of the AI cities start building improvements right away. I could test it with a different scenario altoghether and just edit it untill its ready to test.

          I just cannot figure out why I have been able to fake the soviets and brit out, while the problem lingers with the americans...

          Comment


          • #6
            Have you tried negative numbers? You'd think it would crash the game, but I hear it works in domain so maybe role can handle it too. I'm not much of a mathematician but it's the best advice I can give. I'm guessing that there are some limitations in your scenario that keep you from giving them roles of 2, 3, and 4? Or does the computer refuse to build land units with a role of 2 or 4?
            1011 1100
            Pyrebound--a free online serial fantasy novel

            Comment


            • #7
              Originally posted by Elok
              Have you tried negative numbers? You'd think it would crash the game, but I hear it works in domain so maybe role can handle it too. I'm not much of a mathematician but it's the best advice I can give.
              I'll try negatives, haven't yet.

              I'm guessing that there are some limitations in your scenario that keep you from giving them roles of 2, 3, and 4? Or does the computer refuse to build land units with a role of 2 or 4?
              well I figured that setting a land unit to air superiority wouldn't be kind to the AI. I haven't been able to see what these higher numbers make the units ingame role actually be, but they do no have commodities nor can they build roads so settler/trade is out.

              Comment


              • #8
                Actually, the AI seems to use Air Superiority units correctly.
                Blog | Civ2 Scenario League | leo.petr at gmail.com

                Comment


                • #9
                  Well, it's not like the AI plans its construction of units all that intelligently anyway; the AI's sloppy determination algorithm is the whole problem here, isn't it? This is just my experience talking, but I find that the computer uses any unit it can in combat situations, and uses role to determine what to build. E.G., if it needs to colonize overseas it builds Role 4s in anticipation of needing to move settlers, but will gladly use role 4s to attack other ships or even conduct shore bombardments should the opportunity arise. And it seems like the crap algorithm would actually protect it from, say, building land units under the mistaken impression that they're designed for ferrying troops, because its protocols seem to treat each domain separately. Actually that might even be beneficial; has anyone tried giving Marine-type units a role of 4? That way, when the computer decides it wants to invade, it will step up production of both Marines and Transports. At least in theory.
                  1011 1100
                  Pyrebound--a free online serial fantasy novel

                  Comment


                  • #10
                    The AI is perfectly capable of using units that are both attack and settler units atleast. This I found out when I accidently set the civ2 catapult to the role of a settler when I was just getting started editing the text files
                    They loved that combined attack and settler unit and would build hordes of them, ICSing like mad and attacking everything in sight.

                    It's the first time I've ever seen the AI build 50+ city empires in a non scenario game.
                    No Fighting here, this is the war room!

                    Comment


                    • #11
                      Right, the thing is even if 1,2.3 and 4 roled units work fine... that still doesnt give me enough room to have all units visable. Trying to queze 20 different armour units into that small restrictive set of roles isnt going to happen without the game diallowing the AI to build 99% of those units.

                      Each civ has ~4 different tanks and a motorized infantry. What Im doing is the only way to get them all to be available for building by the AI.

                      Comment


                      • #12
                        Re: Calling all Mathematicians!

                        Originally posted by Field Marshal Klesh

                        I saved and let the AI have a turn at building these units and to my dismay, both the soviets and Americans lose their entire unit build lists (though the game continues to function)! A bit of frustration insued, but I patienly tinkered with the soviet units such that they can indeed withstand a turn inthe build list of the AI. The British have no issues, and all of their desired units remain in the build list at all times. The German human player has no issue of course either.
                        I ran into to something that sounds vaguely similar a looong time ago and, although I never solved it to satisfaction I did manage to make all units buildable by setting the domain for each and every one to attack.
                        Mixing them up to label defensive units as such, for example, wiped everything.
                        Could you try setting all of your (US) unit roles to attack just to see if they show up?

                        In my case it was only one civs units that disappeared and I wasn't playing around with roles outside of the norm.
                        I think the queues still contained the freight/caravan class from memory though. It was only my combat-oriented units that vanished.

                        Another thought, did you restart the scenario after you'd finished placing units etc, by any chance or just hit return?
                        ie: Are your build queues really active for that first turn or is it just an artifact of the creation process?

                        Comment


                        • #13
                          Re: Re: Calling all Mathematicians!

                          Originally posted by ravagon
                          Could you try setting all of your (US) unit roles to attack just to see if they show up?
                          Sure, I'll give that a shot.


                          Another thought, did you restart the scenario after you'd finished placing units etc, by any chance or just hit return?
                          ie: Are your build queues really active for that first turn or is it just an artifact of the creation process?
                          I saved, and restarted. Each time I checked to see if the queues were there, and they are. Jusging by the fact that most of the civs still have them there after they have a turn seems to me like they are actually there.

                          Comment


                          • #14
                            Have you tried the air superiority (3) role? I use it to make ground units appear on the build queues from time to time.

                            It also has a very beneficial effect on AI unit behaviour. Whereas the '0' role makes the unit roam and attack, often suicidaly, the '3' role makes it roam and only make attacks it has a good chance of winning.

                            It seems to work very well with unique leader type units. In Warlords of China test play, various Warlord, general and military advisor units often last for much of the game even when AI controlled, despte the fact that they are not given overly powerful stats.
                            Tecumseh's Village, Home of Fine Civilization Scenarios

                            www.tecumseh.150m.com

                            Comment


                            • #15
                              Originally posted by Field Marshal Klesh
                              Each civ has ~4 different tanks and a motorized infantry. What Im doing is the only way to get them all to be available for building by the AI.
                              Ahem, I'd hate to spoil the fun here... But do you really need all those tanks anyway? The Achilles and M-10 (which I'm assuming are both American tanks) have exactly the same stats, and the M4A3 Sherman is generally weaker.

                              Even if you get them all on the build list, it's very unlikely the AI will actually go and build them anyway. So what's really the point (apart from trying to be overly historically accurate)?
                              Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)

                              Comment

                              Working...
                              X