Driver inversion
Posted
by
Val
on Game Development
See other posts from Game Development
or by Val
Published on 2014-05-02T11:42:07Z
Indexed on
2014/06/07
3:50 UTC
Read the original article
Hit count: 144
java
|architecture
I have a GUI game, which is driven by user every time it clicks the mouse. Every time user clicks a square on a board, the board state is updated (we re-compute the score, the player to make next move and legal movements it can make) and repainted. Both mouse click, state recomputation and painting are handled in the GUI thread. Now, suppose that I want to train AI to play without GUI. That is, game engine should consume next move by simply calling AI's makeMove
function in one thread. This would allow to play millions of games per second automatically. GUI may just screenshot some arbitrary states time after time. How do you switch to this strategy?
© Game Development or respective owner