How do I fix lag on moving actor?

ohtukrwohtukrw Sir dogeMember Posts: 106
edited July 2016 in Help Wanted

My endless looping image to -200 x direction is lagging, literally nothing else on the project as I am testing performance on android :(

Maybe I could add some rules or something, please post your experience if you fixed lag in your game.

Backstage settings:

For movement.
1) Rule
if self.position.x = 0
do (change attribute) set self.position.x to 667

I have heard of the term ''recycling'' the actor does this have anything to do with it?

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @ohtukrw

    how are you moving the actor? With the "Move" behavior?
    how large is your actor?
    what exactly do you mean by lagging?

    As an aside, your 1)Rule should rather be if self.position.x <= 0. If you move the actor, its position may never be precisely 0, so it is better to use "less than".

    You 3)Rule is unnecessary since you take care of this with the proper 1)Rule.

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    @Hopscotch said:
    @ohtukrw

    how are you moving the actor? With the "Move" behavior?
    how large is your actor?
    what exactly do you mean by lagging?

    As an aside, your 1)Rule should rather be if self.position.x <= 0. If you move the actor, its position may never be precisely 0, so it is better to use "less than".

    You 3)Rule is unnecessary since you take care of this with the proper 1)Rule.

    I move it by changing actor's linear velocity x to -200, also there is a wrap X option checked in scene options. It is w1024 x h512. Lagging - it doesn't loop smoothly like it should, image stops for a couple milliseconds, but it's visible.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @ohtukrw

    If you have wrap on, then you don't need the rules checking the x position, as the system takes care of it.

    Do you see the lag on the device or just in preview? Preview can show some jitter, but I find that it is usually smooth on the device.

    Of course, it does depend on the speed of your device.

    What are the dimentiones of your actual image?

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    @Hopscotch said:
    @ohtukrw

    If you have wrap on, then you don't need the rules checking the x position, as the system takes care of it.

    Do you see the lag on the device or just in preview? Preview can show some jitter, but I find that it is usually smooth on the device.

    Of course, it does depend on the speed of your device.

    What are the dimentiones of your actual image?

    It doesn't move without the rule
    if self.position.x = 0
    do (change attribute) set self.position.x to 667

    Yes I am testing on my android device. Galaxy s4. Image 1054 x 512.

    Tried using
    constrain attribute self.position.x to self.position.x-3
    instead of physics velocity, but that didn't sort out the problem.

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    Is it possible to just make the background static and the hero to move itself through a single image background??? Has anyone done this before in here? I need to fix that lag...

  • ohtukrwohtukrw Sir doge Member Posts: 106

    bump.

  • SocksSocks London, UK.Member Posts: 12,822

    @ohtukrw said:
    bump.

    Can you upload a copy of the project ?

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    @Socks said:

    @ohtukrw said:
    bump.

    Can you upload a copy of the project ?

    I am not sure If I am allowed to upload as non paid user.

    Link:

    http://www4.zippyshare.com/v/J7ibduZL/file.html

  • SocksSocks London, UK.Member Posts: 12,822

    @ohtukrw said:
    I am not sure If I am allowed to upload as non paid user.

    You are fine providing a link to an external upload site.

    The project loops perfectly for me on iPhone6+, iPadAir2 and iPad3.

    The rule 'if x = 0 then change x to 667' has no effect on the project (see what @Hopscotch says above) - it's unnecessary. Deleting it makes zero difference to the project.

    Your image size is not very memory efficient, a 1337 × 356 pixel image uses up a 2048 x 512 pixel chunk of memory.

  • ohtukrwohtukrw Sir doge Member Posts: 106
    edited July 2016

    www4.zippyshare.com/v/J7ibduZL/file.html> @Socks said:

    @ohtukrw said:
    I am not sure If I am allowed to upload as non paid user.

    You are fine providing a link to an external upload site.

    The project loops perfectly for me on iPhone6+, iPadAir2 and iPad3.

    The rule 'if x = 0 then change x to 667' has no effect on the project (see what @Hopscotch says above) - it's unnecessary. Deleting it makes zero difference to the project.

    Your image size is not very memory efficient, a 1337 × 356 pixel image uses up a 2048 x 512 pixel chunk of memory.

    It loops without lagg? Because lagg was the issue, maybe because I am on android.

Sign In or Register to comment.