Free and Open Source real time strategy game with a new take on micro-management

Ghost Proposal

From Globulation2

Jump to: navigation, search

This is a draft specification of Ghosts for glob2. A Ghost is an artificial mind that records what a human player does and is able to play

Formal specification of ghost

The ghost is a Turing complete computing machine containing an internal state. It looks at what the human player does and records it. Then its final state can be loaded in the AIGhost that will act like the recorded human.

At its creation, it is assigned an initial state S0.

Here is the formal algorithm:

<verbatim> S{0} = S0; t = 0; while playing {

S{t} = F(S{t-1}, U{t}, O{t});

} tFinal = t;</verbatim>


  • t is a given time step
  • tFinal is the last time step
  • U{t} is the state of the universe at time step t
  • S{t} is the ghost state of the universe at time step t
  • S0 is the initial ghost state.
  • O{t} is the human player's order at time step t
  • F{s, u, o} is the ghost internal learning code, taking a ghost internal state, the universe state and an order in parameter

The resulting trained ghost, formaly =S{tFinal}=, can now be used to initialize the ghost AI A: <verbatim> A{0} = I{S{tFinal}} </verbatim>


  • A is the AI execution code, depending on F.
  • A{0} is the initial state of the ghost AI.
  • I is an initialisation function, creating AI from recorded ghost.

Classes of ghosts

Finding the right learning code for =F= is a very hard problem. So the ease the task, we have defined several classes of ghosts, starting from simple.

Level 1 ghosts

A level 1 ghost records human actions independently. It is essentielly a table of simplified universe states and actions. The corresponding AIGhost, when faced with a given universe state, will have to compute the order whose corresponding universe state has smallest distance and execute it. This operation is O(n) with the number of recorded universe state, so a universe state clustering algorithm, with probabilistic order choice will be implemented.

Ghost API

For glob2 to support ghosts, a hook for order filtering has to be created. Just before order execution, it has to read it and update its internal state.