User(s) browsing this thread: 1 Guest(s)
Hyperjumping calculation (server part)

02132010, 04:56 AM
Post: #1




Hyperjumping calculation (server part)
Hi all.
Lets talk about something good. Theory about how hyperjump works in the server part. You all must have notices that hyperjump looks like a giant parabola. But how all that works?. MATH CONTENT ALERT !!MATH CONTENT ALERT !! First part, client request Client sends a packet requesting hyperjump to server. That packets includes very specific content: initial point (Xi,Yi,Zi), the max height of the jump (Ymax) and the destination point (Xf, Yf, Zf). Math requirements The parabola used for hyperjump follows the squared X parabola, X^2. Math expression for x^2 is y = a·x^2 + b·x + c To solve this equation and get "a,b,c" values, you need to make 3 ecuations. So lets take our 3 data from client's request. First we forget about Z axis, we will handle it later. Then we got the initial point, so (Xi,Yi), the final point (Xf,Yf) and the Y for another point (Ymax). We lack of one value, but as we are working with 2D and theory says that the hip of the parabola is on the half of X axis, we can calculate is as: Xmed(Xf  Xi / 2) Solving the equation As we are not as good as machines, let them do the work for us!! We got a system of 3 ecuations and 3 unknown values so: Code: Xi ·x^2 + Xi ·x + c = Yi We will turn this into a matrix of double numbers and applicate GaussJordan elimination, to solve it. Gaussian Elimination (wikipedia), to know more From this: Code: Xi ·x^2 + Xi ·x + c = Yi To this (output from GaussJordan): Code: a 0 0 value1 Then we can assume that our hyperjump ecuation goes as: y = value1 · x^2 + value2 · x + value3 With that expression, we can calculate any Y for any X that we want in the range that we used (Xi to Xf) with more or less precission. Turning 2d into 3d theory As you could see on real life, drawing on a paper, a line between 2 points is just the combination of their coords in the 2d plane, so mxo coords x and Z, could be treated as that. Just knowing the initial and end X & Z values, we can do (Xf  Xi) / numPacketsNeeded and we will get the increment needed to go from one packet to other (same for Z axis). This can be done on paper, try it. So we calculate, lets say 50 divisions of the axis, for 50 packets and have, 50 X's and 50 z's. Then we can calculate 50 Y's applicating the mxo formula to the X values. Of course, drawing a line from one X Y Z point from that list to the next one in a big list of points, you create the ilusion of a curve from the eye view. Splines (wikipedia), to know more. Basicly, you can say that we throw a wire from initial point to the end point and then, took the middle and bring it up, creating a curve (same effect ). Testing theory on the battlefield To test that it worked, i created a little 3d simulation where I could see the differences (draw 2 jumps) between a logged hyperjump and the simulation of coords. Moved a ball leaving trail, firstly yellow, to pass through a logged hyperjump, starting from one building and landing at the street floor. Test was done using a 96 packets log extract. Then, a second ball starting at same point, goes through 96 points but calculated dinamically using the parabola autocalculated through gaussjordan, leaving a white trail behind. This is a shot of the current project testing simulation (yeah its in 3d and you can zoom & rotate... über cool!) As you see, the percentages are high, so we can say that we may have matched the right formula, but the end point, as second ball gets bit up than the logged one. That can be fixed sending another landing packet with the right end coords, after the travelling. Hope that you enjoy the tests . Morph. http://twitter.com/johnkussack [twitter] 

02132010, 05:04 AM
(This post was last modified: 02132010 05:05 AM by Gerik.)
Post: #2




RE: Hyperjumping calculation (server part)
*FAQs List: Read Here First Before Posting Or You Get Raped In The Face 

02132010, 06:38 AM
Post: #3




RE: Hyperjumping calculation (server part)
if you exploded with this, wait for the "how to know what clients will receive my chat" explanation...
This was pretty simple, to be honest... http://twitter.com/johnkussack [twitter] 

02132010, 06:49 AM
(This post was last modified: 02132010 06:50 AM by Bayamos.)
Post: #4




RE: Hyperjumping calculation (server part)
Dunno if you're using a library method or not, and I doubt it really matters since it's 3x3, but GaussJordan is slower than Gauss/backsubstitution; I think it ends up introducing slightly less accurate results as well if you're using floating point. /shrug


02132010, 06:57 AM
(This post was last modified: 02132010 08:05 AM by Sixxth.)
Post: #5




RE: Hyperjumping calculation (server part)
(02132010 06:38 AM)Morpheus Wrote: if you exploded with this, wait for the "how to know what clients will receive my chat" explanation... So, got the math  Im an engineer FFS, so no issues there for me SO, will you use the existing animation? Actually, it seemed like there were a couple of animations depending on how high you were/how long the fall was, but whatever. Would be awesome to have hyper jump back for sure  but how about little jumps over things, jumping off roofs etc? Same calculation I'm guessing? This is fascinating for me, prio to the MxOEmu, I always assumed that all the jumps were client side things, not server.... 

02132010, 08:26 AM
Post: #6




RE: Hyperjumping calculation (server part)
Sexiest...post...EVER!


02132010, 09:15 AM
Post: #7




RE: Hyperjumping calculation (server part)
(02132010 06:49 AM)Bayamos Wrote: Dunno if you're using a library method or not, and I doubt it really matters since it's 3x3, but GaussJordan is slower than Gauss/backsubstitution; I think it ends up introducing slightly less accurate results as well if you're using floating point. /shrugOh well i'm not a math boy, just tested with my knowledged, as matlab used Gauss/Jordan for my tests, then passed to python code to simulate in custom 3d. Did in Matlab, then checked if same a,b,c in pyth code. Anyway, as long as you are able to pass and receive a matrix, code could work with the math function as a blackbox. I would like to do benchmark with the one you mentioned though (02132010 06:57 AM)Sixxth Wrote: So, got the math  Im an engineer FFS, so no issues there for meClient calculates if there is a building or crap like that. That's the red cross when you hyperjump or so targeting. I've never done it on real server but did on emu. Saw the flips and so. Animations and that thing is what's sent by server, along the coords explained above. Anyway, any question related or critics are welcome . PS: at last! college maths serve for a purpose! XD http://twitter.com/johnkussack [twitter] 

02132010, 02:11 PM
Post: #8




RE: Hyperjumping calculation (server part)
now do the untargeted hyperjump !


02132010, 04:15 PM
Post: #9




RE: Hyperjumping calculation (server part)
ctrl + space = random hell
But fascinating post Morph, I'm glad you can juggle those calculations. "We die because the people are asleep...you will die because the people will awaken"Carl Sandburg 

02132010, 04:29 PM
Post: #10




RE: Hyperjumping calculation (server part)
i rebound mine to T
so i can just HJ everywhere, very useful, much faster than running if theres a lot of obstacles in between (like DT) 

« Next Oldest  Next Newest »
