swift - Game Center turn based game -
i have made word game. works , can start game center game. have problem. want both of users see same things on screen. checkers or chess game.
var imagelinksarray = [string]() var enarray = [string]() var arraynumber:int = 0 let localfilepath = nsbundle.mainbundle().pathforresource("json",oftype:"json") var readerror:nserror? if let datalocal = nsdata(contentsoffile:localfilepath!, options:nsdatareadingoptions.datareadinguncached, error:&readerror) { let stringdata = nsstring(data: datalocal, encoding: nsutf8stringencoding) let json = json(data: datalocal) result in json["words"].arrayvalue { let en = result["en"].stringvalue enarray.append(en) } var randomarraynumber = int(arc4random_uniform(uint32(enarray.count))) arraynumber = int(randomarraynumber) }
this how word json file. want both players see same word. can please explain logic me?
you need kind of server software keep game session state. game center offer couple of solutions this, , other options build own server or roll kind of peer-to-peer.
this large field , recommend research , reading on topic.
Comments
Post a Comment