this is the game engine code.