Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Map moving with lags?
Started by d.mach Dec 18 2015 06:58 AM

5 replies to this topic
dusk camera settrackinglevel setdamping map movement
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 885 posts
  • Corona SDK

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!



[TOPIC: post.html]
#2

InfiSnyp

[GLOBAL: userInfoPane.html]
InfiSnyp
  • Corona Geek

  • 1,494 posts
  • Corona SDK

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

 

--SonicX278



[TOPIC: post.html]
#3

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 885 posts
  • Corona SDK

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.



[TOPIC: post.html]
#4

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

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



[TOPIC: post.html]
#5

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 885 posts
  • Corona SDK

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 :)



[TOPIC: post.html]
#6

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

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




[topic_controls]
[/topic_controls]