User Tag List

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

Thread: Dead Reckoning

  1. #1
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dead Reckoning

    How would I use dead reckoning to determine the position of a ball in pong? I've made a program that switches whether the ball is following the other client's or if it was local, but it makes the ball lag when it crosses the center.

    I have a bouncing ball movement, 32 direction, and I have the speed, direction, and last X/Y before crossing the line. I know I could think of the formula if I was fully awake but right now I'm really exhausted!

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    A pong game doesn't need much dead reckoning because the ball moves in a straight line.

    When a ball bounces on a paddle or wall, simply bounce it then send it's new direction and the X Y coordinates of the bounce to the other client.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    That still causes lag, because of the X and Y coordinates. And that's not what I'm talking about.

    I have the ball be bouncing locally when it's on your side. So the ball isn't being positioned or controlled by another client when you try to hit it. When its on your side, the other client receives the X and Y through blasting. Then, when it crosses, a message is sent with the speed/direction/X and Y and the other client runs the ball locally, blasting the X and Y. BUT by the time the other user runs it locally, the ball on the first client has already moved. It quickly jumps back after receiving the first blast.

    So I have a couple options. I could make it only blast when its on a smaller part of their side, or I could use dead reckoning. I realize that your idea is a good concept, but I've tried it that way and I didn't like it much.

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    Dead reckoning just means moving it forward by the latency of the connection (which I'm pretty sure lacewing will tell you). Formulae for 360 degree fps-independent movements are useful here, because you can plug any time into them you want. In this case, plug in the latency and you have instant dead reckoning.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    If you just want a smoothing algorithm then Linear Interpolation is good to use for simplistic movements such as this.

    I used it quite a bit when programming Faerie Solitaire to smoothly move objects between two points in a given time interval.

    Doing a linear interpolation is equivalent to a bezier curve with two points:

    http://en.wikipedia.org/wiki/B%C3%A9zier_curve

    Specifically you want this formula:
    [img:left]http://upload.wikimedia.org/math/a/d/9/ad90a6fecd5324dc32f75f0b19c2d684.png[/img]

    It might look a little complicated but it's quite simple when you put it into MMF. You will need to use it once for the X coordinate and once for the Y. In simpler terms it looks like this:

    X2 = X0 + t*(X1 - X0)

    Where X2 = Current X Position (ie. Always set ball position to X2)

    X0 = Initial X position (ie. the X position that the ball is at when you receive the X/Y Coordinates from the other client)

    X1 = Final X position (ie. the message received from the player that tells you where the ball is really meant to be)

    t = timestep value. A number from 0.0 to 1.0. This is just a counter that you need to increase on every MMF Loop by a certain value. The speed at which you increase this is the speed of the smoothing. Start off with something like "Always add 0.05" and go from there, tweaking it to taste. If you know the average latency then you can scale this timestep so that it moves faster or slower depending on the lag.

    Do the same for the Y Position:

    Y2 = Y0 + t*(Y1 - Y0)

    And the ball will move smoothly between the two points.

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    I just made an example so you can see the effect quickly:

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=177869

    I think it will be very suitable for your project.

  7. #7
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Sep 2006
    Location
    Norway
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    Thats ace!
    Jean Villy Edberg

  8. #8
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    Good stuff! Perhaps I should add that to Lacewing

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    I'm glad you guys find it useful

  10. #10
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Dead Reckoning

    Ok, that still doesn't solve the problem with the dead reckoning for me. I've thought of many solutions but can't test them out because Aquadasoft.com isn't working and Klikfarm's blast is messed and localhost is too fast for me to tell if it's working or not :/

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Dead Reckoning
    By Sumo in forum Lacewing
    Replies: 5
    Last Post: 19th January 2010, 09:55 PM
  2. Dead Reckoning?
    By Game_Master in forum Lacewing
    Replies: 6
    Last Post: 30th December 2009, 05:34 PM
  3. Dead reckoning for dummies?
    By Tiny in forum Lacewing
    Replies: 5
    Last Post: 31st December 2008, 02:06 PM
  4. Need some dead reckoning help
    By SEELE in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 27th August 2008, 02:07 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
  •