简体   繁体   中英

Gamecenter init/authentication makes SpriteKit's sprite movement lagging

I have a simple scenario (default SpriteKit template): one ViewController and a MyScene SpriteKit scene. In my ViewController I managed in viewDidLoad the gamecenter initialization but my scene after start immediatelly starts a rather quick sprite movement infinitely (a background parallax scrolling).

Everything works correctly but until GameCenter goes through the authentication procedure my sprite movement lags, breaks, not running fluently.

What practice can I have to minimize this (with keeping the parallax sprite movement running)?

I'm testing this on iPhone4 device (IOS7.03)

GameCenter authentication is actually something that has been causing lag in games for awhile. There are a couple ways people try to get around it, and it's really depends on the app and programmers taste.

  1. Pause the game during GameCenter authentication This is the easiest way typically, and pretty straightforward.

  2. Put the authentication on another thread If you desire a fluid option from menu to gameplay, this would be the route to go. Just use GCD to start a new thread and run the GameCenter authentication in it.

Hope this helps. There might be a couple of other ways, but these are the two I've seen the most. I typically just use the first method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM