Simple javascript game engine