modularized the game engine scripts