[FIXED 0.78.0] A Big Gravity Problem :(

Post any Bug Reports here
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

[FIXED 0.78.0] A Big Gravity Problem :(

Post by metal_head » Mon Aug 03, 2009 1:55 pm

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 :)

User avatar
Gamemaker
Posts: 266
Joined: Fri Aug 08, 2008 3:00 pm
Location: Estonia
Contact:

Re: A Big Gravity Problem :(

Post by Gamemaker » Mon Aug 03, 2009 7:00 pm

Having same problem, mate ..

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: A Big Gravity Problem :(

Post by metal_head » Mon Aug 03, 2009 9:00 pm

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 :)
Last edited by metal_head on Tue Aug 04, 2009 9:30 pm, edited 2 times in total.

User avatar
Gamemaker
Posts: 266
Joined: Fri Aug 08, 2008 3:00 pm
Location: Estonia
Contact:

Re: A Big Gravity Problem :(

Post by Gamemaker » Tue Aug 04, 2009 7:28 pm

yea right .

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: A Big Gravity Problem :(

Post by QuestOfDreams » Tue Aug 04, 2009 8:08 pm

Please, stop bumping the thread. It definitely does not help putting me in a favourable mood. :evil:

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: A Big Gravity Problem :(

Post by metal_head » Tue Aug 04, 2009 9:33 pm

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 :)

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: A Big Gravity Problem :(

Post by QuestOfDreams » Mon Aug 10, 2009 1:51 pm

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).
Attachments
RealityFactory_GravityTest.zip
Gravity test
(854.23 KiB) Downloaded 59 times

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: A Big Gravity Problem :(

Post by metal_head » Tue Aug 11, 2009 7:18 pm

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). :)

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: A Big Gravity Problem :(

Post by Jay » Tue Aug 11, 2009 10:33 pm

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!
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: A Big Gravity Problem :(

Post by QuestOfDreams » Tue Aug 11, 2009 11:33 pm

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.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: A Big Gravity Problem :(

Post by Jay » Wed Aug 12, 2009 12:45 am

Oh yeah, you're right about that... scratch that idea.
Everyone can see the difficult, but only the wise can see the simple.
-----

Post Reply