Tuesday 9 February 2016

Coding Features - How the AI Opponent Learns From You

Coding Features - How the AI Opponent Learns From You

In the game the AI opponent learns from the player in a variety of ways. The first is related to the online campaign, the second is related to the offline mode. I will detail both here.

Because the decisions taken by players in the game are all about setting the weightings for their ships' flight behaviours before a battle this makes it very easy for the AI to be able to make decisions.

The game is mostly about tweaking these settings to achieve victory and as such the method used for the AI player online is as follows.

Basic algorithm:

Every 10 minutes of  realtime the server goes through all the human players who have fought battles in the last month. 

Rank each player in terms of their win loss ratio but also weight more heavily in the favour of human players who have fought more battles than others (to a certain extent).

Take the top player, find their weighted flight settings and apply that to each of the AI players in the game.  Every few minutes make slight random adjustments to the AI players flight settings as a slight departure from the actual flight settings of the best human player.

This is the basis for the AI opponent online.

Offline:

Pick a random set of AI settings the first time through.  If the AI wins the battle change 10% of them randomly only slightly before the next battle.  If the AI loses the battle change 40% of them randomly more heavily before the next battle.

This is the basis of the AI opponent offline and it results in a computer opponent who is unpredictable but over time presents a balanced challenge to the player approximately at the level of the player.

The online AI is the tougher of the two and results in (at the moment) an AI with a win loss ratio of over 75% in most cases.  


No comments:

Post a Comment