Physics behavior with a varied frame rate

For questions about using Classic.

Post » Wed Mar 18, 2009 5:51 pm

I posted the example cap here: viewtopic.php?f=16&t=3146

Summary: The frame rate drastically changes the physics behavior. Things start to look ugly when the frame rate is low.

Are there any plans to have the code FPS fixed with the graphical end varied and 'v-syncable'?
B
2
S
1
G
3
Posts: 59
Reputation: 1,118

Post » Wed Mar 18, 2009 7:44 pm

You can set a minimum speed to avoid game-breakage.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed Mar 18, 2009 8:13 pm

[quote="Madster":3ujtes4w]You can set a minimum speed to avoid game-breakage.[/quote:3ujtes4w]
But this slows the game down.

In the past I have used MMF. They have a "machine independent speed" option. This allowed the events to run at a constant speed but the graphics were able to vary. So the Game would always run the same on every PC, just not necessarily look as smooth.
B
2
S
1
G
3
Posts: 59
Reputation: 1,118

Post » Wed Mar 18, 2009 8:26 pm

The problem with that was that the game didn't run at the same speed on some machines, it ran WAY faster than normal.
B
2
G
3
Posts: 36
Reputation: 922

Post » Wed Mar 18, 2009 11:54 pm

MMF is fundamentally designed to be framerate dependent. You pick your framerate (eg. 50fps) and 'machine independent speed' skips drawing if it can't hit that rate. Since you need to get the logic running at a fixed rate to make a framerate dependent game keep running at the same speed, if your computer still can't hit that framerate, the whole game slows down anyway, kind of defeating the point of the option. As far as I know, you can't V-sync and have machine independent speed on in MMF (or if you can, your game will change speed depending on the framerate, I guess).

If you turn on V-sync in Construct, it won't skip drawing the screen, but instead the value of timedelta increases since it's taking longer to process frames. This can result in objects 'tunnelling' through each other, or physics going a bit funky, at very low framerates. The solution is to use the minimum framerate option. It does make the game run in slow-motion if your CPU can't keep up, but so would 'machine independent speed' if it were in Construct, and hey, you can't do an infinite amount of processing and keep the same framerate.

Physics is processed on the CPU so the CPU will be the cause of the slowdown. In this case drawing the screen takes a comparitively little amount of time, so skipping drawing the screen won't solve this problem. You need to use less CPU!
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Mar 19, 2009 1:15 am

I know if I make certain objects/effects invisible the frame rate will stay at a steady 60fps even on the slowest machine I have. So in my case the graphics are the bottle neck.

I understand the advantages of the timedelta system, but the ability to skip frames as an alternative would still be very nice.

Thanks for the explanation!
B
2
S
1
G
3
Posts: 59
Reputation: 1,118

Post » Thu Mar 19, 2009 9:01 am

If you want to control it, then I would suggest using Timescale(); adjust it as necessary when your frame rate lowers. Just an idea.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Mar 19, 2009 11:52 am

overide timedelta is what you need. its under advanced options in the layouts properties i thinks.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Thu Mar 19, 2009 5:59 pm

[quote="nightofgrim":366ippcu]So in my case the graphics are the bottle neck.[/quote:366ippcu]
Then have options to allow the user to turn off effects if their computer can't handle them. It's a well known issue physics doesn't work well with large timedeltas.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Sat Mar 21, 2009 2:23 am

[quote="nightofgrim":1kvfg0ip]I understand the advantages of the timedelta system, but the ability to skip frames as an alternative would still be very nice.[/quote:1kvfg0ip]

Frame skipping is for frame-based logic.
You CAN do frame-skipping if you reallyreallyreally want it.
Here's how:

*EDIT* UPLOADING WORKING .CAP TOMORROW *EDIT*

then put all your logic inside a loop that recalculates for each 'elapsed' frame.
Then you're ready to welcome unsmoothness into your life. You know, if you reallyreallyreally want to.

edit: don't smite me ashley :P
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests