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.
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.
@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.
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?
@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.
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>
@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).