how to make a turn based rpg in javascript