Difference between revisions of "AI Refactoring2009Crab"

From The Battle for Wesnoth Wiki
m (CURRENT)
(fix heading level)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= CURRENT =
+
== CURRENT WORK ==
  
extract gamestate-changing actions from AI code to separate classes.
+
=== extract gamestate-changing actions from AI code to separate classes.===
  
Proposed syntax (A):
+
<b>TESTING</b> ai movement.
  
ai_move_command move_my_leader = execute_move_unit_command(from,keep);
+
<b>NOW</b> ai attacks.
if (move_my_leader.ok()){
 
    ai_recruit_command recruit_soldiers = execute_recruit_command();
 
    if (!recruit_soldiers.ok()){
 
    }
 
}
 
  
Benefits:
+
<b>DONE</b> ai recruiting.
  
1. well-defined interface between c++ ai and game state changes
+
<b>DONE</b> ai set movement/attacks to 0.
  
2. separate return status from other values (such as 'move ok/move failed/move interrupted' vs 'where moved unit is now')
+
=== AI Lookup===
 +
implement ai lookup by scanning ai/ais directory for a list of ai configs.
  
3. ability to detect unchecked ai commands at runtime (if .ok() wasn't called, we can complain in the destructor of called command).
+
=== AI testing:===
 +
set up a batch testing of 'ai vs ai' battles on my home computer, with results posted to db with a web frontend on a colocated server. Current status: compiled 1.6 using freebsd ports (to auto-install most of the dependencies), added lua, copied my git repository to there, will try to compile trunk soon.
  
Proposed syntax (B):
+
[[Category:Summer_of_Code_2009]]
 
 
ai_move_command move_my_leader(from,keep);
 
move_my_leader.execute();
 
if (move_my_leader.ok()){
 
  ai_recruit_command recruit_soldiers;
 
  recruit_soldiers.set_preference_("archers");
 
  recruit_soldiers.execute();
 
  if (!recruit_soldiers.ok()){
 
      ...
 
  }
 
}
 
 
 
Benefits (comparing with A):
 
 
 
# Ability to supply additional parameters before execution.
 
# Ability to do a 'mock execution' and check, if the move allowed. (e.g. if (recruit_soldiers.is_possible()) ... )
 
 
 
= DONE =
 
 
 
[http://svn.gna.org/viewcvs/wesnoth?rev=34723&view=rev r34723] AI Refactoring: changed 'team' to 'side' when it means 'side number that starts from 1'.
 
 
 
[http://svn.gna.org/viewcvs/wesnoth?rev=34720&view=rev r34720] AI Refactoring: Moved location of ai_interface::info to ai_manager. Now using a single copy of ai_interface::info for all AIs, and using get_info() accessor to get it from AIs. Also, fixed side to be unsigned int where it is possible.
 
 
 
[http://svn.gna.org/viewcvs/wesnoth?rev=34719&view=rev r34719] AI Refactoring: removed unused turn_data_ from ai_interface::info
 
 
 
[http://svn.gna.org/viewcvs/wesnoth?rev=34705&view=rev r34705] AI Refactoring. Extracted 'team number' and 'master' from ai_interface::info. This makes ai_interface::info ai-independent and allows to push it out of ai.
 

Latest revision as of 15:46, 7 April 2023

CURRENT WORK

extract gamestate-changing actions from AI code to separate classes.

TESTING ai movement.

NOW ai attacks.

DONE ai recruiting.

DONE ai set movement/attacks to 0.

AI Lookup

implement ai lookup by scanning ai/ais directory for a list of ai configs.

AI testing:

set up a batch testing of 'ai vs ai' battles on my home computer, with results posted to db with a web frontend on a colocated server. Current status: compiled 1.6 using freebsd ports (to auto-install most of the dependencies), added lua, copied my git repository to there, will try to compile trunk soon.

This page was last edited on 7 April 2023, at 15:46.