简体   繁体   English

Gamecenter的初始化/身份验证使SpriteKit的sprite运动滞后

[英]Gamecenter init/authentication makes SpriteKit's sprite movement lagging

I have a simple scenario (default SpriteKit template): one ViewController and a MyScene SpriteKit scene. 我有一个简单的场景(默认SpriteKit模板):一个ViewController和一个MyScene SpriteKit场景。 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). 在我的ViewController中,我在viewDidLoad管理游戏中心的初始化,但是开始后我的场景立即无限地开始了相当快的精灵运动(背景视差滚动)。

Everything works correctly but until GameCenter goes through the authentication procedure my sprite movement lags, breaks, not running fluently. 一切正常,但在GameCenter进行身份验证程序之前,我的精灵运动一直滞后,中断,无法流畅运行。

What practice can I have to minimize this (with keeping the parallax sprite movement running)? 我必须采取什么措施来最小化这种情况(保持视差精灵运动的进行)?

I'm testing this on iPhone4 device (IOS7.03) 我正在iPhone4设备(IOS7.03)上对此进行测试

GameCenter authentication is actually something that has been causing lag in games for awhile. GameCenter身份验证实际上是造成游戏落后一段时间的一种方式。 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. 在GameCenter身份验证期间暂停游戏这通常是最简单的方法,而且非常简单。

  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. 只需使用GCD启动一个新线程并在其中运行GameCenter身份验证即可。

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. 我通常只使用第一种方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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