TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    IsAI Condition

    Scheduled Pinned Locked Moved Feature Requests & Ideas
    11 Posts 7 Posters 3.9k Views 6 Watching
    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.
    • LaFayetteL Offline
      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.

      RogerCooperR 1 Reply Last reply Reply Quote 0
      • RogerCooperR Offline
        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
        • LaFayetteL Offline
          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?

          RogerCooperR 1 Reply Last reply Reply Quote 0
          • RogerCooperR Offline
            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
            • LaFayetteL Offline
              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 Offline
                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 Offline
                  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
                  • cameronC Offline
                    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?

                    wc_sumptonW TheDogT 2 Replies Last reply Reply Quote 2
                    • wc_sumptonW Offline
                      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
                      • TheDogT Offline
                        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_
                        

                        https://forums.triplea-game.org/tags/thedog
                        https://forums.triplea-game.org/topic/3741/curated-best-top-maps-triplea-guides

                        1 Reply Last reply Reply Quote 3

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post
                        Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums