server side end game logic