Why does setting frameInterval on a SKView not work?

258 views Asked by At

I'm trying to reduce the framerate to a maximum of 30 FPS. The official documentation says to use:

skView.frameInterval = 2;

I read through all the available documentations as well as every similar question asked here on stackoverflow or in other pages/blogs/etc. I tried it in so many ways but where ever I tried to set the property it did not affect the FPS.

I am not using any other timing mechanisms than those from SpriteKit. I am setting it up accordingly to the documentation and to the answers here on Stackoverflow.

I even started the basic SpriteKit template provided with Xcode and tried to set the frame rate property but even that did not work out.

Does anyone experience any similarities? Is there an alternative way to reduce max fps? What else can I try to reduce FPS?

BTW.: I am working on OS X and have a first-gen Retina Macbook Pro - Maybe it's a hardware issue?

EDIT:

I am not overriding the -(void)update: method - only -(void)didSimulatePhysics

This is what I do in a NSViewController Subclass which I set in Interface Builder. self.spriteKitView is an outlet to the NSView of my NSViewController-Subclass

-(void)setupSpriteKitView {

    self.spriteKitView.frameInterval = 2;
    self.spriteKitView.ignoresSiblingOrder = YES;
    self.spriteKitView.showsFPS = YES;
    self.spriteKitView.showsDrawCount = YES;
    self.spriteKitView.showsNodeCount = YES;
}

-(void)viewDidLoad {

    [super viewDidLoad];
    [self setupSpriteKitView];
    [self loadStartupScene];
}

I even tried to put this into my SKScene-Subclass, attach it as user-property inside Interface Builder to the SKView.

How I now it's not working? Both in my game and the Xcode template the debug output says 60 FPS. And even when reducing skView.frameInterval = 4 the animations stay smooth.

1

There are 1 answers

2
Simon Kemper On

Ok! Since working hours on that figuring out what I am doing wrong I tested the Xcode SpriteKit template. Surprisingly even this Apple provided sample code does not react on the skView.frameInterval property.

So I was thinking of a hardware bug and searched the apple forums for that. What I found were a few people complaining about the same problem and surprisingly Apple does know about that FPS-Bug and will fix that in el capitan ... Hopefully ... I'm going to test the dev prerelease!

However, there are quite some more bugs in SpriteKit on os x! For example when switching a window into fullscreen the FPS drop sporadically by an undefined amount. It's a bit messed up!

EDIT:

Thanks to @EpicByte I found some reasons and answers. See his explanation in the comments above!