refactor a game engine out of the gui