User Tag List

Results 1 to 6 of 6

Thread: Gravity and Time Slowdown

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Gravity and Time Slowdown

    Hi
    Im a bit ashamed about asking for help abot something this simple, but im having a hard time wrapping my head around this for unknown reasons.
    Hopefully the answer will come to me while writing this post, but maybe not.
    I am using FloatingPoint possitions for the Objects.
    ...
    Like the Topic says, ( 1 ) i have an Object affected by Gravity, and ( 2 ) i want to be able to slow time down ( to a complete pause or even doubble speed ).
    First i will explain how this works at normal speed, half speed, and them quarter speed. Hopefully this will be able to shed some light on the issue.

    ...
    ( - NORMAL SPEED -)

    Allways
    - Object add 1 * 1 to Gravity_

    Allways
    - Object set Ypossition to 'Object Ypossition' + Gravity_


    The above code results in Object moving exactly 1 pixle during the cource of 1 Game Frame.
    - 1 is added to Objects Gravity_
    - Object moves 1 pixel

    ...

    ( - HALF SPEED -)

    Allways
    - Object add 1 * 0.5 to Gravity_

    Allways
    - Object set Ypossition to 'Object Ypossition' + Gravity_


    The above code results in Object moving exactly 1,5 pixles during the cource of 2 Game Frame, when it should be 1 pixel since speed is only halved and should move 1 pixel during 2 Game Frames.
    - 0.5 is added to Objects Gravity_ ( total 0.5 )
    - Object moves 0.5 pixel ( total move 0.5 pixels )
    - 0.5 is added to Objects Gravity_ ( total 1 )
    - Object moves 1 pixel ( total move 1.5 pixels )

    ...
    ( - QUARTER SPEED -)

    Allways
    - Object add 1 * 0.25 to Gravity_

    Allways
    - Object set Ypossition to 'Object Ypossition' + Gravity_


    The above code results in Object moving exactly 2,5 pixles during the cource of 4 Game Frames, wich is not correct since game is at quarter speed and should move 1 pixel during 4 Game Frames.
    - 0.25 is added to Objects Gravity_ ( total 0.25 )
    - Object moves 0.25 pixel ( total move 0.25 pixels )
    - 0.25 is added to Objects Gravity_ ( total 0.5 )
    - Object moves 0.5 pixel ( total move 0.75 pixels )
    - 0.25 is added to Objects Gravity_ ( total 0.75 )
    - Object moves 0.75 pixel ( total move 1.5 pixels )
    - 0.25 is added to Objects Gravity_ ( total 1 )
    - Object moves 1 pixel ( total move 2.5 pixels )

    ...
    ( - SOLUTION -)

    In the Half Speed example, to end up with the correct number of pixels moved ( 1 pixel moved during 2 Game Frames ), i have to add 1/3 to Graity_ each Game Frame instead of 0.5.
    - 0.3333 is added to Objects Gravity_ ( total 0.3333 )
    - Object moves 0.3333 pixel ( total move 0.3333 pixels )
    - 0.3333 is added to Objects Gravity_ ( total 0.6666 )
    - Object moves 0.6666 pixel ( total move 0.9999 pixels )

    In the Quarter Speed example, to end up with the correct number of pixels moved ( 1 pixel moved during 4 Game Frames ), i have to add 1/10 to Graity_ each Game Frame instead of 0.25.
    - 0.1 is added to Objects Gravity_ ( total 0.1 )
    - Object moves 0.1 pixel ( total move 0.1 pixels )
    - 0.1 is added to Objects Gravity_ ( total 0.2 )
    - Object moves 0.2 pixel ( total move 0.3 pixels )
    - 0.1 is added to Objects Gravity_ ( total 0.3 )
    - Object moves 0.3 pixel ( total move 0.6 pixels )
    - 0.1 is added to Objects Gravity_ ( total 0.4 )
    - Object moves 0.4 pixel ( total move 1 pixels )

    ...
    The solutions in the later part of this post has mainly been a result of my guesswork and testing, i do not understand the logic behind any of the numbers ( 1/3 1/10 ).

    My problem is:
    When 1 Game Frame spans acoross multiple Game Frames ( Time is slowed down ), i dont know how to correctly increase Gravity_ each Game Frame ( so that in the end, distance traveled will be exactly the same as if Normal Speed )

    I know that exactly what im asking about might be a bit vague and maybe not very clear, but i hope i have managed to make you understand my situation through the examples.
    Im still working on this and very much appreciate and need all the help i can get, so i can get this working correctly and move on.

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    XStar's Avatar
    Join Date
    Feb 2012
    Location
    Winchester, VA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a good example to help solve your problems! (Hopefully)
    Attached files Attached files

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Funny, that was the original example wich set me out on this quest in the first place.
    I know that an aledged solution to this problem should be in there ( at line 44 i think ), but as i have began to do my own calculations on the issue i am beginning to doubt the method used in the example.

    I have tried to explain my issue in a shorter and better way in another thread and have managed to get a solution.

    Anyway thanks for helping

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    XStar's Avatar
    Join Date
    Feb 2012
    Location
    Winchester, VA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your welcome!

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Just reading it as best as I can, if I'm understanding your problem, its likely that MMF2 is treating X&Y positions only as integers- when you add 0.5 to them, it has no effect for example. They always round to the lower integer unless you make it do otherwise, but it will always wind up an integer; 1 2 or 3, but never 1.5. So when you're adding 0.25 to the gravity value and the gravity to its y position, it will only start moving once gravity = 1, and then twice as fast as it hits 2, and never smoothly. Which looks terrible.

    The trick most people use is to store your X&Y coordinates in alterable values, and store them at 1000x the size or something. For example:

    Start of Frame:
    ValYpos of Object = Object Y Position * 1000

    Always:
    Add 200 to ValGravity of Object
    Add ValGravity of Object to ValYpos of Object
    Set Y Position of Object to Round(ValYpos of Object / 1000.0)

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pixelthief, i am aware of this and am using FloatX_ and FloatY_ Alterble Values. This is not the problem.

    ...
    I have been following this thread by Dines
    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=98255#Post98255
    The example posted by XStar is atached in that thread.

    The first post in the thread explaing everything about time-slowdown clearly and in an understandable manner, until explainging 'Gravity Slowdown' that is.

    ...
    Basically how to slow down general game speed ( as explained in thread ):
    If time is slowed down to 50%, you simply multiply speed by 0,5. This sound correct.

    The Gravity Slowdown problem:
    Gravity however is increased every frame.
    So lets say Gravity is increased by 1 every frame ( att 100% game speed ).

    Object is pulled down
    - 1 pixel the fist Frame,
    - 2 pixels the second Frame ( Object has moved 3 pixel in 2 Frames ).

    The Gravity Slowdown solution ( as explained in thread ):
    If time is slowed down to 50%, you simply multiply Gravity by 0,5. This doesnt sound right to me, and ill explain.

    So lets say Gravity is increased by 1 every frame ( att 100% game speed ).

    Object is pulled down
    - 0.5 pixels ( 1 * 0.5 ) the first Frame,
    - 1 pixels ( 2 * 0.5 ) the second Frame,
    - 1.5 pixels ( 3 * 0.5 ) the third Frame,
    - 2 pixels ( 4 * 0.5 ) the forth Frame ( Object has moved 5 pixel in 4 Frames ).

    ...
    Can you see how this is wrong?
    At 50% Game Speed, Gravity is moving the Object 5 pixels while at 100% Game Speed it is moved 3 pixels.

    ...
    Either im totally misunderstanding the explenation by Dines ( in the thread ), wich i dont think i am, or the Gravity Slowdown Solution in the thread is faulty and inacurate.

    In the other thread i made about this problem, i found out that the solution actually lies in a mathematical consept called 'Triangle Numbers', and MuddyMole helped me the correct equation wich correctly adjusts the Gravity increase.

    As i allready said, i might by missunderstanding Dines explenation about this Gravity Increase solution ( but i dont think i am ).

Similar Threads

  1. slowdown in mmf!
    By Mart393 in forum Hardware Accelerated Runtime
    Replies: 0
    Last Post: 31st October 2013, 06:17 PM
  2. time/split time for racing game
    By ptiseigneur in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th September 2012, 06:05 PM
  3. [Info] MP3 SLOWDOWN
    By life2searching in forum XNA Export Module Version 2.0
    Replies: 4
    Last Post: 10th July 2011, 02:05 PM
  4. Make a time machine run with lower time complexity
    By Pixelthief in forum Multimedia Fusion 2 - Technical Support
    Replies: 48
    Last Post: 12th March 2009, 10:10 PM
  5. Causes of slowdown
    By stuckboy in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 22nd December 2007, 09:20 AM

Posting Permissions

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