frame-rate

Create endless cgpath without framedrops

三世轮回 提交于 2019-12-01 15:15:21
问题 I need to create a cgpath continuously. At the moment I do it like that: func createLine(){ var rand = randomBetweenNumbers(1, 2) currentY-- if rand < 1.5{ currentX-- CGPathAddLineToPoint(leftPath, nil, currentX, currentY) }else{ currentX++ CGPathAddLineToPoint(leftPath, nil, currentX, currentY) } CGPathAddLineToPoint(rightPath, nil, currentX+tileSize, currentY) lineNode.path = leftPath rightNode.path = rightPath } And call it like that: NSTimer.scheduledTimerWithTimeInterval(0.05, target:

Significant fps drops when unpausing the view in Spritekit

早过忘川 提交于 2019-12-01 13:21:10
I've noticed significant fps drops (framerate drops between 5-10fps), when unpausing the view in SpriteKit. I tried this with empty project (Spritekit game template). Here is the code: if(!self.view.paused){ self.view.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused"); self.view.paused = NO; } If I pause the scene, everything works as expected and frames are steady at 60fps. I am testing this on device. if(!self.paused){ self.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused"); self.paused = NO; } This can make a problem with gameplay when unpausing because some frames will be

Is there a solution for HTML5 canvas animation stutter?

前提是你 提交于 2019-12-01 12:13:44
I am working on a HTML5 canvas animation (to be more precisely a photo slideshow). So far all my slideshows are in flash because last time (March 2010) I looked ihe framerate for Flash was much higher 3x - 4x compared to html5 canvas. Today it is said that current browsers catched up with flash but all the html5 canvas samples I have found so far stutter in current Firefox and Chrome browsers. IN the sample setInterval is set to 15ms which should give alt least 60 fps. But at on my laptop the animation stutters a lot: http://demo.webdevhub.net/canvas/simple/ Are there workarounds for at least

IOS 13 Sprite Kit Issues

六眼飞鱼酱① 提交于 2019-12-01 12:08:26
问题 I recently made a game using sprite kit xcode 10.2 which was working fine unless ios 13 update, I tested the game in xcode 11 simulators with ios 13 the fps of the game starts to get reduce to 30-35fps. Also sometimes physics body on sprite nodes is not working properly. sometimes collision is detected on sprite nodes and sometimes it is being detected in middle of the sprite node which was not the case in ios 12 everything was working fine until ios 13 update. 来源: https://stackoverflow.com

Significant fps drops when unpausing the view in Spritekit

大憨熊 提交于 2019-12-01 10:33:50
问题 I've noticed significant fps drops (framerate drops between 5-10fps), when unpausing the view in SpriteKit. I tried this with empty project (Spritekit game template). Here is the code: if(!self.view.paused){ self.view.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused"); self.view.paused = NO; } If I pause the scene, everything works as expected and frames are steady at 60fps. I am testing this on device. if(!self.paused){ self.paused = YES; NSLog(@"Paused"); }else{ NSLog(@"Unpaused");

Making a FPS shower? [closed]

一笑奈何 提交于 2019-12-01 09:34:07
I am trying to make a string with FPS showing, but, how do I actually get my programs FPS? I want to do it with g.drawString(getFPS(), 10, 10) How do I get my FPS? This code does it for me. Put it in your main program loop: //To Measure FPS private long now; private int framesCount = 0; private int framesCountAvg=0; private long framesTimer=0; //Main Game Loop while (isRunning) { //Record the time before update and draw long beforeTime = System.nanoTime(); //... Update program & draw program... // DRAW FPS: now=System.currentTimeMillis(); gEngine.drawFPS(c, framesCountAvg); framesCount++; if

Cocoa OpenGL unlocked framerate

老子叫甜甜 提交于 2019-12-01 08:40:34
问题 I want to be able to run my game without a locked framerate (currently 60 fps). The only way that I have found to run the animation is with a NSTimer. Is there a way to have an unrestricted framerate in Cocoa. If so, a link or a code snippet would help greatly. 回答1: If you really want to do this, you might need to use the CGL interface. In a valid GL context, CGLGetCurrentContext returns an (opaque) context object. CGLSetParameter can be used to set a value for the kCGLCPSwapInterval

AVAudioPlayer - Drop in Framerate

廉价感情. 提交于 2019-12-01 08:15:02
I have a quick question: I am loading a mp3 file into a NSData object and then I play it using the AVAudioPlayer in my game. Every second or so, the frame rate drops and you can see a stuttering on the screen. It is not a major slowdown, but clearly noticeable and disrupting to the gameplay. Not playing the music track with the AVAudioPlayer shows no slow down at all. How can I prevent this from happening? Thank you. Florian For future reference, here is the solution: Setting the audio session category to kAudioSessionCategory_AmbientSound (to allow for iPod music to play simultaneously)

Making a FPS shower? [closed]

北战南征 提交于 2019-12-01 07:31:16
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I am trying to make a string with FPS showing, but, how do I actually get my programs FPS? I want to do it with g.drawString(getFPS(), 10, 10) How do I get my FPS? 回答1: This code does it for me. Put it in your main program loop: //To Measure FPS private long now; private int

AVAudioPlayer - Drop in Framerate

﹥>﹥吖頭↗ 提交于 2019-12-01 05:38:42
问题 I have a quick question: I am loading a mp3 file into a NSData object and then I play it using the AVAudioPlayer in my game. Every second or so, the frame rate drops and you can see a stuttering on the screen. It is not a major slowdown, but clearly noticeable and disrupting to the gameplay. Not playing the music track with the AVAudioPlayer shows no slow down at all. How can I prevent this from happening? Thank you. Florian 回答1: For future reference, here is the solution: Setting the audio