How do I delta-time limit framerate for entire game?

0 favourites
  • 15 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I'd like to recreate the old 90's framerate limit of the early Apogee games, and to an extent, Doom used a framerate limiter, but without the action being slow, just the frame were longer between refreshes while the action continues between frames. Is there a way of having the whole game run at a 15fps or 12fps limit?

  • You can't change the refresh rate of the game with C2. I believe a half framerate (30fps) was attempted before but it didn't perform well with html5, the result wasn't smooth. A search could probably give more info.

    That said C2 only redraws if something has changed position. So you possibly could force lower redraw rate by only moving the objects every other tick or something. It wouldn't work if you used any behaviors since they update every tick but with just events it could work. Probably more trouble than it's worth though.

  • Yeah, but unfortunately that would create the slow motion effect which I'm trying to avoid, in fact it's really just a frame-cap I'm looking for, so the action speed remains the same but the gameplay runs at the same speed. Sometimes it's called Posterize Time.

  • R0J0hound

    Just asking for fun:

    Would it be possible to use the paster or canvas-object for this..

    Overlaying the complete viewport/layout and pasting everything in it every 0.03 seconds?

  • Zebbi

    You would have to add up dt for the ticks you don't use.

    Here's my idea. It adds dt to mydt every tick. Then every forth tick the "code" group is enabled which moves the objects around using mydt instead of dt. At the end of the group mydt is reset to 0.

    https://dl.dropboxusercontent.com/u/542 ... 15fps.capx

    This could get very tedious to do. You can't use behaviors or animations with sprites, you'll have to do everything with events to ensure objects are only redrawn on that one frame. On a side note as far as the engine is concerned the fps is still 60 fps but we're only redrawing at 15fps.

    LittleStain

    I suppose you could but it wouldn't save on any performance which I assume this would be for.

  • Zebbi

    I suppose you could but it wouldn't save on any performance which I assume this would be for.

    Actually, the effect would be entirely for aesthetic, similar to shooting movies at 24fps, but naturally I wouldn't want the effect to eat up performance as that would introduce slow-downs, which I'm trying to avoid. Why does so much of the game have to be drawn manually with delta time? Would it be possible if a plugin could be coded that just frame-capped the refresh rate of the game?

  • A plugin can't be made to do that since it's something fundamental that the engine controls, and would need to be changed in the engine itself.

    The purpose of moving stuff with events is in C2 only redraws if something moves or changes viually. If nothing visual changes then the runtime doesn't redraw and just reuses the previous frame's image. By controlling when we move stuff we can control when the screen redraws.

  • Yeah, but couldn't there be a screen-level shader that can hold the framerate visually for a sub-division of a second, since it's entirely intended as a visual effect rather than anything that affects the gameplay? Can shaders not be made to work on the entire viewport that is drawn?

  • Shaders can change what is seen on screen, but they have nothing to do with how often it's updated.

  • Yes, but the game could still update under the shader, the shader could theoretically just mini-pause the action 15x per second, say, to emulate the look?

  • Not with a shader. The closest you could do right now is using LittleStain's suggestion and paste everything to that every X seconds.

  • Not with a shader. The closest you could do right now is using LittleStain's suggestion and paste everything to that every X seconds.

    I see you made both the paster and canvas objects, nice! Which would you recommend would be best to try this with? Will be interesting to see how performance is with this.

  • Paster will be faster with webgl on, but you'll have to paste objects indavidually. With webgl off canvas and paster will perform the same, but canvas lets you paste an entire layer at a time.

  • There is a system action :

    [quote:1o0zy1kg]Set minimum framerate

    Set the maximum delta-time (dt) value based on a framerate. The default minimum framerate is 30 FPS, meaning the maximum dt is 1 / 30 (= 33ms). If the framerate drops below 30 FPS, dt will still not exceed 1/30. This has the effect of the game going in to slow motion as it drops below the minimum framerate, rather than objects stepping further every frame to keep up the same real-world speed. This helps avoid skipped collisions due to stepping a very large distance every frame.

    You could try and mess with, although it likely won't get you the effect you are looking for.

    At worst, it can help you understand how the engine is coded on that level.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There is a system action :

    [quote:3dbrl7zv]Set minimum framerate

    Set the maximum delta-time (dt) value based on a framerate. The default minimum framerate is 30 FPS, meaning the maximum dt is 1 / 30 (= 33ms). If the framerate drops below 30 FPS, dt will still not exceed 1/30. This has the effect of the game going in to slow motion as it drops below the minimum framerate, rather than objects stepping further every frame to keep up the same real-world speed. This helps avoid skipped collisions due to stepping a very large distance every frame.

    You could try and mess with, although it likely won't get you the effect you are looking for.

    At worst, it can help you understand how the engine is coded on that level.

    Exactly, the slow-motion effect is what I'm trying to avoid, I want the effect of a low filmed frame-rate played back at the frame-rate it was recorded at, speaking in movie terms.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)