Update loop at different interval than render loop?

Hi everyone,

I’m trying to figure out if it’s possible to have the update loop run at 60 FPS, while the rendering loop only runs at 30FPS?

What would be the best way to achieve this?

Cheers

You can try modifying the platform renderer classes (for example Cocos2dxRenderer.java for Android) to skip every second frame - that way on Cocos side everything runs at 60fps, and at platform side you render at 30fps.

Of course the obvious drawback to this is that if you experienc fps loss at Cocos side you will also see a drop in rendering.

Yup, that’s what I’m doing so far. And the drawback you mention is what I want to avoid :slight_smile:

It’s important that the game runs at 60 FPS in case a slow running device is the server for a BT/WiFi game session. Otherwise it will visually slow down the faster running device. I used to have detached update and draw loops in XNA, that’s why I thought there might be a hidden way Cocos2D-x also thought about this.

Well, have you considered explicitly creating a thread to do the heavy(math?) work?
This way you can set the FPS the traditional way to 30, and have a second thread running in the background.
Of course to have it totally independent from cocos update loop you won’t be able to use cocos-derived classes (and classes inheriting from them) there (At least I think you won’t) so it may be a little pain in the ass.