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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Unity Multiplayer Unity 2021.2: Dedicated Server target and stripping optimizations now live! Please share feedback!

Discussion in 'Multiplayer' started by UnityGio, Jul 20, 2021.

  1. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    Hey @vis2k, could you please provide some details about the test case so we can try to reproduce it and investigate? or even better, do you already have a project we could check?
     
  2. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,260
    Reported it as IN-3335 in May :)
     
  3. AlexanderArbuznikov

    AlexanderArbuznikov

    Joined:
    Nov 18, 2021
    Posts:
    4
    Any news on the issue? Is it possible to make Dedicated Server builds on UCB now?
     
  4. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    Could you please open a support ticket with Cloud Build? that could help properly prioritize this on their side.
     
  5. iCrise

    iCrise

    Joined:
    Jun 6, 2022
    Posts:
    2
    How to build for a Dedicated Server an android/ios project ?
     
  6. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    Dedicated Server is built as any other platform. So you can:
    1. Download the Dedicated Server module for the target you want to build to (Linux, Mac, Windows).
    2. Switch to Dedicated Server target in the build settings. Take into account that Dedicated Server targets Desktop platforms, some adjustments might be required for your project.
    3. Hit the Build button.
     
  7. VRGroupRWTH

    VRGroupRWTH

    Joined:
    Oct 23, 2021
    Posts:
    2
    Hey all,
    Are there any further plans to include shader stripping? Shader variants are absolutely mad right now in general, would be great to circumvent those issues in server builds at least.
    Feels a bit strange to compile actual billions of variants just to never load them at all.
     
  8. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    We are working on providing more ways for you to better optimize the Dedicated Server builds, and yes, that includes shaders.
    That's all the details I can share for now :)
     
  9. iCrise

    iCrise

    Joined:
    Jun 6, 2022
    Posts:
    2
    upload_2022-8-25_19-52-58.png
    i did a little improvement for my builds, when i hit "Build Server", it automatcly build an linux build and switch to android when its finished :))
     
    cristianm_unity likes this.
  10. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    177
    What is the current "official" method to find out at runtime if the app running is a server build or not ?
    I know the trick with the if (SystemInfo.graphicsDeviceName == null)
    but are there other ways ?
    Is Appliocation.isBatchMode still a thing ?
    is RuntimePlatform.LinuxServer RuntimePlatform.WindowsServer
    reliable ? the docs are hopeless little and strange there "in the server on Linux" ...
     
    Last edited: Aug 28, 2022
  11. NuclearCookieTF

    NuclearCookieTF

    Joined:
    Mar 29, 2021
    Posts:
    14
    I confirmed Application.isBatchMode still works in builds that are built with dedicated server
     
    Karsten likes this.
  12. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    You can use the UNITY_SERVER define
     
  13. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    177
    Thanks, but very ugly,defines clutter code and degrade readability they are disturbing similar to XML comments.
    I keep going with isBatchMode and Application.platform combination wrote my own methods , isSeverBuild, isClientBuild
     
  14. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,260
    Any update on dedicated server builds being significantly slower than regular builds?

    M1 Macbook Pro, Unity 2021.3.8, IL2CPP, dedicated build with 100k entities.
    Connecting to it from Editor to show tick rate etc.
    14 Hz.
    2022-09-07 - remote control dedicated server mac 100k.png

    Here's the same project with a regular build and camera disabled:
    24 Hz.
    2022-09-07 - remote control regular build mac 100k.png
     
  15. SenseEater

    SenseEater

    Joined:
    Nov 28, 2014
    Posts:
    84
    What's up with 14hz vs 24hz?

    Also , have you tried profiling it to check the bottleneck ?
     
  16. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    148
    Any update on this issue that @vis2k found?
     
    vis2k likes this.
  17. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    Hi all! Thanks for your patience on the Dedicated Server - Mac performance issue, this is the public issue tracker.
    It has been identified that it happens only on Apple Silicon machines and we are currently investigating the causes, I will let you know as soon as we have news.
     
    vis2k likes this.
  18. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    927
    I'll give you example, there's https://docs.unity3d.com/ScriptReference/AudioSource.GetSpectrumData.html api that requires sound to be played at the moment when method is used. Many rhythm games use it and there's no way to run it to prepare data before it's actually needed.
     
    Last edited: Sep 29, 2022
  19. JeroChan

    JeroChan

    Joined:
    Sep 27, 2022
    Posts:
    1
    Is there an optimization plan for Asset Bundles in subsequent versions?
     
  20. Flow-Fire-Games

    Flow-Fire-Games

    Joined:
    Jun 11, 2015
    Posts:
    301
    Had the same issue, all of our content is in Addressables.
    In the meantime I figured out a custom solution for building for servers.

    You'll need to fork the Unity package Scriptable Build Pipeline.
    In the file CalculateAssetDependencyData around line 300
    var includedObjects = ContentBuildInterface.GetPlayerObjectIdentifiersInAsset(asset, input.Target);
    the code returns an array of files to include.
    Using
    BuildCacheUtility.GetMainTypeForObject(includedObjects[index]);
    you can check the System.Type for Texture2D, AudioClip etc and replace the asset reference with an empty dummy Texture/etc.

    Few lines below
    ObjectIdentifier[] referencedObjects;
    requires the same treatment.

    It will fail some Asserts in the native building but works fine for us.
    Use some bool, for example CommandLineArgs, to enable/disable your stripping.
     
  21. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    205
    As I mentioned in a previous comment, we are working on providing more ways for you to better optimize the Dedicated Server builds. We know that Asset Bundles represent an important part of the workflow, so we are also looking into it. :)
     
    Vladnee likes this.
  22. Karsten

    Karsten

    Joined:
    Apr 8, 2012
    Posts:
    177
    which enumeration to use to build a linux dedicated server from a script containing BuildPipeline.BuildPlayer(....) in 2021.3x
    the docs contain things that dont exist like BuildTarget.LinuxHeadlessSimulation and other wild stuff
    Edit: I found a way using -> new BuildPlayerOptions{...} but the docs about programmatic builds really need some love
     
    Last edited: Oct 21, 2022
    cristianm_unity likes this.
  23. david_joo

    david_joo

    Joined:
    Feb 24, 2022
    Posts:
    3
    can i get a manual or document about this feature?