the physics is broke'd!

Got something on your mind about the project? This is the correct place for that.
Forum rules
This forum is for feature requests, content changes additions, anything not a Bug in the software.
Please report all bugs on the Support Forums
Post Reply
Zao
Peon
Peon
Posts: 9
Joined: Sun Oct 28, 2007 10:09 am

the physics is broke'd!

Post by Zao » Wed Oct 31, 2007 7:42 am

Pythagoras has been neglected!

one runs twice as fast when running diagonally

what about conservation of momentum? :/
User avatar
Saphy
Novice
Novice
Posts: 371
Joined: Thu Nov 09, 2006 7:32 pm

Post by Saphy » Wed Oct 31, 2007 7:08 pm

It isn't physics, it is just that characters are more emotionally incided to run faster diagonally. :p
User avatar
Modanung
Knight
Knight
Posts: 1719
Joined: Fri May 20, 2005 4:51 pm
Location: Groningen, The Netherlands
Contact:

Post by Modanung » Thu Nov 01, 2007 2:50 am

They run 1 / sin(45) times as fast. But yes, I agree it's wrong.
If you're looking for 3D FOSS games be sure to check out LucKey Productions on itch.io
Zao
Peon
Peon
Posts: 9
Joined: Sun Oct 28, 2007 10:09 am

Post by Zao » Thu Nov 01, 2007 8:40 pm

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.
User avatar
Modanung
Knight
Knight
Posts: 1719
Joined: Fri May 20, 2005 4:51 pm
Location: Groningen, The Netherlands
Contact:

Post by Modanung » Thu Nov 01, 2007 11:54 pm

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. :)
If you're looking for 3D FOSS games be sure to check out LucKey Productions on itch.io
User avatar
AxlTrozz
Warrior
Warrior
Posts: 843
Joined: Sat Aug 05, 2006 12:12 am
Location: Now from TX

Post by AxlTrozz » Fri Nov 02, 2007 4:05 am

he :shock: ??? :?: :?:

ermm , yea yea is what I was thinking .....
Zao
Peon
Peon
Posts: 9
Joined: Sun Oct 28, 2007 10:09 am

Post by Zao » Fri Nov 02, 2007 5:10 am

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?
blackrazor
Novice
Novice
Posts: 332
Joined: Thu Oct 18, 2007 2:38 pm

Post by blackrazor » Fri Nov 02, 2007 5:58 am

hexagonal mapping ftw :)
User avatar
Pajarico
Warrior
Warrior
Posts: 592
Joined: Mon Feb 28, 2005 8:29 pm
Contact:

Post by Pajarico » Fri Nov 02, 2007 1:57 pm

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?
Lv.: Maggot
Please, read the FAQ before posting.
User avatar
Rotonen
TMW Adviser
TMW Adviser
Posts: 3154
Joined: Wed Sep 08, 2004 8:48 pm
Location: Espoo, Finland

Post by Rotonen » Fri Nov 02, 2007 7:00 pm

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.
This message used to be meaningful.
Zao
Peon
Peon
Posts: 9
Joined: Sun Oct 28, 2007 10:09 am

Post by Zao » Fri Nov 02, 2007 7:35 pm

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.
Zao
Peon
Peon
Posts: 9
Joined: Sun Oct 28, 2007 10:09 am

Post by Zao » Fri Nov 02, 2007 7:47 pm

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.
Post Reply