Transfer the game engine into javascript