Page 1 of 1

[FIXED 0.78.0] A Big Gravity Problem :(

Posted: Mon Aug 03, 2009 1:55 pm
by metal_head
I assume you all know about that one:
If the framerate of the game is low, so it's the gravity...it somehow scales with the framerate. This is a real uncool bug, cuz for example my game has some design (I mean, it's not the best, but it has some details and stuff) and people with slower computers will be able to jump higher that people with faster machies :( I spoke with Juutis and he said that the only way arround is to script my own gravity, but for that I'll need a scripted player and weapons as well, and the weapons are a big problem. There are about 20 weapons (for now) in the game and I have positioned and set each one in the weapon.ini, I won't be able to make all of them scripted, so he told me that I can post about that problem here and help that QoD will fix it :)

Re: A Big Gravity Problem :(

Posted: Mon Aug 03, 2009 7:00 pm
by Gamemaker
Having same problem, mate ..

Re: A Big Gravity Problem :(

Posted: Mon Aug 03, 2009 9:00 pm
by metal_head
Everbody have that problem, it's not from your machine, or your RF version, and it's not a setting problem either, that's just RF's gravity...for now,but I hope they fix that :)

Re: A Big Gravity Problem :(

Posted: Tue Aug 04, 2009 7:28 pm
by Gamemaker
yea right .

Re: A Big Gravity Problem :(

Posted: Tue Aug 04, 2009 8:08 pm
by QuestOfDreams
Please, stop bumping the thread. It definitely does not help putting me in a favourable mood. :evil:

Re: A Big Gravity Problem :(

Posted: Tue Aug 04, 2009 9:33 pm
by metal_head
Sorry QoD, I didn't mean to post a useless chat-like post, I tough that Gamemaker doesn't know that everyone have that problem. Anyway, I fixed the post so it looks better like that...at least I hope it looks better :)

Re: A Big Gravity Problem :(

Posted: Mon Aug 10, 2009 1:51 pm
by QuestOfDreams
Please, try out the attached RealityFactory.exe and tell me if it works ok. Note that if you have specified the gravity in the EnvironmentSetup entity or via a script method you will have to adjust the values as the gravity is now measured in texel/s² instead of some arbitrary scaled value.
So if you want to have Earth's gravity (9.8 m/s²) and in your level 1 meter corresponds to 50 texels then your gravity vector would be (0, -490, 0).

Re: A Big Gravity Problem :(

Posted: Tue Aug 11, 2009 7:18 pm
by metal_head
This is almost perfect! Now if the framerate gets bad, the gravity gets a little stronger, but not a lot stronger like it was getting a lot weaker before, just a little bit, I think that I can see this, because my game scale is 0.5,but for a game with scale 1, that won't be so much visible :) Wow, it's just awesome, the gravity's behaving a lot more reallistic now! I hope that this fix will be included in the next RF release (which will be so cool). :)

Re: A Big Gravity Problem :(

Posted: Tue Aug 11, 2009 10:33 pm
by Jay
I am not sure how you solved it, QoD, but a fix to comes to my mind would be storing the starting position of the fall and the falling time (just accumulate the ticks...), this way you can compute the position with

start_pos+gravity_vector*falling_time²

and because that will give you the exact value, there should be no problems with the gravitation being too slow with low framerates...

If that's how you solved, even better!

Re: A Big Gravity Problem :(

Posted: Tue Aug 11, 2009 11:33 pm
by QuestOfDreams
Storing the start position to calculate the current position would only work if gravity was the only thing moving the actor. Generally that's not the case so we have to update the position every time step.
Now unfortunately the longer the time step (i.e. the lower the frame rate) the higher the velocity for this time step and the less accurate (in this case: larger) the resulting offset. That's why physics simulation usually should be run with a fixed time step ...
However, at a reasonable frame rate, the simulation should be sufficiently accurate now.

The problem was that a multiplication with the time step was missing from the calculation, so instead of the offset it was adding the velocity to the current position which of course is completely wrong.

Re: A Big Gravity Problem :(

Posted: Wed Aug 12, 2009 12:45 am
by Jay
Oh yeah, you're right about that... scratch that idea.