Server side code for game