2014-10-12 4 views
1

Xcode 6 iOS 시뮬레이터에서 이상한 동작을 발견했습니다.iOS 시뮬레이터에서 낮은 FPS SpriteKit

내 GameScene에 메뉴가 표시 되더라도 Simulator FPS 영역은 약 20FPS로 매우 낮습니다.

이 문제가 발생할 수있는 알려진 문제가 있습니까? 또한 게임 자체를 시작하면 즉시 30FPS에서 19FPS로 떨어집니다. 시작시로드

다음

내 코드 :

override func didMoveToView(view: SKView) { 
     var sud:NSUserDefaults = NSUserDefaults.standardUserDefaults() 

     if(sud.valueForKey("highscores") != nil){ 
      highScores = sud.valueForKey("highscores") as [Int] 
     }else{ 
      highScores = [0, 0] 
      sud.setValue(highScores, forKey: "highscores") 
     } 

     createColors() 
     createStartMenu() 
    } 


func createColors(){ 
     colorArray = [ 
      ColorClass(name: "greenSea", color: greenSea), 
      ColorClass(name: "emerald", color: emerald), 
      ColorClass(name: "peterRiver", color:peterRiver), 
      ColorClass(name: "amethyst", color:amethyst), 
      ColorClass(name: "wetAsphalt", color:wetAsphalt), 
      ColorClass(name: "sunFlower", color:sunFlower), 
      ColorClass(name: "carrot", color:carrot), 
      ColorClass(name: "pumpkin", color:pumpkin), 
      ColorClass(name: "alizarin", color:alizarin), 
      ColorClass(name: "pomeGranate", color:pomeGranate), 
      ColorClass(name: "clouds", color:clouds), 
      ColorClass(name: "asbestos", color:asbestos)] 

    } 

func setSceneBackground(){ 
    var background = SKSpriteNode(color: myBackgroundcolor, size: CGSizeMake(self.frame.width, self.frame.height)) 
    background.position = CGPointMake(self.frame.width/2, self.frame.height/2) 
    self.addChild(background) 
} 



    func createStartMenu(){ 
     self.removeAllChildren() 
     setSceneBackground() 
     reset() 

     var background = SKSpriteNode(color: myBackgroundcolor, size: CGSizeMake(self.frame.width/1.2, self.frame.height/1.5)) 

     background.position = CGPointMake(self.frame.width/2, self.frame.height/2) 

     var buttonSize:CGSize = CGSizeMake(background.size.width - 20, background.size.height/4 - 15) 
     background.setScale(0) 

     var alizarin = UIColor(rgba: "#e74c3c") 
     playLevelsButton = SKSpriteNode(color: alizarin, size: buttonSize) 
     playLevelsButton.position.y = buttonSize.height + buttonSize.height/2 + 15 

     var fontSize = buttonSize.height/2 

     playLevelLabel = SKLabelNode() 
     playLevelLabel.fontSize = fontSize 
     playLevelLabel.text = "Easy" 
     playLevelLabel.name = "playLevelLabel" 
     playLevelLabel.fontName = myFont 
     playLevelLabel.zPosition = 1 
     playLevelLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center 
     playLevelsButton.addChild(playLevelLabel) 

     var carrot = UIColor(rgba: "#e67e22") 
     playMoreDifficultButton = SKSpriteNode(color: carrot, size: buttonSize) 
     playMoreDifficultButton.position.y = buttonSize.height/2 + 5 

     playMoreDifficultLabel = SKLabelNode() 
     playMoreDifficultLabel.text = "Difficult" 
     playMoreDifficultLabel.fontName = myFont 
     playMoreDifficultLabel.fontSize = fontSize 
     playMoreDifficultLabel.name = "playMoreDifficultLabel" 
     playMoreDifficultLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center 
     playMoreDifficultButton.addChild(playMoreDifficultLabel) 

     var sunFlower = UIColor(rgba: "#f1c40f") 
     howToPlayButton = SKSpriteNode(color: sunFlower, size: buttonSize) 
     howToPlayButton.position.y = -buttonSize.height/2 - 5 

     howToPlayLabel = SKLabelNode() 
     howToPlayLabel.text = "How To Play" 
     howToPlayLabel.fontSize = fontSize 
     howToPlayLabel.fontName = myFont 
     howToPlayLabel.name = "howToPlayLabel" 
     howToPlayLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center 
     howToPlayButton.addChild(howToPlayLabel) 

     var emerald = UIColor(rgba: "#2ecc71") 
     highScoreButton = SKSpriteNode(color: emerald, size: buttonSize) 
     highScoreButton.position.y = -buttonSize.height - buttonSize.height/2 - 15 

     highScoreLabel = SKLabelNode() 
     highScoreLabel.text = "Highscore" 
     highScoreLabel.fontSize = fontSize 
     highScoreLabel.fontName = myFont 
     highScoreLabel.name = "highScoreLabel" 
     highScoreLabel.verticalAlignmentMode = SKLabelVerticalAlignmentMode.Center 
     highScoreButton.addChild(highScoreLabel) 

     //Names 
     playLevelsButton.name = "playLevels" 
     playMoreDifficultButton.name = "playMoreDifficult" 
     howToPlayButton.name = "howToPlay" 
     highScoreButton.name = "highScore" 

     background.addChild(playLevelsButton) 
     background.addChild(playMoreDifficultButton) 
     background.addChild(howToPlayButton) 
     background.addChild(highScoreButton) 
     self.addChild(background) 
     background.runAction(SKAction.scaleTo(1, duration: 0.3)) 
    } 

func reset(){ 
     correctColors = [] 
     tileArray = [] 
     tempArray = [] 
     amountCorrect = 0 
     tapped = 0 
     gameStarted = false 
     maxTime = nil 
     timeStamp = 0 
     tileFrameSize = nil 

     searchColor = nil 

     tileColors = [] 

    } 
+1

XCode 9. FPS = 1이고 DEBUG> Open System Log를 열고 다음과 같은 메시지가 표시됩니다. "com.apple.CoreSimulator.SimDevice.B9A5D2AF-5251-4F7A-8D00-DAF75203390A [49490] (com .apple.videosubscriptionsd) : 서비스는 0 초 동안 만 실행되었으며, 다시 10 초 동안 respawn을 푸시합니다. " –

답변

7

SpriteKit은 장치에서 GPU 가속 렌더링을 위해 OpenGL ES를 사용합니다. iOS 시뮬레이터에서 소프트웨어 렌더러는 OpenGL ES를 지원합니다. 따라서 OpenGL ES는 자체적으로 또는 SpriteKit 또는 SceneKit을 통한 것이 든간에 실제 장치 대 시뮬레이터의 성능 특성이 매우 다릅니다.

성능 측정을 위해 iOS 시뮬레이터를 사용하지 마십시오. 특히 GPU 관련 사항이있는 경우에는 절대로 사용하지 마십시오.

1

는 오해의 소지가 ... 스프라이트 키트 시뮬레이터 알려진 문제가 있습니다. 내 게임은 장치에서 60FPS를 실행하고 시뮬레이터에서 최대 30FPS를 실행합니다.

사람들은 시뮬레이터가 아닌 기기에서 게임을 할 것이므로 적절하게 테스트하십시오.

+1

나는 11 FPS를 얻는다. 너 정말 운이 좋았어. – ZaBlanc

관련 문제