Map moving with lags?

I have a character the camera is following and when doing so the map is scrolled in the background.

I’ve noticed some tiny lags in the map movement. It is not smooth 100% and lags each 2 seconds or so.

Is there something I can look into here to get a 100% smooth map movement? I’ve tried everything from setDamping to setTrackingLevel but the lag is always noticeable.

Any help welcome!

Can you post code? Like how you move the character or map.

–SonicX278

It’s a little difficult to extract the code from the modules, but it’s nothing fancy, just a character movement which looks smooth and the map following because of the camera settings in the background.

I also have some update on the issue: The lag of the camera follow of the map background seems only to happen on the simulator. I just tested on an iPad and it looks smooth there.

Does this lag occur only when you move, or does it also occur when you’re standing still?

Also, can you describe your map’s size of tiles, size of map, number of layers, etc.?

  • Caleb

The lag only occurs when moving. The map is relative small with around 25x25 32px sized tiles using 5 layers and no parallax.

On the device it looks smooth so far. I noticed the lag in the simulator and I was afraid it will look the same on devices… but so far (fingers crossed) no lag :slight_smile:

Hm. I think your problem may be Lua’s garbage collector. Lua runs its garbage collection routine every so often, and when Dusk removes a lot of tiles due to map movement, you could be feeling it when the garbage collector runs.

For now, if your game’s working on device, I wouldn’t worry about it.

  • Caleb

Can you post code? Like how you move the character or map.

–SonicX278

It’s a little difficult to extract the code from the modules, but it’s nothing fancy, just a character movement which looks smooth and the map following because of the camera settings in the background.

I also have some update on the issue: The lag of the camera follow of the map background seems only to happen on the simulator. I just tested on an iPad and it looks smooth there.

Does this lag occur only when you move, or does it also occur when you’re standing still?

Also, can you describe your map’s size of tiles, size of map, number of layers, etc.?

  • Caleb

The lag only occurs when moving. The map is relative small with around 25x25 32px sized tiles using 5 layers and no parallax.

On the device it looks smooth so far. I noticed the lag in the simulator and I was afraid it will look the same on devices… but so far (fingers crossed) no lag :slight_smile:

Hm. I think your problem may be Lua’s garbage collector. Lua runs its garbage collection routine every so often, and when Dusk removes a lot of tiles due to map movement, you could be feeling it when the garbage collector runs.

For now, if your game’s working on device, I wouldn’t worry about it.

  • Caleb