User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Problem with movement stuttering

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with movement stuttering

    Hello forum! In my game, I have a problem with my custom movement engine. When moving around, my character moves 2 pixels at a time. This is too fast, but if I reduce it to 1 pixel, it is too slow. 1 is after all half of 2, which means the speed gets reduced by 50%. So I use timeX, and add a small "every" to the movement conditions, so that my character moves by 2 pixels every 5 milliseconds. It isn't a big difference, but it helps. The problem is, using this condition, my character starts stuttering/lagging around every 2 seconds. I tried using the built-in "every" condition, but it doesn't support milliseconds. It only supports centiseconds (100th of a second).

    Can anyone explain to me why this is happening, or explain an alternative to using timeX? I need to move my character slower than 2 pixels at a time, but faster than 1 :P

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Use fastloop movement. Then you can move in smaller increments smoothly.

    I made an example of fastloop movement a while back. You can find it here: http://community.clickteam.com/showthread.php?t=62097

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. That is one way to do it, and it works nicely! There is one thing though; I've heard that fastloops can consume some memory, compared to other things. Will a fastloop movement consume conciderably more memory than a regular movement, or is it too small to notice? Movement for your main character is one of the most important things in the game, so I'd imagine if it does consume a noticeable amount of memory, that it still is important enough to keep, if it works :P

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Using fastloop for character movement isn't going to slow anything down at all. Fastloops only become an issue when you're iterating through tons of objects or doing too much in each loop. Simply moving a character with the x and y values isn't going to even be noticable. You'll just get the nice smooth movement you're looking for.

  5. #5
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Allright, thanks a lot I will be using that movement instead of the last one I used, because this one saved me from 3 active objects, is easier overall to work with, has less events and also it looks more professional You will be credited!
    I do on the other hand still kind of encounter the problem with the movement speed. If I set the movespeed value to 3, my character moves too fast. If I set it to 2, it moves too slow :P Is there a way to work around this?

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You'll have to adjust the frame rate... Basically what's happening is that the fast loop runs through the entire loop each game frame. So the faster your frame rate, the faster your loop finishes... Meaning you might be able to set my example to 60fps and get the result you want... or maybe 55fps.

  7. #7
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    You can use alterable variables to control the movement as they are able to contain floats whereas the standard x and y positions cant. So:

    start of frame (or whatever)
    ->set xspeed (alt. a) to 1.5
    ->set yspeed (alt. b) to 1.5

    always
    --> set x position to x position + xspeed
    --> set y position to y position + yspeed

  8. #8
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I reduced the framerate from 60 to 50. Allthough I noticed a small difference in smoothness, it wasn't a problem. The movespeed works now
    As for SolarB, I tried that solution earlier, but unfortunately it didn't work. Allthough you use variables that have floats, MMF will still round them up/down to the closest number when using coordinates. You can't move 1.5 pixels, even though that is the number stored in a value At least that's what I figured out when I tried :P

  9. #9
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    You need to store the actual positions in alterable values, not just the velocities.

    eg.

    + Always
    -> Set XPos to XPos + XVel
    -> Set YPos to YPos + YVel
    -> Set X position to XPos
    -> Set Y position to YPos

    Fastloops are totally unnecessary here - the screen is only redrawn after the loop has completed, so there's no difference in smoothness between moving 2 pixels once, or moving 1 pixel twice.

    I believe 60fps should give the smoothest results, as most monitors have a 60Hz refresh rate.

  10. #10
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    You need to store the actual positions in alterable values, not just the velocities.

    eg.

    + Always
    -> Set XPos to XPos + XVel
    -> Set YPos to YPos + YVel
    -> Set X position to XPos
    -> Set Y position to YPos
    Nope, can't get it to work. If anyone cares to make an example to prove that it works, please feel free! Otherwise I will be going with a different solution

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Frame Rate Stuttering
    By netninja in forum SWF/Flash Export Module Version 2.0
    Replies: 25
    Last Post: 6th July 2012, 01:22 PM
  2. Bomberman movement problem
    By Prome in forum File Archive
    Replies: 3
    Last Post: 13th June 2011, 11:03 PM
  3. Pinball movement problem
    By Marcelo in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 12th December 2008, 09:13 AM
  4. Custom Movement problem (Horizontal movement)
    By KiteRyagara in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 7th June 2008, 03:40 PM
  5. Sound stuttering
    By Stereotype in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 30th January 2007, 08:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •