1 registered members (TipmyPip),
18,466
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Locking the frame rate exactly on 60 fps
#68291
03/26/06 14:44
03/26/06 14:44
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
For some unknown reason, the frame rate for my 2D game fluctuates. How do I get rid of the fluctuation to keep it constant? This fluctuation causes jerkiness in the action, sometimes a single frame is skipped (as if processed twice in one frame), at other times, there is no update for a single frame causing a sudden pause.
I have fps_max at 65.6 and fps_min at 65.4, which, strangely enough, averages 62 frames per second. Take out the fps_max and it's past 100 so it's not that that's the cause. I just want it to render exactly 60 frames per second like classic games do (like Sonic - which has an extremely constant frame rate, only going slow when too many objects are on screen) to give a constant smooth motion.
I'm using 6.31.4 Commercial, if that helps.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Locking the frame rate exactly on 60 fps
[Re: ulf]
#68293
03/27/06 06:02
03/27/06 06:02
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
I tried fps_lock and other ones. Nothing. I'm also getting the case I had earlier with 6.40.2 - the frame rate seems to lock on powers of 2. I put fps_max at 60 and I was getting 32 fps. Set it to 68 and I was getting 64 fps. Setting it to 300 puts it at 256 fps. Setting it to 120 has 64, and 200 has 128. Here are some screenshots showing the effects: Screenshot #1 - fps_max at 200, but 64 fps (which varies from 63 to 72) Screenshot #2 - fps_max at 1200, but 275 fps (which varies from 25x to 31x) Screenshot #3 - fps_max at 60 with fps_lock on, but getting 32 fps (which varies from 32 to 40 getting nowhere near 60)
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Locking the frame rate exactly on 60 fps
[Re: ulf]
#68295
03/27/06 07:27
03/27/06 07:27
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
fps_min doesn't change your frame rate. you know how the "time" variable works, right? it's how long (in ticks) the last frame took to be processed and displayed. since a tick is a sixteenth of a second, typically "time" will equal 1 if the frame rate is 16 frames per second. if i remember correctly (it might've changed or i could be wrong) if the frame rate is below the value set by fps_min, time is automatically set at 1. typically, i put fps_min at 16, which i think is the default (but i can't remember). sorry, but i can't help with your consisten framerate issues. all i can think of is putting fps_max at 60 (and i think the latest 3DGS version doesn't let it get higher than this because of the refresh rate of the monitor) and changing fps_smooth, which according to the manual can be adjusted to smoothen out the jerks associated with framerate fluctuations  hope this helps julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Locking the frame rate exactly on 60 fps
[Re: JibbSmart]
#68296
03/27/06 07:58
03/27/06 07:58
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
I know how the time variable works. That's not the problem though. What I want is the game to run at a very constant frame rate, right on 60 fps without the random fluctuations.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Locking the frame rate exactly on 60 fps
[Re: ulillillia]
#68297
03/27/06 09:12
03/27/06 09:12
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
well high fps_min (such as 65.6) will make more fluctuations if the framerate ever goes below this number. what you didn't tell us is whether or not you tried any of the suggestions that were in my post. have you tried fiddling with time_smooth at all? i also like ulf's idea about v-sync. isn't the idea of v-sync that it synchronizes with the screen refresh rate? anyway, im not sure. post us any findings coz i'd really like to know.
julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Locking the frame rate exactly on 60 fps
[Re: JibbSmart]
#68298
03/27/06 09:31
03/27/06 09:31
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
I likely didn't because you probably editted your post. Your first post was rather short telling how the time variable works.
With all the detail I have in my 2D game, I'm surprised I was passing 250 fps. Having fps_min at 65.4 is small compared to that. Time_smooth doesn't work though, whether I use 0.9 or 0.1. Then again, it could be that I don't have any calculations involving the time variable. Just like classics (like Sonic 2, Bubsy, Mario, or Ristar), all of which run at precisely 60 frames per second, of which my 2D game is intended to run at, just like the classics. Plus, without the use of the double (a 64-bit variable), movement is no where near precise enough. It's only the rate at which game frames are displayed on the screen, of which I want an exact constant 60 fps. The jerks are caused by the varying frame rate and the monitor refresh. If I ran at 66 fps, for example, after every tenth frame, there's a jerk where it seems like two frames are processed at once. If I ran at 54 fps, there's a jerk from 9 frames being processed with no change on the 10th. This is what the jerking is and it's caused by the fluctuating frame rate. Want a small, quick animated GIF to help explain what I'm talking about?
For my 2D game, I'm using the older 6.31.4 release. The size_x thing for panels would make my already long script another 1000 to 1500 lines longer. Plus, 6.4 doesn't break up large panels like the older 6.31 release can (unless there's a way to have multiple bmaps on one single panel).
As for v-sync, I haven't looked into that yet.
Edit: I searched the display thing in the control panel for v-sync, but don't seem to find it. I don't know if it helps, but I have Radeon 9600 XT as my video card and Windows XP Pro.
Last edited by ulillillia; 03/27/06 09:40.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
Re: Locking the frame rate exactly on 60 fps
[Re: ulf]
#68300
03/27/06 10:39
03/27/06 10:39
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
OP
Senior Expert
|
OP
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
Here's a screenshot showing v-sync, or at least I think this is it. I once downloaded the omega drivers and they caused my task bar to completely disappear and I could not get it back. I had no option but to use GoBack to undo it. The setting I have is "application preference" which is the default, so, does that mean I can manually set it with a script in 3DGS? If so, what variable is it that I need to use? I only need it for my 2D game and not my 3D game.
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
|