refactoring players.js, npcs.js, physics loop