|
|
Line 1: |
Line 1: |
|
|
This developers article has been moved to http://globulation2.devjavu.com/ |
|
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 |
|
|
|
|
|
|
|
Please go there to find in. Thank you. |
|
|
|
|
|
⚫ |
|
|
==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 { |
|
|
<pre>S{t} = F(S{t-1}, U{t}, O{t}); |
|
|
t++;</pre> |
|
|
} tFinal = t;</verbatim> |
|
|
|
|
|
Where: |
|
|
:* 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> |
|
|
|
|
|
Where: |
|
|
:* 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. |
|
|
|
|
⚫ |
[[Category: Developer Resources]] |
|