Simulation speed and fps

Discussion in '3D Hardware, Software & Output Devices' started by DavidGraham, Dec 2, 2014.

  1. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    Some games link the simulation speed with the number of fps, thus when the game is outputting huge numbers of frames, the game runs at an insane speed, I noticed that in some older games (like Hitman 2 and GTA 2). What are the benefits of such approach? considering that many other games decouple the two so that the simulation speed is constant no matter the number of fps.
     
  2. Alexko

    Veteran Subscriber

    Joined:
    Aug 31, 2009
    Messages:
    4,515
    Likes Received:
    934
    Are you sure Hitman 2 does this? I can only remember this kind of behavior from very old games. And there's no benefit that I know of, it's just sloppy coding.
     
  3. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    Yeah pretty sure, I also think old console games that run on emulators exhibit the same behavior. The game is only designed to work on a certain hardware configuration with a limited target of fps which if exceeded will result in increasing simulation speed, it may be easier to code games this way.
     
  4. Ryan Smith

    Regular

    Joined:
    Mar 26, 2010
    Messages:
    623
    Likes Received:
    1,095
    Location:
    PCIe x16_1
    There are even modern games like this. Anything based on id Tech 5 for example runs the simulation at a fixed rate of 60Hz.
     
  5. Alexko

    Veteran Subscriber

    Joined:
    Aug 31, 2009
    Messages:
    4,515
    Likes Received:
    934
    Why on Earth do they do that? It's a pretty trivial problem to avoid.

    Code:
    obj_position = obj_position + direction_vector * SPEED * time_since_previous_frame;
     
  6. Xmas

    Xmas Porous
    Veteran Subscriber

    Joined:
    Feb 6, 2002
    Messages:
    3,314
    Likes Received:
    140
    Location:
    On the path to wisdom
    Isn't that the exact opposite of what @DavidGraham described?
     
  7. Ethatron

    Regular Subscriber

    Joined:
    Jan 24, 2010
    Messages:
    869
    Likes Received:
    277
    Those games basically owned the hardware from a scheduling perspective, which means 1000 instructions were X cycles, each and every time, so the programmer knows how time passes along the sequence of instructions, to the cycle. If the instructions are executed faster, then the "clock" of the game is running faster.
    To some degree this applies even to the multi-tasking Amiga, because display clock and Copper were very much aligned, once the Copper emulation ran faster (and out of sync) it broke apart. It needs to be emulated which the exact speed of the signal to be displayed.
     
    DavidGraham likes this.
  8. MJP

    MJP
    Regular

    Joined:
    Feb 21, 2007
    Messages:
    566
    Likes Received:
    187
    Location:
    Irvine, CA
    I really doubt that they do it the old-school way where you just ticked your simulation every frame and used a fixed time interval. They probably decouple simulation from rendering, and use a fixed time step for every iteration of the simulation. What you're talking about is a "floating" time step, which is certainly workable but has the downside of integrating differently (physics produces different results) depending on the frame rate.
     
  9. Rodéric

    Rodéric a.k.a. Ingenu
    Moderator Veteran

    Joined:
    Feb 6, 2002
    Messages:
    4,031
    Likes Received:
    898
    Location:
    Planet Earth.
  10. Alexko

    Veteran Subscriber

    Joined:
    Aug 31, 2009
    Messages:
    4,515
    Likes Received:
    934
    That does seem like a much better option, but either one would decouple framerate and simulation speed. How could recent games fail to do that?
     
  11. Ryan Smith

    Regular

    Joined:
    Mar 26, 2010
    Messages:
    623
    Likes Received:
    1,095
    Location:
    PCIe x16_1
    Eh, yes and no. The idea is the same: the simulation has to run at a fixed rate or things go wrong. In the case of id Tech 5, if you remove the 60fps cap the simulation breaks down.
     
    DavidGraham likes this.
  12. Xmas

    Xmas Porous
    Veteran Subscriber

    Joined:
    Feb 6, 2002
    Messages:
    3,314
    Likes Received:
    140
    Location:
    On the path to wisdom
    But the point was how the simulation rate is implemented. What DavidGraham described is tying the simulation rate to the execution speed of the hardware, which will break on faster hardware. In id Tech 5 the simulation rate is time based and won't break on faster hardware.
     
    DavidGraham likes this.
  13. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    A recent game that comes to mind is Red Faction Guerrilla. If you run it at DX10 the game speeds like crazy. Only at DX9 it runs well, They have now removed DX10 entirely and replaced it with DX11 in a new version released on Steam.
    Yeah, pretty weird, don't think the guys at id suffer from a lack of coding talent, there has to be another reason for this behavior.

    True, but never the less that shouldn't be the case, faster fps shouldn't break the game. Running the game on a 120Hz display and 120fps will ruin the game immediately.The reason for linking the simulation to fps is still unclear to me.
     
  14. silent_guy

    Veteran Subscriber

    Joined:
    Mar 7, 2006
    Messages:
    3,754
    Likes Received:
    1,380
    When you link the simulation engine to a fixed timer, the behavior will be the same irrespective of the FPS that you achieve.
    But if that timer is not the same as your target FPS, then you get stutter.
    And if you make the timer a multiple of the target FPS, say 120Hz, then your CPU may be too slow to get everything done in time and then you get variable behavior again.
    So fixed rate at 60Hz is a good tradeoff.

    Now this variable behavior will be at a very low level and shouldn't be a big deal at all, but I can imagine that it makes a bunch of things harder, such a physics. And if your engine is designed primarily for consoles, then it may be a reasonable decision.
     
  15. Moloch

    Moloch God of Wicked Games
    Veteran

    Joined:
    Jun 20, 2002
    Messages:
    2,981
    Likes Received:
    72
    Fallout 3/NV/Skyrim(all games that use that game engine ) have the sim speed linked to FPS, if you want to run places a slot faster simply disable v-sync and maybe lower settings. I discovered this when I increased my movement speed with v-sync disabled and then enabled v-sync and wondered why I was running so much slower. That's why you're not supposed to disable v-sync in those games.
     
  16. DavidGraham

    Veteran

    Joined:
    Dec 22, 2009
    Messages:
    3,286
    Likes Received:
    3,543
    Need For Speed Rivals suffer the same problem too, the game only functions properly if it's running at constant 60fps (a multiple of 30fps), anything between the default 30 and the unlocked 60 breaks the game.

    I read somewhere that some physics simulations for many effects actually only run at a fixed rate, 30 or otherwise, so that might be a valid reason for this behavior.
    Good.
    You mean the timer has to be the same as the target fps? you can't decouple both?
     
  17. silent_guy

    Veteran Subscriber

    Joined:
    Mar 7, 2006
    Messages:
    3,754
    Likes Received:
    1,380
    You can decouple both. But at that point, you get a mismatch in terms of sampling: if the simulation engine runs at 60fps and you're rendering at 45fps, the rendered frames will capture the state of the simulation engine at different phases.

    Conceptually, this is very similar to running a fixed refresh rate monitor on a GPU with a variable render rate. (Which is what Gsync solves.)

    (Let me stress that I don't actually known anything practical about simulation engines, I'm just trying to go by first principles! So that this with a grain of salt.)
     
    DavidGraham likes this.
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...