Hard or Does Nothing AI for unactive players


  • Moderators Admin

    In an unreleased game (so far, at its latest major state, I've only played it once with @Schulz), I've a player (meaning a power) that only takes part in battles, both on offence and on defence, and when it does it on offence is only due to random triggers placing units in hostile territories. Practically, this player has absolutely no decision to make beside selecting casualties, during combat, and it is supposed always to select them by what at the current autoselect (that is, always lowest defence/offence first when defending/offending).

    Should I assign it to "Hard" (defaultType="AI") or to "Does Nothing" (defaultType="DoesNothing") AI, as default, in the game file?

    My preference, actually would be to assign it to exactly the same AI that the disabled or "Neutral" (null) players are assigned to. What is the AI that is controlling "Neutral"? Can I do this or not?

    In practice, my main concern is that, at any point in the future, "Hard AI" might be changed as to select casualties in attack saving best defence on the last round of combat, if the battle zone is exposed enough, while my unactive player should absolutely never take any decisions, also while selecting casualties, but always taking lowest offence first while offending and lowest defence first while defending. How can I best assure that?

    Also, I don't really want players to be able to even select that power, at start game, but I cannot use "isHidden", because I want them to be able to disable it, instead (to skip all the phases of this player and all triggers happening during them, if they so prefer).

    Another concern I have is if I would have "isHidden" true, then will the hidden player remain assigned as default while using the "Set All To" option or not? This behaviour should be documented in pos2. I would actually prefer this power being always ignored whenever using the "Set All To" option, anyways.

    p.s.: I'm also annoyed by the fact that these options are still not supported when hosting games. This is a regression since it was done by having the name starting with "AI", also since that would let players know those are the unplayable players. I don't think new players will easily realize they need to assign that player to an AI, when hosting the game, and this may be confusing.


  • Moderators Admin

    More in general, I believe "DoesNothing" AI is in need of being documented, so that mapmakers may know how to use it. Lacking documentation, what is left for the mapmakers to do is testing it, and hoping that the behaviour they are seeing is reliable (will not change in the future).

    In my particular case, I would like using this AI for a player that has a "Conduct Combat" phase, during which it attacks other players (the attacking units are "spawned" by triggers). This currently works. Is this something reliable and intended, for a "DoesNothing" AI player to attack during its own "Conduct Combat" phase or should I better not be using this AI for something like this (and use "Hard" AI, instead)?


  • Admin

    Cernel, I'll examine this thread in more detail and give some better feedback soon. In short it seems like we probably need a map feature. Maps should really not be relying on AIs. An AI and human player really should be interchangeable. To achieve behavior of a neutral, we probably want that to be built in.


  • Moderators Admin

    @LaFayette To be clear, everything works fine. Here I was mostly asking for confirmation if the behaviour was reliable (having an attacking player, with a Conduct Combat phase assigned, controlled by DoesNothing AI).

    The map itself is substantially finished, but I have to go through rereading and rewording the game notes and various documentation within it. It's always hard to guess how much that will take.


  • Moderators Admin

    The other thing here is that I also want this behaviour being optional. This is currently achieved by having the ability to deselect the "use" for this player. This already fully works fine too, as, this way, the player has no "Conduct Combat" phase and no phase where the "spawned" units are triggered.


  • Moderators Admin

    However, as I partially said, there are two actual issues, with this way I'm going, both related to hosting. Private hosts have the minor issue that preselection doesn't work, so players have to know that particular power has to be assigned to Does Nothing, and do it themselves. Automated hosts (bots) have the major issue that you cannot have Does Nothing at all (so, here the workaround would only be that one of the players take this power and takes care always to confirm casualties autoselection).

    As far as private hosts go, I'm under the understanding that is only a temporary (albeit long time stale) issue, in that @redrum will eventually finish this new feature by having it working when hosting too.

    As far as bots go, I intended to make a feature request for having Does Nothing in them too, as an option, after having released this map.


  • Moderators Admin

    To be clear, what I need here is merely a player that skips everything a human player may do, chooses randomly whatever a human player must do and takes as casualties whatever the autoselector gives (which, for this game, is already currently fully covered by Does Nothing, beside the hosting related issues with assigning players to it).


  • Admin

    @Cernel are you relying on DNAI to purchase & place?

    As far as I'm concerned DNAI should live up to its name and will never gain more behavior. In short it's a hacky way to get another neutral player.


  • Moderators Admin

    @LaFayette said in Hard or Does Nothing AI for unactive players:

    @Cernel are you relying on DNAI to purchase & place?

    Nope. There is no purchasing and all the placement is made by triggers, completely independently by any assignation. This is also an optional feature for the game, and can be disabled by deselecting the "use" for this player, thus removing all phases in which these triggers fire.


  • Moderators Admin

    @LaFayette said in Hard or Does Nothing AI for unactive players:

    As far as I'm concerned DNAI should live up to its name and will never gain more behavior. In short it's a hacky way to get another neutral player.

    Ok, then, an example. If I'm playing WWII Revised and assign "Germans" to Does Nothing AI, then start the game with me as "Russians". If I place 1 battleship in a sea zone with "Germans" units in it, should these units attack me on the forthcoming "Germans" turn (the behaviour is that they do).


  • Admin

    @Cernel The "Neutral" (null) player uses the same casualty selection as "DoesNothing" which is essentially the default plus interleaving carriers and planes. I would recommend using this for any player that is just taking part in battles and not meant to move/purchase/etc.


  • Admin

    @redrum Are you sure it's not actually weak AI that neutral player uses? Is it indeterminate and based on the location of code?

    For example, in casualtySelector.java:

        final Player tripleaPlayer =
            player.isNull() ? new WeakAi(player.getName()) : bridge.getRemotePlayer(player);
    

    From what I can tell DNAI is weak AI that does not move. Weak AI shares the same casualty selection as ProAI where it uses default casualty with interleaved carriers+figs.


  • Moderators Admin

    @redrum said in Hard or Does Nothing AI for unactive players:

    @Cernel The "Neutral" (null) player uses the same casualty selection as "DoesNothing" which is essentially the default plus interleaving carriers and planes.

    Good to know, this is exactly what I wanted and what I actually went with, since nobody answered me 2 months ago.

    I would recommend using this for any player that is just taking part in battles and not meant to move/purchase/etc.

    Also for players (like this one) having "Conduct Combat" phases and attacking during the same? If positive, can we document this as intended and "stable" somewhere?


  • Moderators Admin

    @LaFayette said in Hard or Does Nothing AI for unactive players:

    @redrum Are you sure it's not actually weak AI that neutral player uses? Is it indeterminate and based on the location of code?

    For example, in casualtySelector.java:

        final Player tripleaPlayer =
            player.isNull() ? new WeakAi(player.getName()) : bridge.getRemotePlayer(player);
    

    From what I can tell DNAI is weak AI that does not move. Weak AI shares the same casualty selection as ProAI where it uses default casualty with interleaved carriers+figs.

    I guess what @redrum means is that the "Neutral" player is using Weak AI too?


  • Admin

    @LaFayette Weak AI and DoesNothing AI are the same as well since they both use Abstract AI selectCasualties (this probably should actually be updated to be DoesNothing AI since that makes more sense but is just a code issue). No, ProAI uses a separate casualty selection that is more advanced than Weak/DoesNothing: https://github.com/triplea-game/triplea/blob/master/game-core/src/main/java/games/strategy/triplea/ai/pro/AbstractProAi.java#L346

    @Cernel Sorry, I think I missed this thread. Yeah, a brief definition should probably be added to POS2 XML. Yes, "Neutral", DoesNothing, and Weak all use the same casualty selection which is default plus interleaving carriers and planes. Once the current PR that is potentially altering this is decided on then an update would be good.


  • Admin

    I suppose it's getting to be a pedantic point, though WeakAI is the one used for casualties it appears.

    Yeah, a brief definition should probably be added to POS2 XML

    I would disagree, players want to know this information as well for what a given AI does. As far as I'm concerned though AIs should not be a tool of map makers and maps should not be aware of AIs. On the other hand selecting more players to be neutrals via another means would be the right feature. Any cases where we really want a player to just mindless place units can be considered apart from AIs (for example, wouldn't triggers be able to accomplish that just fine?)


  • Admin

    @LaFayette said in Hard or Does Nothing AI for unactive players:

    As far as I'm concerned though AIs should not be a tool of map makers and maps should not be aware of AIs.

    I think most map makers would disagree with this. Either I'm misunderstanding or just not seeing how you would handle the various maps that are defaulting players to AI and using hidden players.


  • Moderators Admin

    @LaFayette said in Hard or Does Nothing AI for unactive players:

    Any cases where we really want a player to just mindless place units can be considered apart from AIs (for example, wouldn't triggers be able to accomplish that just fine?)

    So, I thought I made this clear, but I'll further clarify that FOR THIS ONE GAME DNAI is not required to place anything, as all the placements is made by triggers. What DNAI should be doing in this one is mindlessly attacking, resolving battles in a random order and taking casualties always by the autoselector (it has no retreat decisions, since the units are placed directly into the enemy territories).


  • Admin

    @Cernel my comment was more directed to @redrum who has stated it would be more flexible for DNAI to place but not purchase.

    My opinion is that DNAI should behave like a neutral player.

    From another perspective, IMO using AI to get the behavior of a neutral player is a bad way to go. Instead I think the right feature is to be able to mark players as neutral which would remove their player slots and avoids loads of confusion and frankly other hackery.

    But for your prospective map and perhaps any others, I do wonder, @Cernel why not use a true neutral player?


  • Moderators Admin

    @LaFayette said in Hard or Does Nothing AI for unactive players:

    But for your prospective map and perhaps any others, I do wonder, @Cernel why not use a true neutral player?

    I tried to use the "Neutral" player, at first, but it didn't work, either because you cannot assign phases to it or because you cannot assign triggers to it or both (I don't exactly remember, as I opened this topic 2 months ago).


Log in to reply