Unsmooth Motion: pause 0.05 second every moving 50 pixels

Thanks for reading.

I am making a top-down-view 2D racing game. I found that when the speed of the car is about 100 pixels per second, the motion becomes unsmooth: it’s like pausing for 0.05-0.1 second moving every 50 pixels. The fps is about 58-62. Actually this problem happens also for slower motion like speed as 20 pixels per second, but not very obvious. I am using iMac Mac OS 10.6.5, Corona build 268.

I am using two methods for creating the motion:

  1. using the built-in body:setLinearVelocity
  2. changing the x and y positions of the car frame-by-frame by listening to enterFrame event

Thanks very much. [import]uid: 12769 topic_id: 7027 reply_id: 307027[/import]

Is your second method delta time corrected? Does you way of applying forces maybe needs to be delta time corrected?

I am surprised that you notice a pause of 0.05 seconds. Framerate drops of 3 FPS is nothing you can do much about, I consider them normal within a LUA anvironment. Let the Lua garbage collector kick in and you will see such a slight drop easily. And the GC will kick in, it is just about when and how much work it has to do.
I am using a brute force method and collect everything in each frame. It kills around 2-3 FPS in total but I don’t care if the app is running at 60 or 58 fps.

Cheers
Michael Hartlef

http://www.whiteskygames.com
http://www.twitter.com/mhartlef
[import]uid: 5712 topic_id: 7027 reply_id: 24650[/import]

Thanks for your reply.

I didn’t check the delta time. Method 1 is supposed to show smooth motion, however, method 1 and method 2 show the same problem.

For method 1, I just created a display.circle and let it fall by gravity. The falling has about 3-5 pauses throughout the vertical screen. 0.05 second is just an estimated value.

Moreover, the sample codes do not have this problem because they use 30 fps. [import]uid: 12769 topic_id: 7027 reply_id: 24658[/import]

I have tried to change the fps to 60 for the sample DragPlatforms.
This problem also exists. The falling has some pauses. [import]uid: 12769 topic_id: 7027 reply_id: 24662[/import]

Which FPS value is your physics on? You can set them seperately. Try to play with that. [import]uid: 5712 topic_id: 7027 reply_id: 24669[/import]

Thanks for your reply.

I set the fps to 60 in config.lua .
What do you mean by setting them separately? [import]uid: 12769 topic_id: 7027 reply_id: 24867[/import]

Sorry I ment the scale:

http://developer.anscamobile.com/content/game-edition-box2d-physics-engine

Look into scale, PositionIterations and VelocityIterations. That might help.

[import]uid: 5712 topic_id: 7027 reply_id: 24870[/import]

Thanks for your reply.

I have followed your link and tested these three parameters with a lot of values. Still the same… Thanks.

What else could cause this problem? [import]uid: 12769 topic_id: 7027 reply_id: 24878[/import]

Don’t know, I don’t notice what you have mentioned. [import]uid: 5712 topic_id: 7027 reply_id: 24887[/import]

Thanks for your reply.

I would like to ask Ansca staff a question. Does the running of simulator continuously write files e.g. log files or some memory data to drive?

I am using a network account so all my data is stored in a network drive. Could it be the threshold of running 60 fps? Thanks. [import]uid: 12769 topic_id: 7027 reply_id: 25115[/import]