Announcement

Collapse
No announcement yet.

Recruiting to do the best AI combat slic handler ever!

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

  • #31
    That a great function, I wish i had it when working with the city expansion. Yet do you have any specific use for it in your slics?
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

    Comment


    • #32
      Originally posted by Pedrunn
      That a great function, I wish i had it when working with the city expansion. Yet do you have any specific use for it in your slics?
      Of course, the thing is the bigger the search area is, the more valuable the function becomes, but also the more time it takes to write the function. I was just testing the premise with these two. There is one in particular I need/want to write to do the stuff I want to do with stacks.

      Comment


      • #33
        Actually the idea is to make the modules first and the correlation later.
        Yeeeas... I have been thinking over the weekend about how best to go about the science module. Other than simply providing the list of advances, a lot of the goal setting depends very very much on the situation.

        Ship Building; Offensive War/Defensive War/Peace advances; I guess a rush to monarchy would be advisable...

        Also, are we going to have this operate at all difficulty levels? Some people might not want a ruthlessly vicious AI
        Concrete, Abstract, or Squoingy?
        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

        Comment


        • #34
          The first part of the code for #3 is done. The AI now build forts!

          This script makes the AI now build forts around its capital city and after it has 6 cities, it begins building forts around its major cities as well. Major cities are defined as the cities in the top 30% in terms of population size.

          Once the AI has determined to build a fort (a random number generator), is chooses a rondom direction (N, S, E, W) to build the fort. It uses the GetTilePoints search in the "NewSearch.slc" file to evaluate the tiles. When it gets a tile it checks if it is a hill or a mountain and prioritizes them to build the fort. Also, it values mountains over hills when building forts. If there is already a fort in that direction (since it's randomly chosen), it does not build another fort.

          The "NewSearch.slc" file must be included either in your script.slc file, or you can open the Stacks.slc file and remove the // in front of the include statement. You must have one, but you can't have both.

          Regarding the GetTilePoints search function, it searches the tiles that are pointed to by the corners of the city's map square, which is rotated to a diamond in CTP2. Look at the next post for an illustration.

          Also, I will post a picture of the AI using the forts.
          Attached Files

          Comment


          • #35
            Here is the photo. Notice the AI has built all of it's forts on mountains, not the nearby hills or the plains.

            Also notice, the AI hasn't got a clue what they are or how to use them! The stacks walk right by them

            On to step two, which will be much more difficult.
            Attached Files

            Comment


            • #36
              This is an illustration of the search. This illustrates a Northward search of the tile. The tile in blue is the city, those in green are the ones that are searched, and grey tiles are not searched. The direction of the search is bottom to top, left to right.
              Attached Files

              Comment


              • #37
                Sweet

                I'll reply here, but possibly a new thread may be useful to keep this discussion (which has a lot of potential to bloom) separate.

                Are you working from the assumption here that forts are always good? If the AI is paying their construction cost, then it begins to edge its way into the PW module.
                [aside] In fact, it'll sit very well within that once the goal of building a fort has been set... [/aside]
                So does the AI really need them all? Depending on how "aware" the AI is, it should probably start building (and manning) them on hot borders, then go on to cold borders (if PW is sufficient) and then into unoccupied space, territory-gap filling, road-bridges and so forth.
                Concrete, Abstract, or Squoingy?
                "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                Comment


                • #38
                  Amazing! Although I share the IW perspective that the forts should be done by the infrastructure module it is great to see you are having a improvemement Since in the othe hand my first attempt for the continent mapping was a failure . But i am a hard to give up kind of guy so i will give a check in my code soon.
                  "Kill a man and you are a murder.
                  Kill thousands and you are a conquer.
                  Kill all and you are a God!"
                  -Jean Rostand

                  Comment


                  • #39
                    forts should be priorizized on hot borders, and even there it is more usefull, to pack them in a way, that few fords block as much potential enemy paths by zoc, even if that sometimes means building a fort on some other terrain than a mountain or hill.

                    Comment


                    • #40
                      Originally posted by Immortal Wombat
                      Sweet

                      I'll reply here, but possibly a new thread may be useful to keep this discussion (which has a lot of potential to bloom) separate.

                      Are you working from the assumption here that forts are always good? If the AI is paying their construction cost, then it begins to edge its way into the PW module.
                      [aside] In fact, it'll sit very well within that once the goal of building a fort has been set... [/aside]
                      So does the AI really need them all? Depending on how "aware" the AI is, it should probably start building (and manning) them on hot borders, then go on to cold borders (if PW is sufficient) and then into unoccupied space, territory-gap filling, road-bridges and so forth.
                      IW, I agree with most of what you say. The assumption is that the AI needs to learn to build stacks of 12 and keep them stationed somewhere waiting for action. rather than just choose a random map point, I want the AI to build forts for this. So this code gets the AI to build forts, so I can work with telling the AI where to send units. The AI may not need them all, but I need them all for now so I can test code. In the picture above the probabilty of fort creation was set incredibly high, so I could make sure it was building them. I set the values lower in the code posted above. Also, I give the AI the PW to build the forts right away instead of asking it to build one later.

                      Since I'm focusing on stack creation not forts, this code will do for now. Later, I'd like to create an array to store the direction of the attacks and the frequency of attacks. More attacks, more forts. More forts in the right direction. Then there must be code so that a city knows if it is a border or not. Also, borders change due to settling and so forth, so the AI should check to see if this is an expanding border (so it should wait until it is no longer expanding in that direction). -- A lot of additional code would be required for that

                      Comment


                      • #41
                        Originally posted by Zaphod Beeblebrox
                        forts should be priorizized on hot borders, and even there it is more usefull, to pack them in a way, that few fords block as much potential enemy paths by zoc, even if that sometimes means building a fort on some other terrain than a mountain or hill.
                        I agree about focusing on hot borders, that will be incorporated into future code. To you second point, the code instructs the AI to build forts on non-hill/mountain squares if it cannot find any hills or mountains in that direction. I guess I should have posted a picture that illustrated that as well, but this was my favorite because I could see that it had skipped over a lot of terrain to find the best spot.

                        the screen shots where the AI just put the fort in the default location, because there were no hills or mountains, didn't seem as interesting.

                        Comment


                        • #42
                          ahenobarb, did you function was tested and is bug-free?

                          I think i may use it in a second attempt to the continent mapping code
                          "Kill a man and you are a murder.
                          Kill thousands and you are a conquer.
                          Kill all and you are a God!"
                          -Jean Rostand

                          Comment


                          • #43
                            Originally posted by Pedrunn
                            ahenobarb, did you function was tested and is bug-free?

                            I think i may use it in a second attempt to the continent mapping code
                            Pedrunn, I have tested the code and it works without any problems. The only question I have remaining is whether or not the mathematics is correct for every square. I want to make sure I didn't type the wrong numbers for some of the locations. Its fairly easy to do that when you have so many different variations.

                            But no crash causing errors when using the script.!

                            Comment


                            • #44
                              Mustve missed this thread. Not like i can add alot on the slic things but ill test stuff, it all sounds very interesting. I realise the title is for a combat slic handler but im going with the flow of the thread.

                              On advance lists, i made one awhile back for SAP 2 (in sap2 thread) which is probably as best as i could recommend for an AI (as closely to a MP'er would choose to beat another human), because humans can constantly review the situation and change advance goals you have to choose the list order carefully. And someone asked if advancelist.txt works (i think..) and it does AFAIK. All the AIs noticeably reached Monarchy much quicker and in more or less the same order (unless they found ruins to skip ahead etc)

                              Another thing that really bugs me about the randomness of the AIs choices, is in building city improvements. How often ive seen an AI building a bazaar in a city collecting only 10 or 100 gold even (especially when gold is practically free anyway), or building a granary in a city with 20 food, such a waste of production.

                              Would it also be possible to get rid of the AI just keeping PW set at the same amount constantly? Like when theres a quiet period whack PW upto 80-100% for a couple of turns. Just ideas anyway.
                              Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                              CtP2 AE Wiki & Modding Reference
                              One way to compile the CtP2 Source Code.

                              Comment


                              • #45
                                Maq: that's great, I thought someone had, I wasn't sure. I think I might in fact rewrite it completely and see if I can get the AI to assess the situation more frequently for deciding which advances to get.
                                Concrete, Abstract, or Squoingy?
                                "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                                Comment

                                Working...
                                X