javascript component simulation (game) architecture