Search Unity

How to get equally distributed frames for multiple unity applications (for testing purpose) ?

Discussion in 'Editor & General Support' started by meanmonkey, May 24, 2019.

  1. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    148
    I'm running multiple instances of the same unity application (windowed mode) for local network testing.

    The problem is: If none of these apps have focus, frames are distributed equally. If one of the apps has focus, this app takes away all the frames and all the other apps are too slow for serious testing.

    I don't know if this is a windows 10 or unity thing, I also tried out various taks manager / priority settings, but without any effect.

    I guess I could setup a virtual machine or another PC but this would be too cumbersome for sporadic testing.

    Any ideas ? Thanks
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    It is probably the Windows dynamic priority feature causing this.

    https://docs.microsoft.com/en-us/windows/desktop/procthread/priority-boosts
    I generally do this type of testing on a machine with excess CPU capacity, so this isn't normally a problem for me, but I'm guessing you are close to maxing out all your cores when this occurs. You could attempt to write a C++ plugin using the function calls in the link to disable the feature (I have no idea if that will really work in Unity, but might be worth it for you to try).

    You could also consider capping your game's frame rate low enough so the foreground instance doesn't try to gobble up as much CPU as it can, or upgrading your CPU so core count is higher than the number of instances of the game you are running.
     
    meanmonkey likes this.
  3. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604
    Have you tried running each instance in a separate Docker images? That would be a lot like being on a separate VM, but they won't share all of the same resources. Still, you'd be limited by the overall CPU and GPU resources available. I haven't personally tried this, mind you. I don't know what problems might arise as far as you physically and manually opening/closing game windows. Docker may run as a service by default on Windows? If so, there would be no GUI to interact with your game. But the whole point of Docker is to have a self-contained space for an app to run that provides all the code resources it needs, along with a small partition of the OS it is running on; without providing its own OS, which would make it a vm. And because of this, there would need to be an option to not run as a service on Windows.
     
    meanmonkey likes this.
  4. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    148
    Thanks for the input guys. I guess I'll try capping the frames as Joe-Censored supposes....I would go with vm/docker if nothing else helps
     
    Joe-Censored likes this.
  5. meanmonkey

    meanmonkey

    Joined:
    Nov 13, 2014
    Posts:
    148
    Framecapping actually worked for me! :)

    QualitySettings.vSyncCount = 0;
    Application.targetFrameRate = 50;
     
    Joe-Censored likes this.