AI: Difference between revisions

From War.app Wiki
Jump to navigation Jump to search
Grzechooo (talk | contribs)
mNo edit summary
No edit summary
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
The exact inner mechanics of the AI remain a mystery. However, some general rules of its behaviour are known. Those were either deducted through observation of the AI's movements, or they have been stated by the [[User:Fizzer|creator]] himself on the [[forum]]s.  
The '''War.app AI''' allows computer-controlled players to participate in games alongside human players.


== Weighted Random ==
The AI's decisions are determined by a set of algorithms designed to play the game autonomously. While its behavior is generally consistent, it is not entirely predictable.


The AI constructs a list of actions it could take on each turn, along with a value of how strongly it feels it should do that action. It then does a weighted random against that list. This means that the AI is never perfectly predictable, but it does have tendencies.
For more information about the AI's implementation, see the War.app blog post on the AI's design and source code.


== General behaviour of the AI ==
== Decision Making ==


Confirmed:
The AI evaluates a set of possible actions each turn and assigns a value to each one based on how desirable it believes that action to be.


* It currently does not know how to use any card other than the reinforcement card. {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}136}} {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}2159&Offset{{=}}3}}
It then selects from those actions using a weighted random process. As a result, the AI tends to make similar decisions in similar situations, but it will not always make the exact same move.
* It does prefer to expand as long as it still sees neutral bonuses to expand to. {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}136&Offset{{=}}12}}
observed:
* It tends to attack with twice as many armies as the territory is showing. {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}1744&Offset{{=}}2}}
* It generally only places armies in a few spots and attacks from them. {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}1744&Offset{{=}}2}}
* It tends to prefer neutral territories over player controlled territories, but it mostly prefers to attack the weakest territories. {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}1744&Offset{{=}}4}}
* It tends to favor getting bonuses, and breaking enemy bonuses higher than making random other attacks. {{Ref|http://warlight.net/Forum/Thread.aspx?ThreadID{{=}}1744&Offset{{=}}4}}


== Behaviour of the AI in team games ==
== General Strategy ==


* It will only attack teammates in two circumstances:
The following AI behaviors have been confirmed:


#If a bonus is entirely controlled by teammates and it has >= 50% of the territories. It will only do attacks of 2 then.
* The AI prefers expansion while there are still desirable [[neutral]] [[bonuses]] available.
#If it's expanding into a new bonus that no teammates control. [http://warlight.net/Forum/Thread.aspx?ThreadID=2489&Offset=2]
* The AI evaluates bonuses and expands only into those that meet its criteria for being worthwhile targets.


* The AI will not play cards when teamed with a human teammate unless it must play cards by rule.  The only circumstance where an AI must play cards when teamed with a human teammate is if the last player on a team turns into an AI via boot or surrender, and cards must be used by that team that turn.
Because of this, AI players often focus on securing nearby bonuses before shifting their attention to opponents.


== Changes ==
== Team Games ==


The AI's behavior has not been changed since it was introduced in 2009. Changing the AI's behavior, even slightly, would invalidate every single-player score that's been achieved. If the AI is to be improved in the future, it will likely be done in conjunction with a revamp of the single player levels.
The AI is generally designed to cooperate with teammates.


=== Attacking Teammates ===


[[Category:WarLight]]
The AI will only attack a teammate in the following situations:
 
# A bonus is entirely controlled by teammates and the AI owns at least 50% of the territories in that bonus. In this case, it may perform small attacks to consolidate ownership.
 
# The AI is expanding into a bonus that no teammate currently controls.
 
=== Card Usage ===
 
When teamed with a human player, the AI will not voluntarily play [[cards]].
 
The primary exception occurs when all human players on the team have been eliminated and card play is required by the game settings. In that case, the AI may be forced to play cards on behalf of the team.
 
== AI-Only Games ==
 
Single-player games can be configured to contain only AI players. With [[fog]] disabled, this can be a useful way to observe how the AI plays and interacts with itself.
 
=== Multiplayer Games ===
 
In multiplayer games, at least one human player must remain active.
 
If all remaining players are AIs, they will attempt to [[vote to end]] the game. If ending the game is not possible, such as in some [[tournament]] games, a winner will be selected automatically.
 
This restriction exists to prevent multiplayer AI-only games from consuming excessive server resources. Because War.app supports highly customizable game settings, it is possible to create scenarios that could take thousands or even millions of turns to complete.
 
== See Also ==
 
* [[Cards]]
* [[Vote to End]]
* [[Bonuses]]
* [[Fog]]
 
[[Category:War.app]]

Latest revision as of 03:30, 14 June 2026

The War.app AI allows computer-controlled players to participate in games alongside human players.

The AI's decisions are determined by a set of algorithms designed to play the game autonomously. While its behavior is generally consistent, it is not entirely predictable.

For more information about the AI's implementation, see the War.app blog post on the AI's design and source code.

Decision Making

The AI evaluates a set of possible actions each turn and assigns a value to each one based on how desirable it believes that action to be.

It then selects from those actions using a weighted random process. As a result, the AI tends to make similar decisions in similar situations, but it will not always make the exact same move.

General Strategy

The following AI behaviors have been confirmed:

  • The AI prefers expansion while there are still desirable neutral bonuses available.
  • The AI evaluates bonuses and expands only into those that meet its criteria for being worthwhile targets.

Because of this, AI players often focus on securing nearby bonuses before shifting their attention to opponents.

Team Games

The AI is generally designed to cooperate with teammates.

Attacking Teammates

The AI will only attack a teammate in the following situations:

  1. A bonus is entirely controlled by teammates and the AI owns at least 50% of the territories in that bonus. In this case, it may perform small attacks to consolidate ownership.
  1. The AI is expanding into a bonus that no teammate currently controls.

Card Usage

When teamed with a human player, the AI will not voluntarily play cards.

The primary exception occurs when all human players on the team have been eliminated and card play is required by the game settings. In that case, the AI may be forced to play cards on behalf of the team.

AI-Only Games

Single-player games can be configured to contain only AI players. With fog disabled, this can be a useful way to observe how the AI plays and interacts with itself.

Multiplayer Games

In multiplayer games, at least one human player must remain active.

If all remaining players are AIs, they will attempt to vote to end the game. If ending the game is not possible, such as in some tournament games, a winner will be selected automatically.

This restriction exists to prevent multiplayer AI-only games from consuming excessive server resources. Because War.app supports highly customizable game settings, it is possible to create scenarios that could take thousands or even millions of turns to complete.

See Also