Page 1 of 1

the physics is broke'd!

Posted: 31 Oct 2007, 06:42
by Zao
Pythagoras has been neglected!

one runs twice as fast when running diagonally

what about conservation of momentum? :/

Posted: 31 Oct 2007, 18:08
by Saphy
It isn't physics, it is just that characters are more emotionally incided to run faster diagonally. :p

Posted: 01 Nov 2007, 01:50
by Modanung
They run 1 / sin(45) times as fast. But yes, I agree it's wrong.

Posted: 01 Nov 2007, 19:40
by Zao
Modanung wrote:They run 1 / sin(45) times as fast. But yes, I agree it's wrong.
will you show me a proof of this? Not because it's serious business, just for fun and to clear up my misconception.

My logic behind saying twice is fast is that when you hold the right arrow while pressing up and down you don't lose any speed in the x direction while you traverse y, so I conclude that no velocity is lost and so both y and x must add completely to double the value.

Or do you mean the individual projections onto y and x are 1/sin(45) as fast.

Posted: 01 Nov 2007, 22:54
by Modanung
Adding vectors doesn't work that way.
Lets say by pressing right the speed of the character is set to (1 , 0) and by pressing up it is set to (0 , 1). Pressing both results in a speed vector of (1 , 1). But that doesn't meen the speed is 2.
The speed is equal to the diagonal of a 1x1 square which is the same as the longest side of a right isosceles triangle. Which is equal to 'c' in a^2 + b^2 = c^2... a=b=1 and thus c = sqrt(2) = 1,4 = 1 / sin(pi/4 rad) = 1 / sin(45 deg).
It's quite simple actually. :)

Posted: 02 Nov 2007, 03:05
by AxlTrozz
he :shock: ??? :?: :?:

ermm , yea yea is what I was thinking .....

Posted: 02 Nov 2007, 04:10
by Zao
Modanung wrote:Adding vectors doesn't work that way.
Lets say by pressing right the speed of the character is set to (1 , 0) and by pressing up it is set to (0 , 1). Pressing both results in a speed vector of (1 , 1). But that doesn't meen the speed is 2.
The speed is equal to the diagonal of a 1x1 square which is the same as the longest side of a right isosceles triangle. Which is equal to 'c' in a^2 + b^2 = c^2... a=b=1 and thus c = sqrt(2) = 1,4 = 1 / sin(pi/4 rad) = 1 / sin(45 deg).
It's quite simple actually. :)
I totally should have known that, being a physics major and all. Quantum physics has distracted me from the basics I guess.

I would have said though, that the vector is now:

1 i-hat + 1 j-hat, which has a magnitude sqrt(1^2 + 1^2) = sqrt(2) = 1.4

just because I'm lazy and it's a much simpler proof.
Anyway, thanks; always good to keep fresh on my trig

EDIT: I guess my misconception was that the mechanics were broke and that the vectors weren't being added right

So now I'm trying to think how you would fix that in the game:

You'd want to fix it so that x i-hat + y j-hat = 1

so 1 = sqrt(1/2 + 1/2)

so x and y would have to be cut down to sqrt(1/2) each for when players are traveling diagonally?

Posted: 02 Nov 2007, 04:58
by blackrazor
hexagonal mapping ftw :)

Posted: 02 Nov 2007, 12:57
by Pajarico
I think most isometric games (or pseudo-isometric) work like that, in diagonal thy move to tile 1,1 in the same time as moving to 0,1 or 1,0. I think Mario and Luigi RPGs doesn't do the calculation like that, but I might be wrong.

Is my conception that this can't be avoided in a tile based movement system, right?

Posted: 02 Nov 2007, 18:00
by Rotonen
Zao wrote:I totally should have known that, being a physics major and all. Quantum physics has distracted me from the basics I guess.
For the ability to be extra mean: which university? :twisted:

Also approximating the square root of 2 is even worse in my eyes and leads to trivial stuff like collapsing houses.

Posted: 02 Nov 2007, 18:35
by Zao
Rotonen wrote:
Zao wrote:I totally should have known that, being a physics major and all. Quantum physics has distracted me from the basics I guess.
For the ability to be extra mean: which university? :twisted:

Also approximating the square root of 2 is even worse in my eyes and leads to trivial stuff like collapsing houses.
Heh, the prestigious University of Alaska...

but to be fair, we are one of the few remaining programs that we get a full year of:
electrodynamics
classical mechanics
advanced lab
quantum (modern)

I guess we're switching over to the new way though, one semester for each of those and then one "math physics" semester to make up for the missing semesters.

One of my classmates is in Grad Mechanics (which mostly has grad students from other schools) and he's way ahead of them because of the year-long undergrad course. In fact, he just got out of a two-week jailhouse "vacation" and still has the best grade in the class.

Posted: 02 Nov 2007, 18:47
by Zao
Pajarico wrote:I think most isometric games (or pseudo-isometric) work like that, in diagonal thy move to tile 1,1 in the same time as moving to 0,1 or 1,0. I think Mario and Luigi RPGs doesn't do the calculation like that, but I might be wrong.

Is my conception that this can't be avoided in a tile based movement system, right?
I don't think so... I'm pretty sure that the programmers decide the speed people go in the first place in the both the x and y axes.

I'm assuming all they have to do is:

(pseudocode)

Code: Select all

if (two directions pressed at once)

xspeed = xspeed/sqrt(2)
yspeed = yspeed/sqrt(2)

end
Rotonen wrote:Also approximating the square root of 2 is even worse in my eyes and leads to trivial stuff like collapsing houses.
Well, you can always approximate better (up to the needs of your system) by adding more terms from a Taylor expansion.

In our case though, I was only really interested in proving that (1,1) didn't result in a speed of 2, which I should have known anyway, but none of my physics courses lately involve vectors. Thermo has avoided positions and velocity totally (statistical descriptions) and Quantum, of course, treats particles as waves.