### boot.config key=value format example Source: https://github.com/zolantris/valheimmods/blob/main/docs/unity-flags-from-chatgpt-4.md Example of the key=value format used in Unity's boot.config file. These are sample settings for wait-for-native-debugger, hdr-display-enabled, and gc-max-time-slice. ```ini wait-for-native-debugger=0 hdr-display-enabled=0 gc-max-time-slice=20 ``` -------------------------------- ### Start with FullCluster mode and CellDivisionsPerSector = 1 Source: https://github.com/zolantris/valheimmods/blob/main/src/ValheimScalability/README.md Use Mode = FullCluster and CellDivisionsPerSector = 1 as a starting point when performance becomes worse. ```ini Mode = FullCluster CellDivisionsPerSector = 1 ``` -------------------------------- ### boot.config unstable settings example Source: https://github.com/zolantris/valheimmods/blob/main/docs/unity-flags-from-chatgpt-4.md Additional boot.config settings that may have an effect but are noted as likely unstable. ```ini use-animated-hybrid-loop=1 scripting-runtime-version=latest ``` -------------------------------- ### Install Sentry NuGet package with nuget.exe Source: https://github.com/zolantris/valheimmods/blob/main/docs/CONTRIBUTING.md Install the Sentry NuGet package using nuget.exe. The example assumes nuget.exe is located two directories above the repository in a programs folder. ```powershell ..\..\programs\nuget.exe install Sentry -Version 3.41.3 -OutputDirectory Packages` ``` -------------------------------- ### Windows batch command to start Valheim server Source: https://github.com/zolantris/valheimmods/blob/main/docs/ValheimModsServer.md Use this batch command to launch a Valheim dedicated server with the specified name, port, world, and password. Replace with your actual server password. ```bat valheim_server -nographics -batchmode -name "ZolVehicles" -port 2456 -world "ZolVehicles" -password "" ``` -------------------------------- ### boot.config memory setup defaults Source: https://github.com/zolantris/valheimmods/blob/main/docs/unityMemory.md Default memory allocator settings for a dev server, including bucket allocator granularity, block sizes, and temporary allocator sizes. Use as a baseline for tuning Unity memory in development. ```ini "memorysetup-bucket-allocator-granularity=16" "memorysetup-bucket-allocator-bucket-count=8" "memorysetup-bucket-allocator-block-size=4194304" "memorysetup-bucket-allocator-block-count=1" "memorysetup-main-allocator-block-size=16777216" "memorysetup-thread-allocator-block-size=16777216" "memorysetup-gfx-main-allocator-block-size=16777216" "memorysetup-gfx-thread-allocator-block-size=16777216" "memorysetup-cache-allocator-block-size=4194304" "memorysetup-typetree-allocator-block-size=2097152" "memorysetup-profiler-bucket-allocator-granularity=16" "memorysetup-profiler-bucket-allocator-bucket-count=8" "memorysetup-profiler-bucket-allocator-block-size=4194304" "memorysetup-profiler-bucket-allocator-block-count=1" "memorysetup-profiler-allocator-block-size=16777216" "memorysetup-profiler-editor-allocator-block-size=1048576" "memorysetup-temp-allocator-size-main=4194304" "memorysetup-job-temp-allocator-block-size=2097152" "memorysetup-job-temp-allocator-block-size-background=1048576" "memorysetup-job-temp-allocator-reduction-small-platforms=262144" "memorysetup-allocator-temp-initial-block-size-main=262144" "memorysetup-allocator-temp-initial-block-size-worker=262144" "memorysetup-temp-allocator-size-background-worker=32768" "memorysetup-temp-allocator-size-job-worker=262144" "memorysetup-temp-allocator-size-preload-manager=262144" "memorysetup-temp-allocator-size-nav-mesh-worker=65536" "memorysetup-temp-allocator-size-audio-worker=65536" "memorysetup-temp-allocator-size-cloud-worker=32768" "memorysetup-temp-allocator-size-gfx=262144" ``` -------------------------------- ### Create .props file with ValheimPaths and LocalPaths PropertyGroups Source: https://github.com/zolantris/valheimmods/blob/main/docs/CONTRIBUTING.md Create a .props file at the top level of the project with these PropertyGroups to configure Valheim paths for building and running through the configuration. The ValheimPaths group defines game, server, and r2modman profile paths; the LocalPaths group defines BepInEx and managed data paths. Use the GamePath property if the game is not in the steam root folder. ```xml %Steam_Library_Path%\steamapps\common\Valheim $(GamePath) dedicated server %APPDATA%\r2modmanPlus-local profile-name Valheim\profiles\$(R2ModManProfileName) BepInEx\plugins\zolantris-ValheimRAFT $(R2ModManPath)\$(R2ModManProfile)\$(PluginDeployTarget) $(R2ModManPath)\$(R2ModManProfile)\BepInEx\core $(GamePath)\valheim_Data\Managed ``` -------------------------------- ### Auto-join remote server configuration (DirectWorld.cfg) Source: https://github.com/zolantris/valheimmods/blob/main/src/DirectWorld/README.md Configuration to automatically join a remote server on startup. Set DirectWorldEnabled=true, IsJoinServer=true, and provide the server URL and port. The player name and backend are also specified. ```ini [DirectWorld] DirectWorldEnabled=true IsJoinServer=true JoinServerUrl=192.168.1.100 JoinServerPort=2456 DirectWorldPlayerName=MyCharacter ServerOnlineBackendType=Steamworks ``` -------------------------------- ### ApplyMetricIfAvailable and ApplyMetrics for optional Sentry integration Source: https://github.com/zolantris/valheimmods/blob/main/src/SentryUnityWrapper/README.md Example code for making Sentry optionally required. The first method checks if the SentryUnityWrapper plugin is loaded and metrics are enabled before applying metrics. The second method retrieves the DSN from the assembly and registers the plugin asynchronously with the SentryUnityWrapperPlugin. ```csharp public static void ApplyMetricIfAvailable() { string @namespace = "SentryUnityWrapper"; string @pluginClass = "SentryUnityWrapperPlugin"; if (ValheimRaftPlugin.Instance.EnableMetrics.Value && Chainloader.PluginInfos.ContainsKey("zolantris.SentryUnityWrapper")) { if (Type.GetType($"{@namespace}.{@pluginClass}") != null) { SentryMetrics.ApplyMetrics(); } } } public static void ApplyMetrics() { var Dsn = Assembly.GetEntryAssembly() .GetCustomAttribute() .ConfigurationLocation; Logger.LogDebug($"DSN FOR sentry {Dsn}"); SentryUnityWrapperPlugin.RegisterPluginAsync( new(ValheimRaftPlugin.BepInGuid, ValheimRaftPlugin.ModName, ValheimRaftPlugin.Version,Dsn)); } ``` -------------------------------- ### DynamicLoginIntegration Class Source: https://github.com/zolantris/valheimmods/blob/main/src/DynamicLocations/README.md Documentation for the DynamicLoginIntegration class, including its properties, constructor, and methods. ```APIDOC ## DynamicLoginIntegration Class ### Description Provides integration for login functionality within the Dynamic Locations mod framework, allowing other mods to connect their login systems. ### Properties - **LoginPrefabHashCode** (int) - Gets the hash code of the prefab associated with the login integration. - **ShouldFreezePlayer** (bool) - Indicates whether the player should be frozen during the login process. - **RunBeforePlugins** (List) - A list of plugins that should execute before this integration. - **RunAfterPlugins** (List) - A list of plugins that should execute after this integration. - **Priority** (int) - Returns the priority of the integration; defaults to 999 if the configured priority is less than or equal to zero. - **MovementTimeoutMs** (int) - Returns the timeout duration (in milliseconds) for the player's movement to a specified ZDO. - **IsComplete** (bool) - Indicates whether the login movement process has been completed. - **Config** (IntegrationConfig) - Contains the configuration settings for the integration. ### Constructor #### `DynamicLoginIntegration(IntegrationConfig config)` Initializes a new instance of the `DynamicLoginIntegration` class with the specified configuration. ##### Parameters - **config** (IntegrationConfig) - Required - The configuration settings for this integration. ### Methods #### `static IntegrationConfig CreateConfig(BaseUnityPlugin plugin, string zdoTargetPrefabName)` Creates a new `IntegrationConfig` instance using the specified plugin and target prefab name. ##### Parameters - **plugin** (BaseUnityPlugin) - Required - The plugin used to extract the plugin's GUID, version, and name for debugging. - **zdoTargetPrefabName** (string) - Required - The name of the prefab target for the ZDO. ##### Returns - **IntegrationConfig** - A newly created `IntegrationConfig` object. #### `IEnumerator API_OnLoginMoveToZDO(ZDO zdo, Vector3? offset, PlayerSpawnController playerSpawnController)` Invoked by the APIController when the player should move to a specified ZDO upon login. This method should not be overridden. ##### Parameters - **zdo** (ZDO) - Required - The ZDO to which the player should be moved. - **offset** (Vector3?) - Optional - An optional offset vector to adjust the player's position. - **playerSpawnController** (PlayerSpawnController) - Required - The instance responsible for managing player movements. ##### Returns - **IEnumerator** - An enumerator that allows coroutine execution to handle the movement process. #### `virtual IEnumerator OnLoginMoveToZDO(ZDO zdo, Vector3? offset, PlayerSpawnController playerSpawnController)` Can be overridden by mods to implement custom logic for moving the player to a ZDO upon login. ##### Parameters - **zdo** (ZDO) - Required - The ZDO to which the player should be moved. - **offset** (Vector3?) - Optional - An optional offset vector to adjust the player's position. - **playerSpawnController** (PlayerSpawnController) - Required - The instance responsible for managing player movements. ##### Returns - **IEnumerator** - An enumerator for coroutine execution that may handle custom player movement logic. #### `public virtual bool OnLoginMatchZdoPrefab(ZDO zdo)` Checks if the provided ZDO matches the prefab hash code configured for the login integration. This method may be overridden by mods that require different matching criteria. ##### Parameters - **zdo** (ZDO) - Required - The ZDO to check for a match. ##### Returns - **bool** - `true` if the ZDO matches the prefab hash code; otherwise, `false`. ``` -------------------------------- ### Enable automatic debug build conversion with Unity paths Source: https://github.com/zolantris/valheimmods/blob/main/docs/CONTRIBUTING.md Add these properties to enable automatic converting Valheim into a debug variant. The example uses Unity 2022.3.50f1 and specifies the Unity Hub base path and version. The conversion script is UnityConvertGameToDebugBuild.ps1, which executes steps from ValheimDebugging.md. ```xml $(R2ModManPath)\$(R2ModManProfile)\BepInEx\core $(GamePath)\valheim_Data\Managed C:\Program Files\Unity\Hub 2022.3.50f1 ```