Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question How to calculate physics faster with desired framerate

Discussion in 'Scripting' started by berk_can, Apr 7, 2021.

  1. berk_can

    berk_can

    Joined:
    Feb 8, 2016
    Posts:
    15
    Sorry for ambiguity of title, I couldnt find correct phrase for it
    What I want to do is I want to make a turn based multiplayer game includes physics calculations, I've learnt that I could calculate physics on server side with Unity headless build and I can store movement and rotation vectors of each players in Update relative to every frame, but an Update() call means 1 frame so if I want to calculate 3 minutes with 30 fps I should wait 3 minutes in real time
    I dont want to wait on server side that much, what should I do in order to both keep framerate to 30fps and simulate physics faster with good performance?
     
  2. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,009
    Take a look at Physics.Simulate
     
    berk_can and PraetorBlue like this.
  3. berk_can

    berk_can

    Joined:
    Feb 8, 2016
    Posts:
    15
    Another amazing Unity feature I didnt know about, thanks It works good. Do you possibly know any replay library that I can store frame by frame in server and play on client side. I know it doesnt seem like a hard thing to do but if there is a framework or library etc. to do it I would rather to use that thats why I'm asking :)
     
  4. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,009
    Sorry I don't know.