cocos2d-x support fixed frame rate?

void update(float dt) {}
dt is different in different device, some time is 0.016764000058174133, some time is 0.015915000811219215. 2d-x support fixed frame rate method? just like unity which support fixedUpdate and Update;

No, it doesn’t support.
mainloop is invoked from system, can not make sure it will update in fixed frame rate.
And if there is a lot of work in a frame, how to make sure fixed frame rate?

@zhangxm
in unity fixedUpdate intervals are consistent, which means that every intervals are same, such as 0.02,0.02,0.02… and update intervals are vary, which like 0.0166,0.0177,0.155… unity how to make the intervals are consistent in fixedUpdate? and cocos2d-x can support “fixedUpdate”, just like unity.

What you are asking is some real-time constraints. Why would you need something real-time or near real-time?

Natively, most consumer OS don’t provide this. Anything that try to do that (like Unity fixedUpdate) is probably a hack with some sleep() until you get to desired time.

Most apps don’t need anything nearly close to real-time. There are exceptions of course, like signal processing.

actually, i want to achieve a simple replay for my game.

my game is a simple football game, which you kick the ball (param: kick ball direction, kick ball power), ball will fly over the playground, and team players will trace the ball, team players will shoot the ball when touch the ball.

here i record kick ball direction, kick ball power and random seed, those params can make the ball have same track as same as the last, and team player moving track also as same as the last. because ball track is same, and players will trace the ball track, which make players track as same as the last.
but when fps changes, players shoot index call back was delay, which miss the ball, and then all replay are wrong.

anyone have idea about replay? or share some article…

Ok, so your actual problem is to have deterministic replay, so I can understand why you would want a fixed update rate.

Some good reads : http://gamedev.stackexchange.com/questions/19624/deterministic-replay-in-a-modern-game http://gamedev.stackexchange.com/questions/6080/how-to-design-a-replay-system

The problem seems to lie with your “players shoot index call back” : can you make that deterministic ? Otherwise, you may want to store more informations (which player kicked the ball when) to have a reliable replay. Or go overboard, and store the whole state every 0.1 to 1.0 seconds (perhaps a bit less or more), and simply animate through states (that’s actually what I used when I add to do a simple replay).