110 likes | 144 Views
Heuristic Search in Empire-Based Games. CS-470 Nathan Freeburg. Introduction. Goal Develop a hierarchical heuristic search algorithm to determine moves for a simple strategy game. Why heuristic search? Why hierarchical?. Heuristic Search. What is it?
E N D
Heuristic Search in Empire-Based Games CS-470 Nathan Freeburg
Introduction • Goal • Develop a hierarchical heuristic search algorithm to determine moves for a simple strategy game. • Why heuristic search? • Why hierarchical?
Heuristic Search • What is it? • Method of choosing branches in a state space which are more likely to lead to an acceptable solution to the problem. • Often implemented through minimax search.
Search Example A A 2 2 B B C C D D -2 -2 -99 -99 2 2 E E F F G G H H I I J J K K L L M M 4 4 2 2 -2 -2 1 1 -1 -1 -99 -99 5 5 4 4 2 2
Reducing the Search Space • A full search for a game with n pieces and m moves per piece, to a depth of d, requires examination of (m^n)^d separate states. • A full depth search for each piece, performed one at a time for all pieces, reduces the number of states to be examined to n(m^(d+1)). • Remember moves made by other pieces at the current depth.
Algorithm Used • Choose a piece to focus on. • For all other pieces, perform a depth = 1 lookahead to determine best move at that level. • Perform a full depth lookahead for the chosen piece to determine the best move. • Repeat for all pieces.
Constructing a Hierarchy • Split the decision making process into levels. • Determine overall strategy at the highest level. • Rule-based approach. • Determine the moves necessary to implement that strategy at the next level. • Heuristic search.
Test Game • Loosely based on Empire, via Empire Lite. • Only resources are cities. • Advantage goes to attacker. • Two win conditions. • All opposing units eliminated. • All cities occupied by one side.
Results • Hierarchical heuristic search outperformed non-hierarchical search. • Average move time was about 5 seconds for a lookahead depth of 8 on a 400 Mhz processor. • Still too high for mainstream applications, but promising.
Further Work • At a superficial level: further tuning of the heuristics and tightening of the code. • Division of units into separate groups, each of which could be given different goals. • More robust set of rules for decision making at the top level.
Conclusions • Hierarchical heuristic search preferable to non-hierarchical, despite increase in complexity. • Use in mainstream applications dependent on further increases in processing speed.