Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    IsAI Condition

    Feature Requests & Ideas
    7
    11
    1197
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RogerCooper
      RogerCooper last edited by

      I would like to have an IsAI condition. This could be used in a number of ways, but most obviously to define player actions for the AI.

      Logical followups to this would be a Transfer trigger and a Build Trigger. Transfer would immediately take the listed units from 1 territory (if they exist) and put them in another territory. A build trigger would reduce your resources and put units in the build pool.

      1 Reply Last reply Reply Quote 5
      • LaFayette
        LaFayette Admin last edited by

        Could you clarify in which cases we would want actions for an AI player only? I'm curious if we are using AI players as 'stand-in' players to execute auxiliary actions and game effects. The code models an AI player as a player, from the codes perspective the two should be interchangeable. If we have it so that an AI player can't be swapped out for a human, that creates a substantial conflict with the original design of how the engine is coded. To some extent, as brought up in other conversations, we may want to consider having a different player type, a 'non-player' that is neither AI nor Human that can be used for such purposes. If on the other hand we are trying to help the AI be smarter, then updates to the AI itself to take into account triggers & actions perhaps would be a good route.

        RogerCooper 1 Reply Last reply Reply Quote 0
        • RogerCooper
          RogerCooper @LaFayette last edited by

          @LaFayette I don't think that the AI can reasonably expected to handle every situation. An IsAI condition is simply checking about the nature of the player, it does require the AI player to access the engine differently.

          Consider the AA Global Game. The AI cannot be reasonably expect to decide when is a good idea to declare war. With an IsCondition, you could program into the XML a reasonable default decision.

          This could also be used for balance purposes. In games that AI has problems, you could give the AI extra forces in a specific location.

          1 Reply Last reply Reply Quote 0
          • LaFayette
            LaFayette Admin last edited by

            In essence, AI hints? I dig the idea.

            In theory the AI could be made smart enough to know when to declare war. I suspect that would become map specific though. We'd need to include a specific algorithm for when the AI thinks it should vs when it wants to keep peace.

            As a map attribute, would such a thing become too predictable if you know the AI always declares war in a certain scenario?

            Beyond that, do you have any XML snippets that you could post as an example where the attribute would be useful?

            RogerCooper 1 Reply Last reply Reply Quote 0
            • RogerCooper
              RogerCooper @LaFayette last edited by

              @LaFayette You could still use randomness with an IsAI trigger. For example, in the Global game, you could an AI Japanese player declare war on the Americans 50% of the time on turn 2 and 75% on turn 3.

              1 Reply Last reply Reply Quote 0
              • LaFayette
                LaFayette Admin last edited by

                For politics, taking an example from gloabl, what do you think of the below? (Notice the 'ai_hints')

                <attachment 
                     name="politicalActionAttachment_Allies_To_War_With_TrueNeutrals" 
                     attachTo="British"
                     javaClass="games.strategy.triplea.attachments.PoliticalActionAttachment"
                     type="player">
                	<option name="conditions" value="conditionAttachment_British_Not_Yet_At_War_With_TrueNeutrals"/>
                	<option name="relationshipChange" value="British:Neutral_True:War"/>
                	:
                	:
                	<option name="relationshipChange" value="Neutral_True:Japanese:Friendly_Neutral"/>
                	<option name="relationshipChange" value="Neutral_True:Neutral_Axis:Friendly_Neutral"/>
                	<option name="text" value="Allies_War_Neutral_True"/>
                        <ai_hints>
                           <ai_hint round="1" chance="50" />
                           <ai_hint round="2" chance="75" />
                           <ai_hint round="3" chance="100" />
                        </ai_hints>
                </attachment>
                
                C 1 Reply Last reply Reply Quote 0
                • C
                  Cernel Moderators @LaFayette last edited by

                  @LaFayette I think it would work the best as just a boolean condition checking if the player is AI. Then, on that political action attachment, you could specify an invert for such condition (so that the AI will be completely unable to make that action), while having a trigger that rolls a chance if such condition is true.

                  You can already hack this a number of ways (for example, by making the players place some units to tell the program who's the AI (see Feudal Japan), which is kinda ghetto).

                  1 Reply Last reply Reply Quote 0
                  • B
                    butterw last edited by

                    As mentionned in this thread allowing map specific AI hints would allow mapmakers to make the AI gameplay more interesting, in particular in maps where complex rules (not understood by the AI) are used.

                    I've found that Movement Restrictions for the Allied ww2 Russian AI Player avoids RUS risking its critical fighters by attacking the axis fleet in the Mediterranean or by defending BRI India.

                    1 Reply Last reply Reply Quote 0
                    • cameron
                      cameron last edited by

                      so did this actually get implemented? and if so where are the details of what it can and can't do and what code to use?

                      W TheDog 2 Replies Last reply Reply Quote 2
                      • W
                        wc_sumpton @cameron last edited by

                        @cameron said in IsAI Condition:

                        so did this actually get implemented? and if so where are the details of what it can and can't do and what code to use?

                        Yes, isAI has been implemented. And is being use in the GCD map.

                        <!-- This will test if the German player is AI controlled -->
                        <attachment name="conditionAttachment_isAI_Germany" attachTo="Germans" javaClass="RulesAttachment" type="player">
                        	<option name="isAI" value="true"/>
                        </attachment>
                        

                        isAI true/false tests to see if "attachTo" is/is not AI controlled. Can be used with "players" to test a group. Using "players" will override "attachTo".

                        Cheers...

                        1 Reply Last reply Reply Quote 2
                        • TheDog
                          TheDog @cameron last edited by

                          @cameron
                          Here is the code from 1941 GCD with a foreach all players

                          <!-- ======================================= GO isAI =======================================  -->
                          	<attachment foreach="$All-Players$" name="conditionAttachment_isAI_@All-Players@" attachTo="@All-Players@" javaClass="RulesAttachment" type="player">
                          		<option name="isAI" value="true"/>
                          	</attachment>
                          

                          There are lots of examples of its use, search the xml for

                          _isAI_
                          
                          1 Reply Last reply Reply Quote 3
                          • 1 / 1
                          • First post
                            Last post
                          Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums