iphone - FPS in SpriteKit/Swift being Limited after an Image is added -
as i've been coding game in sprite kit, i've noticed adding 1 image severely drops framerate 60 30, there reason why happening? doing code inefficiently? it's simple.
this code runs @ 30 fps
import spritekit class optionmenu: skscene { var screen: skspritenode! override func didmovetoview(view: skview) { screen = skspritenode() self.addchild(screen) addbg() } func addbg(){ let mainmenu = skspritenode(imagenamed: "mainmenu") mainmenu.position = cgpointmake(frame.width / 2, frame.height / 2) addchild(mainmenu) } }
this code runs @ 60 fps
import spritekit class optionmenu: skscene { var screen: skspritenode! override func didmovetoview(view: skview) { screen = skspritenode() self.addchild(screen) } }
i don't understand how 1 image can affect framerate severely? btw image 1000 700 ish pixels thanks, brennan
edit: should add code in gameviewcontroller()
override func viewdidload() { super.viewdidload() let scene = optionmenu() // configure view. let skview = self.view skview skview.showsfps = true skview.showsnodecount = true /* sprite kit applies additional optimizations improve rendering performance */ skview.ignoressiblingorder = true /* set scale mode scale fit window */ scene.scalemode = .aspectfill scene.size = skview.bounds.size skview.presentscene(scene) }
edit 2: similar thread exists: ios simulator games run slow (low fps)
my question here different in wondering if capping framerate unintentionally. when add image fps stays constant @ 30.0 fps, signify me not lag due poor simulator, capping somehow.
yes, normal on ios simulator. if mainmenu image covers screen, single image enough see fps drops 60 30. ios symulator emulates opengl es via software renderer!
try running test code on real iphone , you'll see fps again.
Comments
Post a Comment