Page 1 of 2

The Importance of Math and Science in N

Posted: 2009.02.16 (07:17)
by Amadeus
Velocity

Now for a ninja to free fall full screen, it takes 96 frames. Considering that is approximately 23 squares, it is an average speed of 2.40 sq/frame. Remember that as the pull of gravity is constant, whether the ninja falls at an angle or straight down, it will pull at the same speed (there is no air resistance in N) The acceleration of a falling N is shown here:


Note: When running, the Ninja achieves maximum velocity at approximately 52 frames, or after approximately 7 squares of movement. If we consider a square as approximately 6 feet (according to the ninja's size) then that is after 42 feet, much less space then an actual athlete takes to achieve maximum velocity (aprox. 40 yards).
When falling, the Ninja achieves max velocity at 46 frames.

The farthest a ninja can free fall horizontally is across 13.5 squares

A launchpad meanwhile propels the ninja from 0/0 to 11sq/47 frames, for an acceleration of 0.23sq/frame

Now, when moving horizontally across a surface, N takes exactly 168 frames, and since it is 31 squares across, that is a rate of approximately 0.184 sq/frame, significantly slower. Here are the rates of enemies:


Frame By Frame: A Lifetime

A Ninja's lifespan is 90 seconds. At 40 frames per second, that is 3600 frames to a lifetime. A lot of maneuvering eh?
Well when put into perspective, one could fall more than 37 times, or run back and forth almost 22 times.

___________________________________________________________________________________________________________________________
Enemy's Speed


Vertical:

-Thwump (attacking): 127
-Thwump (returning): 315
-Attacking/Returning Ratio: approx. 1/2.5frames
-Laser Drone: 1238
-Chaingun Drone: 836
-Zap Drone: 312
-Seeker Drone: 144
-Seeker/Zap/Chaingun/Laser Ratio: approx. 1/1.48/3.97/8.6 respectively
-Rocket: 170

Horizontal:

-Floorguard: 138
-Thwump (attacking): 172
-Twhump (returning): 425
-Attacking/Returning Ratio: approx. 1/2.5frames
-Laser Drone: 1669
-Chaingun Drone: 1127
-Zap Drone: 421
-Seeker Drone: 194
-Seeker/Zap/Chaingun/Laser Ratio: approx. 1/1.48/3.97/8.6 respectively
-Rocket: 229

Now speeds come out like such, in squares/frame:

-N (falling): 0.240
-N (running): 0.184
-N (terminal falling): 0.340
-N (terminal running): 0.267
-Thwump (attacking): 0.181
-Thwump (returning): 0.073
-Laser Drone: 0.019
-Chaingun Drone: 0.028
-Zap Drone: 0.074
-Seeker Drone: 0.159
-Rocket: 0.135
-Floorguard: 0.225

In summary, enemy speeds are summed up in this order

N (terminal falling)>N (running terminal)>N (falling)>Floorguard>N (running)>Thwump (attacking)>Rocket>Seeker Drone>Zap Drone>Thwump (returning)>Chaingun Drone>Laser Drone

Basically, N can outrun zap drones, returning thwumps, chainguns and lasers. He is approximately the same speed as an attacking thump, but only if they both start at 0 sq/f. If the ninja has even a 1 frame running start, he will break ahead at the very end having achieved his terminal velocity more quickly.

N can outfall anything, unless you count NReality's wall floorguards, which I won't cover. Note that following gravitational acceleration, N accelerates as the map goes on, then hits terminal velocity. This is observed when the attacking thwump is in the lead for the majority of a free fall, until N accelerates and passes the thwump, which has a constant velocity. N however is constantly accelerating until terminal velocity...and is the only object in the game to do so, breaking the laws of physics.
____________________________________________________________________________________________

A gauss' aim and frequency algorithm is a gaussian curve (a bell curve) named after Carl Freiderich Gauss.
Shown with the equation
f(x)=ae-[(x-b^2)/2c^2]

See the attached picture for a visual aid of both velocity and gauss

_________________________________________________________________________________________________________


Momentum


Momentum is crucial for N. Without it, he couldn't jump, or slide. But what constitutes momentum?
A simple formula: mass*velocity=momentum

Now as N's mass is a constant, the only variable to change momentum is N's velocity. The faster N is going, the farther he is propelled. For example, when sprinting down 2-sloped tiles and then jumping off a cliff, N will be propelled farther than if simply running. This is the basic principle that causes N to go so far when propelled by a thwump cannon-it adds velocity which adds momentum, allowing N to go farther.

Momentum is also commonly needed to get through small gaps. The same principle applies, that N's velocity is greater when in free fall (see section on gravity acceleration in 'Velocity'), and so he can have greater momentum to get through the small cracks.

_____________________________________________________________________________________________________________________

Slope

This is one of the more obvious lessons. Here is a list of tiles slopes, of QWAS respectively:

1:
x=y
-x=y
-x=y
x=y

2:
2x=y
-2x=y
-2x=y
2x=y

3:
1/2x=y
-1/2x=y
-1/x=y
1/2x=y

4:
y= -sqrt(-x^2 + 1) for 0 < x < 1
y= -sqrt(-x^2 + 1) for -1 < x < 0
y=sqrt(-x^2 + 1) for 0 < x < 1
y=sqrt(-x^2 + 1) for -1 < x < 0

5:
Undefined
Zero
Undefined
Zero

6:
2x=y
-2x=y
-2x=y
2x=y

7:
1/2x=y
-1/2x=y
-1/x=y
1/2x=y

8:
y=sqrt(-x^2 + 1) for -1 < x < 0
y=sqrt(-x^2 + 1) for 0 < x < 1
y= -sqrt(-x^2 + 1) for -1 < x < 0
y= -sqrt(-x^2 + 1) for 0 < x < 1

E: x=0 or y=0

D: --

Speed per tiles (no propulsion) while falling:

1: 0.073
2: 0.152
3: 0.034
4: --
5: 0
6: 0.152
7: 0.034
8: --
E: 0
D: 0.240

Size

If the N game was in actual realistic terms, the ninja would be 5'8" tall. This would imply the tiles size would be 6 feet, meaning the dimensions of the game in feet is 144x186 feet or 26874 square feet.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (08:15)
by aapse
well.
seems like it took a lot of researching.

pretty interesting nonetheless.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (08:25)
by Amadeus
yes, it did

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (08:44)
by LittleViking
Pretty nice. The slopes for the 4- and 8-tiles are off. A circle's slope isn't the same as a parabola's slope. And the ninja has acceleration when he falls, so you'd have some more work to do to find the rate he actually falls at. Average speed is okay, but in certain cases the acceleration would play an important role.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (09:03)
by Amadeus
Done!
thanks for the constructive criticism

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (13:37)
by Izzy
First, the ninja is not named N, and it's gender is unknown. Thwumps aren't cannons either. I suggest you change that.

Second, this is cool.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (13:41)
by RandomDigits
Interesting.

One thing I noticed is the velocity of the enemies is the same horizontally as vertically. Does that mean you calculated it for 23 tile lengths too? Because the ninja's running velocity was calculated for 31.

Or do the enemies move slower horizontally? :p

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (17:24)
by Amadeus
My bad. Was being clumsy again and knew they were the same speeds, and didn't incoporate the different tile lengths...
ratios are the same though, as are their speed

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (18:26)
by OneSevenNine
I think the functions for 8 tiles, Q, W, A, and S, respectively, look something like:

y=sqrt(-x^2 + 1) for -1 < x < 0

y=sqrt(-x^2 + 1) for 0 < x < 1

y= -sqrt(-x^2 + 1) for -1 < x < 0

y= -sqrt(-x^2 + 1) for 0 < x < 1

The equations for 4 tiles' Q, W, A, and S, respectively:

y= -sqrt(-x^2 + 1) for 0 < x < 1

y= -sqrt(-x^2 + 1) for -1 < x < 0

y=sqrt(-x^2 + 1) for 0 < x < 1

y=sqrt(-x^2 + 1) for -1 < x < 0




Cool and interesting research, well done. Just one thing that I noticed: the ninja can definitely outrun attacking thwumps at top speed.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (19:02)
by otters~1
Very nice, especially the 'race' diagram at the end.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (19:21)
by Amadeus
Made a major error in horizontal calculations
Fixing now

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (21:59)
by lord_day
My N usually plays at 8 ms/f or 8 milliseconds per frame. Which is 125 frames per second, and doesn't seem right. Have I made a mistake?

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (22:18)
by KlanKaos
When you watch a demo and compare it to the time elapsed, it works out to 40 frames/second. I never could figure out how the 8 ms/f worked into it.

Anyways, this is really cool. I've been thinking about stuff like this for a while now, and even thinking about doing an extra-credit Physics project on N (kinematics FTW!). I now know I'm not the only one who thinks about these things.

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (22:24)
by Rose
Basically, N can outrun zap drones, returning thwumps, chainguns and lasers, but cannot outrun floorguards, attacking thwumps, seeker drones, and rockets
Huh? Last time I checked (3 seconds ago), the ninja can outrun rockets pretty easily.

This is very cool, though. I had no idea that sideways-moving thwumps were slower than downward-moving ones :P

Re: The Importance of Math and Science in N

Posted: 2009.02.16 (23:00)
by Amadeus
Maxson-the speeds are the same.however,the screen is not a perfect square resulting In different frame counts
Across, it is 31 squares, and down 23
Speeds are universal (besides N)

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (01:30)
by TheRealOne
There is also an interesting fact that n will hit the ground at the same frame whether he is falling straight down or at an angle, Making his falling speed when he is falling fully to the left or right, faster than falling straight. So if you could work out those vector addition formulas that would be a goo addition.

This same thing occurs when n jumps and will land on the spot that he could run to at the same time. So if you could work out his jumping velocities too that would be another good addition.

But, this is a great informative guide, I like it.

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (02:48)
by blackbelmoral
O_0
ughh
my head hurts.
i hope you fall off at 1 fps. and cant do a thing about it.
good though
how long did this take?

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (02:49)
by Amadeus
a while
I had to test everything multiple times
the frame counts are average, so shouldn't be off-and if they are, only so by a single frame

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (05:38)
by Amadeus
All fixed up, with a few minor additions. If theres anything wrong though, love to hear it!

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (07:44)
by SkyPanda
This is very interesting. Good job!

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (08:17)
by George
Useful if you want to think about N through maths and physics. Useless if you just want to play the game. :P

And lord_day, I imagine the 8ms/f is only a measure of how the speed of transition between one frame and the next. The game itself only records an action every 0.025 seconds, as you can see when you high score.

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (08:25)
by Rose
So a rocket is really faster than the ninja?

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (08:45)
by Amadeus
@maxson:no
@george:no. Speed matters a lot, from know which enemies can outrun you to timing in a dda

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (09:10)
by George
ganteka wrote:@george:no. Speed matters a lot, from know which enemies can outrun you to timing in a dda
What I'm saying is that these explanations only give you a further understanding and depth of knowledge into the physics of the game. It's not really going to help you any more with just playing the game.

And after playing a couple of columns, I think most people would've figured out what the ninja can and can't outrun.

Re: The Importance of Math and Science in N

Posted: 2009.02.17 (16:14)
by otters~1
I've often wondered how different N would be if floorguards, rockets, etc gradually gained speed instead of starting at max speed. N is the only object that builds up its speed. (I think). Makes the game much more interesting.