Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

60 FPS on all mobile devices?

Discussion in 'Getting Started' started by Sparticus, Nov 17, 2020.

  1. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    I think I just realized I made a mistake.

    I am developing a tower defense game where I do not move enemies, bullets, etc based on time. I base everything on frames (i do not use Time.deltaTime when calculating their next position). I do this because I record the exact frame of animation the user places a tower... when the game ends I send all their actions to the server and I replay the game in memory on the server to validate their score.

    Since the game is not run on time I can be certain both the server and the clients gameplay would be identical.

    I set my game to run at 60fps. I am aware that older mobile devices may not be powerful enough to run at 60 fps... so their enemies and bullets will move slower.... but I was fine with that...

    However, I think I read today that some phones/devices cannot run at 60 fps... they are capped at 30 fps...

    If that's true that means my game at best will run at half the speed I intended it to be run at....

    Can someone confirm if this 30fps cap is true? My hopes of this cheat detection system might not work now :(
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Relying on frame rate for game execution is a horrible idea, since you have no way of controlling that or even accounting for it in your application.

    Maybe I'm missing something, but why can't you just record timestamps at key periods (game start, various events, etc) and validate based on that?
     
  3. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Well, I am checking for cheaters.

    I assume if i add logic to move a bullet towards an enemy based on time, the bullet on the server could sometimes hit the enemy at a different frame of animation on the server (the clients machine could be slow and the bullet took 1.4 seconds to reach the target whereas on the server it took 1.3). They would then be awarded gold at different times and then could build new towers at different times.

    In a perfect world, the server simulation and the actual gameplay would be identical... which is why I was basing everything on frames (moving a bullet 1 unit a frame on the server and on the client would reach the target 10 units away at the same time).
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You're not going to be able to guarantee any FPS because you don't have control to shut off all other services which might slow down the device temporarily.
     
  5. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I understand your intent, but there's got to be a simpler way, right?
     
    Joe-Censored likes this.