Javascript Generic Game Engine