AI: Difference between revisions

From War.app Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
The War.app AI's behavior is determined by a set of algorithms.  The source code behind these algorithms can be viewed on GitHub at https://github.com/FizzerWL/WarLight.AI. You can also read more about the AI at https://www.war.app/blog/index.php/2016/02/the-warlight-ai-goes-open-source/
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 prefers to expand as long as it still sees [[neutral]] [[bonuses]] to expand to, as long as the bonus meets its criteria for being a good bonus. {{Ref|http://war.app/Forum/Thread?ThreadID{{=}}136&Offset{{=}}12}}
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.


== 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. {{Ref|http://war.app/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.


== Playing With Itself ==  
== Team Games ==


Under the single-player tab, you can set up a game full of AIs, no [[fog]] and watch the entire game play out on its own.
The AI is generally designed to cooperate with teammates.


However, under the multi-player tab, the AI will not play a game without any humans involved. If only AIs remain in a game, the AIs will simply [[vote to end]]. If voting to end is not possible, such as in a [[tournament]] game, the AIs will just pick a winner randomly. This restriction is necessary due to the way that multi-player games work. Due to War.app's flexible engine, someone could construct a game that took thousands or millions of turns to finish. For example, a game with no bonuses or large [[wastelands]] separating players.  The War.app server would strain to complete these games, likely causing the entire site to grind to a halt.
=== Attacking Teammates ===
 
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]]
[[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