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

02132010, 04:56 AM,




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. 

« Next Oldest  Next Newest »
