About decoupling GUI from game

I thought of how would forge be playable from a remote host. Like a person or AI program is giving commands to forge to play certain cards and perform other actions. But how is it possible when ability factories have hardcoded calls to GUI?
It looks like to me that depending of type of active player the input method will vary: GUI for local human player, some api calls for local AI, and over network iteraction for one who plays remotelly - no matter against who.
That means that all players interactions should be untied from rules enforcement engine. I guess
It does not even require to remove all those if-else's for different actions for AI and human player. AI code might even stay in its place.
So, I think that all the human player interaction should be somehow wrapped to make an overload with a different behaviour possible.
It looks like to me that depending of type of active player the input method will vary: GUI for local human player, some api calls for local AI, and over network iteraction for one who plays remotelly - no matter against who.
That means that all players interactions should be untied from rules enforcement engine. I guess
- Code: Select all
final Object o = GuiUtils.chooseOne("Choose first creature to exile", chooseGrave);
- Code: Select all
activePlayer.getCommuncation().chooseOne("Choose first creature to exile", chooseGrave)
It does not even require to remove all those if-else's for different actions for AI and human player. AI code might even stay in its place.
So, I think that all the human player interaction should be somehow wrapped to make an overload with a different behaviour possible.