using System; using System.Runtime.InteropServices; using System.Threading; using Lidgren.Network; using Robust.Shared.Audio; using Robust.Shared.Configuration; using Robust.Shared.Log; using Robust.Shared.Network; using Robust.Shared.Physics; namespace Robust.Shared { [CVarDefs] public abstract class CVars { #if FULL_RELEASE private const bool ConstFullRelease = true; #else private const bool ConstFullRelease = false; #endif protected CVars() { throw new InvalidOperationException("This class must not be instantiated"); } /* * NET */ /// /// UDP port to bind to for main game networking. /// Each address specified in net.bindto is bound with this port. /// public static readonly CVarDef NetPort = CVarDef.Create("net.port", 1212, CVar.ARCHIVE); /// /// Send buffer size on the UDP sockets used for main game networking. /// public static readonly CVarDef NetSendBufferSize = CVarDef.Create("net.sendbuffersize", 131071, CVar.ARCHIVE); /// /// Receive buffer size on the UDP sockets used for main game networking. /// public static readonly CVarDef NetReceiveBufferSize = CVarDef.Create("net.receivebuffersize", 131071, CVar.ARCHIVE); /// /// Maximum UDP payload size to send. /// /// public static readonly CVarDef NetMtu = CVarDef.Create("net.mtu", NetPeerConfiguration.kDefaultMTU, CVar.ARCHIVE); /// /// If set, automatically try to detect MTU above . /// /// /// /// public static readonly CVarDef NetMtuExpand = CVarDef.Create("net.mtu_expand", false, CVar.ARCHIVE); /// /// Interval between MTU expansion attempts, in seconds. /// /// /// This property is named incorrectly: it is actually an interval, not a frequency. /// The name is chosen to match Lidgren's . /// /// public static readonly CVarDef NetMtuExpandFrequency = CVarDef.Create("net.mtu_expand_frequency", 2f, CVar.ARCHIVE); /// /// How many times an MTU expansion attempt can fail before settling on a final MTU value. /// /// public static readonly CVarDef NetMtuExpandFailAttempts = CVarDef.Create("net.mtu_expand_fail_attempts", 5, CVar.ARCHIVE); /// /// Whether to enable verbose debug logging in Lidgren. /// /// public static readonly CVarDef NetVerbose = CVarDef.Create("net.verbose", false); /// /// Comma-separated list of IP addresses to bind to for the main game networking port. /// The port bound is the value of net.port always. /// public static readonly CVarDef NetBindTo = CVarDef.Create("net.bindto", "0.0.0.0,::", CVar.ARCHIVE | CVar.SERVERONLY); /// /// Whether to bind IPv6 sockets in dual-stack mode (for main game networking). /// public static readonly CVarDef NetDualStack = CVarDef.Create("net.dualstack", false, CVar.ARCHIVE | CVar.SERVERONLY); /// /// Whether to interpolate between server game states for render frames on the client. /// public static readonly CVarDef NetInterp = CVarDef.Create("net.interp", true, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// The target number of game states to keep buffered up to smooth out network inconsistency. /// public static readonly CVarDef NetBufferSize = CVarDef.Create("net.buffer_size", 0, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// Enable verbose game state/networking logging. /// public static readonly CVarDef NetLogging = CVarDef.Create("net.logging", false, CVar.ARCHIVE); /// /// Whether prediction is enabled on the client. /// /// /// If off, simulation input commands will not fire and most entity methods will not run update. /// public static readonly CVarDef NetPredict = CVarDef.Create("net.predict", true, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// Extra amount of ticks to run-ahead for prediction on the client. /// public static readonly CVarDef NetPredictTickBias = CVarDef.Create("net.predict_tick_bias", 1, CVar.CLIENTONLY | CVar.ARCHIVE); // On Windows we default this to 16ms lag bias, to account for time period lag in the Lidgren thread. // Basically due to how time periods work on Windows, messages are (at worst) time period-delayed when sending. // BUT! Lidgren's latency calculation *never* measures this due to how it works. // This broke some prediction calculations quite badly so we bias them to mask it. // This is not necessary on Linux because Linux, for better or worse, // just has the Lidgren thread go absolute brr polling. /// /// Extra amount of seconds to run-ahead for prediction on the client. /// public static readonly CVarDef NetPredictLagBias = CVarDef.Create( "net.predict_lag_bias", OperatingSystem.IsWindows() ? 0.016f : 0, CVar.CLIENTONLY | CVar.ARCHIVE); public static readonly CVarDef NetStateBufMergeThreshold = CVarDef.Create("net.state_buf_merge_threshold", 5, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// Whether to cull entities sent to clients from the server. /// If this is on, only entities immediately close to a client will be sent. /// Otherwise, all entities will be sent to all clients. /// public static readonly CVarDef NetPVS = CVarDef.Create("net.pvs", true, CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER); /// /// View size to take for PVS calculations, /// as the size of the sides of a square centered on the view points of clients. /// public static readonly CVarDef NetMaxUpdateRange = CVarDef.Create("net.maxupdaterange", 12.5f, CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER); /// /// This limits the number of new entities that can be sent to a client in a single game state. This exists to /// avoid stuttering on the client when it has to spawn a bunch of entities in a single tick. If ever entity /// spawning isn't hot garbage, this can be increased. /// public static readonly CVarDef NetPVSEntityBudget = CVarDef.Create("net.pvs_budget", 50, CVar.ARCHIVE | CVar.REPLICATED | CVar.CLIENT); /// /// This limits the number of entities that can re-enter a client's view in a single game state. This exists to /// avoid stuttering on the client when it has to update the transform of a bunch (700+) of entities in a single /// tick. Ideally this would just be handled client-side somehow. /// public static readonly CVarDef NetPVSEntityEnterBudget = CVarDef.Create("net.pvs_enter_budget", 200, CVar.ARCHIVE | CVar.REPLICATED | CVar.CLIENT); /// /// The amount of pvs-exiting entities that a client will process in a single tick. /// public static readonly CVarDef NetPVSEntityExitBudget = CVarDef.Create("net.pvs_exit_budget", 75, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// ZSTD compression level to use when compressing game states. /// public static readonly CVarDef NetPVSCompressLevel = CVarDef.Create("net.pvs_compress_level", 3, CVar.SERVERONLY); /// /// Log late input messages from clients. /// public static readonly CVarDef NetLogLateMsg = CVarDef.Create("net.log_late_msg", true); /// /// Ticks per second on the server. /// This influences both how frequently game code processes, and how frequently updates are sent to clients. /// public static readonly CVarDef NetTickrate = CVarDef.Create("net.tickrate", 60, CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER); /// /// Offset CurTime at server start by this amount (in seconds). /// public static readonly CVarDef NetTimeStartOffset = CVarDef.Create("net.time_start_offset", 0, CVar.SERVERONLY); /// /// How many seconds after the last message from the server before we consider it timed out. /// public static readonly CVarDef ConnectionTimeout = CVarDef.Create("net.connection_timeout", 25.0f, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// When doing the connection handshake, how long to wait before initial connection attempt packets. /// public static readonly CVarDef ResendHandshakeInterval = CVarDef.Create("net.handshake_interval", 3.0f, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// When doing the connection handshake, how many times to try sending initial connection attempt packets. /// public static readonly CVarDef MaximumHandshakeAttempts = CVarDef.Create("net.handshake_attempts", 5, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// If true, encrypt connections when possible. /// /// /// Encryption is currently only possible when the client has authenticated with the auth server. /// public static readonly CVarDef NetEncrypt = CVarDef.Create("net.encrypt", true, CVar.CLIENTONLY); /// /// If true, use UPnP to automatically forward ports on startup if possible. /// public static readonly CVarDef NetUPnP = CVarDef.Create("net.upnp", false, CVar.SERVERONLY); /// /// App identifier used by Lidgren. This must match between client and server for them to be able to connect. /// public static readonly CVarDef NetLidgrenAppIdentifier = CVarDef.Create("net.lidgren_app_identifier", "RobustToolbox"); /// /// Add random fake network loss to all outgoing UDP network packets, as a ratio of how many packets to drop. /// 0 = no packet loss, 1 = all packets dropped /// public static readonly CVarDef NetFakeLoss = CVarDef.Create("net.fakeloss", 0f, CVar.CHEAT); /// /// Add fake extra delay to all outgoing UDP network packets, in seconds. /// /// public static readonly CVarDef NetFakeLagMin = CVarDef.Create("net.fakelagmin", 0f, CVar.CHEAT); /// /// Add fake extra random delay to all outgoing UDP network packets, in seconds. /// The actual delay added for each packet is random between 0 and the specified value. /// /// public static readonly CVarDef NetFakeLagRand = CVarDef.Create("net.fakelagrand", 0f, CVar.CHEAT); /// /// Add random fake duplicates to all outgoing UDP network packets, as a ratio of how many packets to duplicate. /// 0 = no packets duplicated, 1 = all packets duplicated. /// public static readonly CVarDef NetFakeDuplicates = CVarDef.Create("net.fakeduplicates", 0f, CVar.CHEAT); /** * SUS */ /// /// If not zero on Windows, the server will sent the tick period for its own process via TimeBeginPeriod. /// This increases polling and sleep precision of the network and main thread, /// but may negatively affect battery life or such. /// public static readonly CVarDef SysWinTickPeriod = CVarDef.Create("sys.win_tick_period", 3, CVar.SERVERONLY); /// /// On non-FULL_RELEASE builds, use ProfileOptimization/tiered JIT to speed up game startup. /// public static readonly CVarDef SysProfileOpt = CVarDef.Create("sys.profile_opt", true); /// /// Controls stack size of the game logic thread, in bytes. /// public static readonly CVarDef SysGameThreadStackSize = CVarDef.Create("sys.game_thread_stack_size", 8 * 1024 * 1024); /// /// Controls thread priority of the game logic thread. /// public static readonly CVarDef SysGameThreadPriority = CVarDef.Create("sys.game_thread_priority", (int) ThreadPriority.AboveNormal); /* * METRICS */ /// /// Whether to enable a prometheus metrics server. /// public static readonly CVarDef MetricsEnabled = CVarDef.Create("metrics.enabled", false, CVar.SERVERONLY); /// /// The IP address to host the metrics server on. /// public static readonly CVarDef MetricsHost = CVarDef.Create("metrics.host", "localhost", CVar.SERVERONLY); /// /// The port to host the metrics server on. /// public static readonly CVarDef MetricsPort = CVarDef.Create("metrics.port", 44880, CVar.SERVERONLY); /// /// Enable detailed runtime metrics. Empty to disable. /// /// /// Runtime metrics are provided by https://github.com/djluck/prometheus-net.DotNetRuntime. /// Granularity of metrics can be further configured with related CVars. /// public static readonly CVarDef MetricsRuntime = CVarDef.Create("metrics.runtime", true, CVar.SERVERONLY); /// /// Mode for runtime GC metrics. Empty to disable. /// /// /// See the documentation for prometheus-net.DotNetRuntime for values and their metrics: /// https://github.com/djluck/prometheus-net.DotNetRuntime/blob/master/docs/metrics-exposed-5.0.md /// public static readonly CVarDef MetricsRuntimeGc = CVarDef.Create("metrics.runtime_gc", "Counters", CVar.SERVERONLY); /// /// Histogram buckets for GC and pause times. Comma-separated list of floats, in milliseconds. /// public static readonly CVarDef MetricsRuntimeGcHistogram = CVarDef.Create("metrics.runtime_gc_histogram", "0.5,1.0,2.0,4.0,6.0,10.0,15.0,20.0", CVar.SERVERONLY); /// /// Mode for runtime lock contention metrics. Empty to disable. /// /// /// See the documentation for prometheus-net.DotNetRuntime for values and their metrics: /// https://github.com/djluck/prometheus-net.DotNetRuntime/blob/master/docs/metrics-exposed-5.0.md /// public static readonly CVarDef MetricsRuntimeContention = CVarDef.Create("metrics.runtime_contention", "Counters", CVar.SERVERONLY); /// /// Sample lock contention every N events. Higher numbers increase accuracy but also memory use. /// public static readonly CVarDef MetricsRuntimeContentionSampleRate = CVarDef.Create("metrics.runtime_contention_sample_rate", 50, CVar.SERVERONLY); /// /// Mode for runtime thread pool metrics. Empty to disable. /// /// /// See the documentation for prometheus-net.DotNetRuntime for values and their metrics: /// https://github.com/djluck/prometheus-net.DotNetRuntime/blob/master/docs/metrics-exposed-5.0.md /// public static readonly CVarDef MetricsRuntimeThreadPool = CVarDef.Create("metrics.runtime_thread_pool", "Counters", CVar.SERVERONLY); /// /// Histogram buckets for thread pool queue length. /// public static readonly CVarDef MetricsRuntimeThreadPoolQueueHistogram = CVarDef.Create("metrics.runtime_thread_pool_queue_histogram", "0,10,30,60,120,180", CVar.SERVERONLY); /// /// Mode for runtime JIT metrics. Empty to disable. /// /// /// See the documentation for prometheus-net.DotNetRuntime for values and their metrics: /// https://github.com/djluck/prometheus-net.DotNetRuntime/blob/master/docs/metrics-exposed-5.0.md /// public static readonly CVarDef MetricsRuntimeJit = CVarDef.Create("metrics.runtime_jit", "Counters", CVar.SERVERONLY); /// /// Sample JIT every N events. Higher numbers increase accuracy but also memory use. /// public static readonly CVarDef MetricsRuntimeJitSampleRate = CVarDef.Create("metrics.runtime_jit_sample_rate", 10, CVar.SERVERONLY); /// /// Mode for runtime exception metrics. Empty to disable. /// /// /// See the documentation for prometheus-net.DotNetRuntime for values and their metrics: /// https://github.com/djluck/prometheus-net.DotNetRuntime/blob/master/docs/metrics-exposed-5.0.md /// public static readonly CVarDef MetricsRuntimeException = CVarDef.Create("metrics.runtime_exception", "Counters", CVar.SERVERONLY); /// /// Mode for runtime TCP socket metrics. Empty to disable. /// /// /// See the documentation for prometheus-net.DotNetRuntime for values and their metrics: /// https://github.com/djluck/prometheus-net.DotNetRuntime/blob/master/docs/metrics-exposed-5.0.md /// public static readonly CVarDef MetricsRuntimeSocket = CVarDef.Create("metrics.runtime_socket", "Counters", CVar.SERVERONLY); /* * STATUS */ /// /// Whether to enable the HTTP status API server. /// /// /// This is necessary for people to be able to connect via the launcher. /// public static readonly CVarDef StatusEnabled = CVarDef.Create("status.enabled", true, CVar.ARCHIVE | CVar.SERVERONLY); /// /// Prefix address to bind the HTTP status API server to. /// This is in the form of addr:port, with * serving as a wildcard "all". /// If empty (the default), this is automatically generated to match the UDP ports. /// public static readonly CVarDef StatusBind = CVarDef.Create("status.bind", "", CVar.ARCHIVE | CVar.SERVERONLY); /// /// Max amount of concurrent connections to the HTTP status server. /// Note that this is for actively processing requests, not kept-alive/pooled connections. /// public static readonly CVarDef StatusMaxConnections = CVarDef.Create("status.max_connections", 5, CVar.SERVERONLY); /// /// UDP address that should be advertised and the launcher will use to connect to. /// If not set, the launcher will automatically infer this based on the address it already has. /// public static readonly CVarDef StatusConnectAddress = CVarDef.Create("status.connectaddress", "", CVar.ARCHIVE | CVar.SERVERONLY); /* * BUILD */ /// /// Engine version that launcher needs to connect to this server. /// public static readonly CVarDef BuildEngineVersion = CVarDef.Create("build.engine_version", "", CVar.SERVERONLY); /// /// Fork ID, as a hint to the launcher to manage local files. /// This can be anything, it does not need a strict format. /// public static readonly CVarDef BuildForkId = CVarDef.Create("build.fork_id", "", CVar.SERVERONLY); /// /// Version string, as a hint to the launcher to manage local files. /// This can be anything, it does not need a strict format. /// public static readonly CVarDef BuildVersion = CVarDef.Create("build.version", "", CVar.SERVERONLY); /// /// Content pack the launcher should download to connect to this server. /// public static readonly CVarDef BuildDownloadUrl = CVarDef.Create("build.download_url", string.Empty, CVar.SERVERONLY); /// /// URL of the content manifest the launcher should download to connect to this server. /// public static readonly CVarDef BuildManifestUrl = CVarDef.Create("build.manifest_url", string.Empty, CVar.SERVERONLY); /// /// URL at which the launcher can download the manifest game files. /// public static readonly CVarDef BuildManifestDownloadUrl = CVarDef.Create("build.manifest_download_url", string.Empty, CVar.SERVERONLY); /// /// SHA-256 hash of the content pack hosted at build.download_url /// public static readonly CVarDef BuildHash = CVarDef.Create("build.hash", "", CVar.SERVERONLY); /// /// SHA-256 hash of the manifest hosted at build.manifest_url /// public static readonly CVarDef BuildManifestHash = CVarDef.Create("build.manifest_hash", "", CVar.SERVERONLY); /* * WATCHDOG */ /// /// API token set by the watchdog to communicate to the server. /// public static readonly CVarDef WatchdogToken = CVarDef.Create("watchdog.token", "", CVar.SERVERONLY | CVar.CONFIDENTIAL); /// /// Watchdog server identifier for this server. /// public static readonly CVarDef WatchdogKey = CVarDef.Create("watchdog.key", "", CVar.SERVERONLY); /// /// Base URL of the watchdog on the local machine. /// public static readonly CVarDef WatchdogBaseUrl = CVarDef.Create("watchdog.baseUrl", "http://localhost:5000", CVar.SERVERONLY); /* * GAME */ /// /// Hard max-cap of concurrent connections for the main game networking. /// /// /// This cannot be bypassed in any way, since it is used by Lidgren internally. /// public static readonly CVarDef GameMaxPlayers = CVarDef.Create("game.maxplayers", 32, CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER); /// /// Name of the game server. This shows up in the launcher and potentially parts of the UI. /// public static readonly CVarDef GameHostName = CVarDef.Create("game.hostname", "MyServer", CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER); /// /// Description of the game server in the launcher. /// public static readonly CVarDef GameDesc = CVarDef.Create("game.desc", "Just another server, don't mind me!", CVar.SERVERONLY); /// /// If a grid is shrunk to include no more tiles should it be deleted. /// public static readonly CVarDef GameDeleteEmptyGrids = CVarDef.Create("game.delete_empty_grids", true, CVar.ARCHIVE | CVar.SERVER); /// /// Automatically pause simulation if there are no players connected to the game server. /// public static readonly CVarDef GameAutoPauseEmpty = CVarDef.Create("game.auto_pause_empty", true, CVar.SERVERONLY); /* * LOG */ /// /// Write server log to disk. /// public static readonly CVarDef LogEnabled = CVarDef.Create("log.enabled", true, CVar.ARCHIVE | CVar.SERVERONLY); /// /// Path to put log files in if log writing is enabled. /// public static readonly CVarDef LogPath = CVarDef.Create("log.path", "logs", CVar.ARCHIVE | CVar.SERVERONLY); /// /// Format for individual log files, based on current date and time replacement. /// public static readonly CVarDef LogFormat = CVarDef.Create("log.format", "log_%(date)s-T%(time)s.txt", CVar.ARCHIVE | CVar.SERVERONLY); /// /// Minimum log level for all server logging. /// public static readonly CVarDef LogLevel = CVarDef.Create("log.level", Log.LogLevel.Info, CVar.ARCHIVE | CVar.SERVERONLY); /// /// Log a separate exception log for all exceptions that occur. /// public static readonly CVarDef LogRuntimeLog = CVarDef.Create("log.runtimelog", true, CVar.ARCHIVE | CVar.SERVERONLY); /* * Light */ /// /// This is the maximum the viewport is enlarged to check for any intersecting render-trees for lights. /// This should be set to your maximum light radius. /// /// /// If this value is too small it just means there may be pop-in where a light is located on a render-tree /// outside of our viewport. /// public static readonly CVarDef MaxLightRadius = CVarDef.Create("light.max_radius", 32.1f, CVar.CLIENTONLY); /* * Lookup */ /// /// Like MaxLightRadius this is how far we enlarge lookups to find intersecting components. /// This should be set to your maximum entity size. /// public static readonly CVarDef LookupEnlargementRange = CVarDef.Create("lookup.enlargement_range", 10.0f, CVar.ARCHIVE | CVar.REPLICATED | CVar.CHEAT); /* * LOKI */ /// /// Whether to send the server log to Grafana Loki. /// public static readonly CVarDef LokiEnabled = CVarDef.Create("loki.enabled", false, CVar.SERVERONLY); /// /// The name of the current server, set as the value of the "Server" label in Loki. /// public static readonly CVarDef LokiName = CVarDef.Create("loki.name", "", CVar.SERVERONLY); /// /// The address of the Loki server to send to. /// public static readonly CVarDef LokiAddress = CVarDef.Create("loki.address", "", CVar.SERVERONLY); /// /// If set, a HTTP Basic auth username to use when talking to Loki. /// public static readonly CVarDef LokiUsername = CVarDef.Create("loki.username", "", CVar.SERVERONLY); /// /// If set, a HTTP Basic auth password to use when talking to Loki. /// public static readonly CVarDef LokiPassword = CVarDef.Create("loki.password", "", CVar.SERVERONLY); /* * AUTH */ /// /// Mode with which to handle authentication on the server. /// See the documentation of the enum for values. /// public static readonly CVarDef AuthMode = CVarDef.Create("auth.mode", (int) Network.AuthMode.Optional, CVar.SERVERONLY); /// /// Allow unauthenticated localhost connections, even if the auth mode is set to required. /// These connections have a "localhost@" prefix as username. /// public static readonly CVarDef AuthAllowLocal = CVarDef.Create("auth.allowlocal", true, CVar.SERVERONLY); // Only respected on server, client goes through IAuthManager for security. /// /// Authentication server address. /// public static readonly CVarDef AuthServer = CVarDef.Create("auth.server", AuthManager.DefaultAuthServer, CVar.SERVERONLY); /* * RENDERING */ /// /// This biases the RSI-direction used to draw diagonally oriented 4-directional sprites to avoid flickering between directions. A positive /// value biases towards facing N/S, while a negative value will bias towards E/W. /// /// /// The bias needs to be large enough to prevent sprites on rotating grids from flickering, but should be /// small enough that it is generally unnoticeable. Currently it is somewhat large to combat issues with /// eye-lerping & grid rotations. /// public static readonly CVarDef RenderSpriteDirectionBias = CVarDef.Create("render.sprite_direction_bias", -0.05, CVar.ARCHIVE | CVar.CLIENTONLY); /* * DISPLAY */ /// /// Enable VSync for rendering. /// public static readonly CVarDef DisplayVSync = CVarDef.Create("display.vsync", true, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// Window mode for the main game window. 0 = windowed, 1 = fullscreen. /// public static readonly CVarDef DisplayWindowMode = CVarDef.Create("display.windowmode", 0, CVar.ARCHIVE | CVar.CLIENTONLY); /// /// Initial width of the game window when running on windowed mode. /// public static readonly CVarDef DisplayWidth = CVarDef.Create("display.width", 1280, CVar.CLIENTONLY); /// /// Initial height of the game window when running on windowed mode. /// public static readonly CVarDef DisplayHeight = CVarDef.Create("display.height", 720, CVar.CLIENTONLY); /// /// Factor by which to divide the horizontal and vertical resolution of lighting framebuffers, /// relative to the viewport framebuffer size. /// public static readonly CVarDef DisplayLightMapDivider = CVarDef.Create("display.lightmapdivider", 2, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// Maximum amount of lights that can be rendered in a single viewport at once. /// public static readonly CVarDef DisplayMaxLightsPerScene = CVarDef.Create("display.maxlightsperscene", 128, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// Whether to give shadows a soft edge when rendering. /// public static readonly CVarDef DisplaySoftShadows = CVarDef.Create("display.softshadows", true, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// Apply a gaussian blur to the final lighting framebuffer to smoothen it out a little. /// public static readonly CVarDef DisplayBlurLight = CVarDef.Create("display.blur_light", true, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// Factor by which to blur the lighting framebuffer under display.blur_light. /// public static readonly CVarDef DisplayBlurLightFactor = CVarDef.Create("display.blur_light_factor", 0.001f, CVar.CLIENTONLY | CVar.ARCHIVE); /// /// UI scale for all UI controls. If zero, this value is automatically calculated from the OS. /// public static readonly CVarDef DisplayUIScale = CVarDef.Create("display.uiScale", 0f, CVar.ARCHIVE | CVar.CLIENTONLY); // Clyde related enums are in Clyde.Constants.cs. /// /// Which renderer to use to render the game. /// public static readonly CVarDef DisplayRenderer = CVarDef.Create("display.renderer", 0, CVar.CLIENTONLY); /// /// Whether to use compatibility mode. /// /// /// This can change certain behaviors like GL version selection to try to avoid driver crashes/bugs. /// public static readonly CVarDef DisplayCompat = CVarDef.Create("display.compat", false, CVar.CLIENTONLY); /// /// Which OpenGL version to use for the OpenGL renderer. /// Values correspond to the (private) RendererOpenGLVersion enum in Clyde. /// public static readonly CVarDef DisplayOpenGLVersion = CVarDef.Create("display.opengl_version", 0, CVar.CLIENTONLY); /// /// On Windows, use ANGLE as OpenGL implementation. /// public static readonly CVarDef DisplayAngle = CVarDef.Create("display.angle", false, CVar.CLIENTONLY); /// /// Use a custom DXGI swap chain when using ANGLE. /// Should improve performance and fixes main window sRGB handling with ANGLE. /// public static readonly CVarDef DisplayAngleCustomSwapChain = CVarDef.Create("display.angle_custom_swap_chain", true, CVar.CLIENTONLY); /// /// Force ANGLE to create a GLES2 context (not a compatible GLES3 context). /// public static readonly CVarDef DisplayAngleForceEs2 = CVarDef.Create("display.angle_force_es2", false, CVar.CLIENTONLY); /// /// Force ANGLE to create a context from a D3D11 FL 10_0 device. /// public static readonly CVarDef DisplayAngleForce10_0 = CVarDef.Create("display.angle_force_10_0", false, CVar.CLIENTONLY); /// /// Force usage of DXGI 1.1 when using custom swap chain setup. /// public static readonly CVarDef DisplayAngleDxgi1 = CVarDef.Create("display.angle_dxgi1", false, CVar.CLIENTONLY); /// /// Try to use the display adapter with this name, if the current renderer supports selecting it. /// public static readonly CVarDef DisplayAdapter = CVarDef.Create("display.adapter", "", CVar.CLIENTONLY); /// /// What type of GPU to prefer when creating a graphics context, for things such as hybrid GPU laptops. /// /// /// This setting is not always respect depending on platform and rendering API used. /// Values are: /// 0 = unspecified (DXGI_GPU_PREFERENCE_UNSPECIFIED) /// 1 = minimum power (DXGI_GPU_PREFERENCE_MINIMUM_POWER) /// 2 = high performance (DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE) /// public static readonly CVarDef DisplayGpuPreference = CVarDef.Create("display.gpu_preference", 2, CVar.CLIENTONLY); /// /// Use EGL to create GL context instead of GLFW, if possible. /// /// /// This only tries to use EGL if on a platform like X11 or Windows (w/ ANGLE) where it is possible. /// public static readonly CVarDef DisplayEgl = CVarDef.Create("display.egl", false, CVar.CLIENTONLY); /// /// Enable allowES3OnFL10_0 on ANGLE. /// public static readonly CVarDef DisplayAngleEs3On10_0 = CVarDef.Create("display.angle_es3_on_10_0", true, CVar.CLIENTONLY); /// /// Base DPI to render fonts at. This can be further scaled based on display.uiScale. /// public static readonly CVarDef DisplayFontDpi = CVarDef.Create("display.fontdpi", 96, CVar.CLIENTONLY); /// /// Override detected OpenGL version, for testing. /// public static readonly CVarDef DisplayOGLOverrideVersion = CVarDef.Create("display.ogl_override_version", string.Empty, CVar.CLIENTONLY); /// /// Run glCheckError() after (almost) every GL call. /// public static readonly CVarDef DisplayOGLCheckErrors = CVarDef.Create("display.ogl_check_errors", false, CVar.CLIENTONLY); /// /// Forces synchronization of multi-window rendering with glFinish when GL fence sync is unavailable. /// /// /// If this is disabled multi-window rendering on GLES2 might run better, dunno. /// It technically causes UB thanks to the OpenGL spec with cross-context sync. Hope that won't happen. /// Let's be real the OpenGL specification is basically just a suggestion to drivers anyways so who cares. /// public static readonly CVarDef DisplayForceSyncWindows = CVarDef.Create("display.force_sync_windows", true, CVar.CLIENTONLY); /// /// Use a separate thread for multi-window blitting. /// public static readonly CVarDef DisplayThreadWindowBlit = CVarDef.Create("display.thread_window_blit", true, CVar.CLIENTONLY); /// /// Buffer size of input command channel from windowing thread to main game thread. /// public static readonly CVarDef DisplayInputBufferSize = CVarDef.Create("display.input_buffer_size", 32, CVar.CLIENTONLY); /// /// Insert stupid performance hitches into the windowing thread, to test how the game thread handles it. /// public static readonly CVarDef DisplayWin32Experience = CVarDef.Create("display.win32_experience", false, CVar.CLIENTONLY); /// /// The window icon set to use. Overriden by GameControllerOptions on startup. /// /// /// Dynamically changing this does nothing. /// public static readonly CVarDef DisplayWindowIconSet = CVarDef.Create("display.window_icon_set", "", CVar.CLIENTONLY); /// /// The splash logo to use. Overriden by GameControllerOptions on startup. /// /// /// Dynamically changing this does nothing. /// public static readonly CVarDef DisplaySplashLogo = CVarDef.Create("display.splash_logo", "", CVar.CLIENTONLY); /// /// Use US QWERTY hotkeys for reported key names. /// public static readonly CVarDef DisplayUSQWERTYHotkeys = CVarDef.Create("display.use_US_QWERTY_hotkeys", false, CVar.CLIENTONLY | CVar.ARCHIVE); public static readonly CVarDef DisplayWindowingApi = CVarDef.Create("display.windowing_api", "glfw", CVar.CLIENTONLY); /// /// If true and on Windows 11 Build 22000, /// specify DWMWA_USE_IMMERSIVE_DARK_MODE to have dark mode window titles if the system is set to dark mode. /// public static readonly CVarDef DisplayWin11ImmersiveDarkMode = CVarDef.Create("display.win11_immersive_dark_mode", true, CVar.CLIENTONLY); /* * AUDIO */ public static readonly CVarDef AudioAttenuation = CVarDef.Create("audio.attenuation", (int) Attenuation.Default, CVar.REPLICATED | CVar.ARCHIVE); /// /// Audio device to try to output audio to by default. /// public static readonly CVarDef AudioDevice = CVarDef.Create("audio.device", string.Empty, CVar.CLIENTONLY); /// /// Master volume for audio output. /// public static readonly CVarDef AudioMasterVolume = CVarDef.Create("audio.mastervolume", 1.0f, CVar.ARCHIVE | CVar.CLIENTONLY); /* * PLAYER */ /// /// Player name to send from user, if not overriden by a myriad of factors. /// public static readonly CVarDef PlayerName = CVarDef.Create("player.name", "JoeGenero", CVar.ARCHIVE | CVar.CLIENTONLY); /* * PHYSICS */ /// /// How much to expand broadphase checking for. This is useful for cross-grid collisions. /// Performance impact if additional broadphases are being checked. /// public static readonly CVarDef BroadphaseExpand = CVarDef.Create("physics.broadphase_expand", 2f, CVar.ARCHIVE | CVar.REPLICATED); // Grid fixtures /// /// I'ma be real with you: the only reason this exists is to get tests working. /// public static readonly CVarDef GenerateGridFixtures = CVarDef.Create("physics.grid_fixtures", true, CVar.REPLICATED); /// /// Can grids split if not connected by cardinals /// public static readonly CVarDef GridSplitting = CVarDef.Create("physics.grid_splitting", true, CVar.ARCHIVE); /// /// How much to enlarge grids when determining their fixture bounds. /// public static readonly CVarDef GridFixtureEnlargement = CVarDef.Create("physics.grid_fixture_enlargement", -PhysicsConstants.PolygonRadius, CVar.ARCHIVE | CVar.REPLICATED); // - Contacts public static readonly CVarDef ContactMultithreadThreshold = CVarDef.Create("physics.contact_multithread_threshold", 32); public static readonly CVarDef ContactMinimumThreads = CVarDef.Create("physics.contact_minimum_threads", 2); // - Sleep public static readonly CVarDef AngularSleepTolerance = CVarDef.Create("physics.angsleeptol", 0.3f / 180.0f * MathF.PI); public static readonly CVarDef LinearSleepTolerance = CVarDef.Create("physics.linsleeptol", 0.1f); public static readonly CVarDef SleepAllowed = CVarDef.Create("physics.sleepallowed", true); // Box2D default is 0.5f public static readonly CVarDef TimeToSleep = CVarDef.Create("physics.timetosleep", 0.2f); // - Solver public static readonly CVarDef PositionConstraintsPerThread = CVarDef.Create("physics.position_constraints_per_thread", 32); public static readonly CVarDef PositionConstraintsMinimumThread = CVarDef.Create("physics.position_constraints_minimum_threads", 2); public static readonly CVarDef VelocityConstraintsPerThread = CVarDef.Create("physics.velocity_constraints_per_thread", 32); public static readonly CVarDef VelocityConstraintMinimumThreads = CVarDef.Create("physics.velocity_constraints_minimum_threads", 2); // These are the minimum recommended by Box2D with the standard being 8 velocity 3 position iterations. // Trade-off is obviously performance vs how long it takes to stabilise. // PhysX opts for fewer velocity iterations and more position but they also have a different solver. public static readonly CVarDef PositionIterations = CVarDef.Create("physics.positer", 3); public static readonly CVarDef VelocityIterations = CVarDef.Create("physics.veliter", 8); public static readonly CVarDef WarmStarting = CVarDef.Create("physics.warmstart", true); public static readonly CVarDef AutoClearForces = CVarDef.Create("physics.autoclearforces", true); /// /// A velocity threshold for elastic collisions. Any collision with a relative linear /// velocity below this threshold will be treated as inelastic. /// public static readonly CVarDef VelocityThreshold = CVarDef.Create("physics.velocitythreshold", 0.5f); // TODO: Copy Box2D's comments on baumgarte I think it's on the solver class. /// /// How much overlap is resolved per tick. /// public static readonly CVarDef Baumgarte = CVarDef.Create("physics.baumgarte", 0.2f); /// /// If true, it will run a GiftWrap convex hull on all polygon inputs. /// This makes for a more stable engine when given random input, /// but if speed of the creation of polygons are more important, /// you might want to set this to false. /// public static readonly CVarDef ConvexHullPolygons = CVarDef.Create("physics.convexhullpolygons", true); public static readonly CVarDef MaxPolygonVertices = CVarDef.Create("physics.maxpolygonvertices", 8); public static readonly CVarDef MaxLinearCorrection = CVarDef.Create("physics.maxlinearcorrection", 0.2f); public static readonly CVarDef MaxAngularCorrection = CVarDef.Create("physics.maxangularcorrection", 8.0f / 180.0f * MathF.PI); // - Maximums /// /// Maximum linear velocity per second. /// Make sure that MaxLinVelocity / is around 0.5 or higher so that moving objects don't go through walls. /// MaxLinVelocity is compared to the dot product of linearVelocity * frameTime. /// /// /// Default is 35 m/s. Around half a tile per tick at 60 ticks per second. /// public static readonly CVarDef MaxLinVelocity = CVarDef.Create("physics.maxlinvelocity", 35f); /// /// Maximum angular velocity in full rotations per second. /// MaxAngVelocity is compared to the squared rotation. /// /// /// Default is 15 rotations per second. Approximately a quarter rotation per tick at 60 ticks per second. /// public static readonly CVarDef MaxAngVelocity = CVarDef.Create("physics.maxangvelocity", 15f); /* * User interface */ /// /// Change the UITheme /// public static readonly CVarDef InterfaceTheme = CVarDef.Create("interface.theme", "", CVar.CLIENTONLY | CVar.ARCHIVE); /// ///Minimum resolution to start clamping autoscale to 1 /// public static readonly CVarDef ResAutoScaleUpperX = CVarDef.Create("interface.resolutionAutoScaleUpperCutoffX",1080 , CVar.CLIENTONLY); /// ///Minimum resolution to start clamping autoscale to 1 /// public static readonly CVarDef ResAutoScaleUpperY = CVarDef.Create("interface.resolutionAutoScaleUpperCutoffY",720 , CVar.CLIENTONLY); /// ///Maximum resolution to start clamping autos scale to autoscale minimum /// public static readonly CVarDef ResAutoScaleLowX = CVarDef.Create("interface.resolutionAutoScaleLowerCutoffX",520 , CVar.CLIENTONLY); /// ///Maximum resolution to start clamping autos scale to autoscale minimum /// public static readonly CVarDef ResAutoScaleLowY = CVarDef.Create("interface.resolutionAutoScaleLowerCutoffY",520 , CVar.CLIENTONLY); /// /// The minimum ui scale value that autoscale will scale to /// public static readonly CVarDef ResAutoScaleMin = CVarDef.Create("interface.resolutionAutoScaleMinimum",0.5f , CVar.CLIENTONLY); /// ///Enable the UI autoscale system on this control, this will scale down the UI for lower resolutions /// public static readonly CVarDef ResAutoScaleEnabled = CVarDef.Create("interface.resolutionAutoScaleEnabled",true , CVar.CLIENTONLY | CVar.ARCHIVE); /* * DISCORD */ /// /// Enable Discord rich presence integration. /// public static readonly CVarDef DiscordEnabled = CVarDef.Create("discord.enabled", true, CVar.CLIENTONLY); /* * RES */ /// /// Verify that resource path capitalization is correct, even on case-insensitive file systems such as Windows. /// public static readonly CVarDef ResCheckPathCasing = CVarDef.Create("res.checkpathcasing", false); /// /// Preload all textures at client startup to avoid hitches at runtime. /// public static readonly CVarDef ResTexturePreloadingEnabled = CVarDef.Create("res.texturepreloadingenabled", true, CVar.CLIENTONLY); // TODO: Currently unimplemented. /// /// Cache texture preload data to speed things up even further. /// public static readonly CVarDef ResTexturePreloadCache = CVarDef.Create("res.texture_preload_cache", true, CVar.CLIENTONLY); /// /// Override seekability of resource streams returned by ResourceManager. /// See for int values. /// /// /// This is intended to be a debugging tool primarily. /// Non-default seek modes WILL result in worse performance. /// public static readonly CVarDef ResStreamSeekMode = CVarDef.Create("res.stream_seek_mode", (int)ContentPack.StreamSeekMode.None); /* * DEBUG */ /// /// Target framerate for things like the frame graph. /// public static readonly CVarDef DebugTargetFps = CVarDef.Create("debug.target_fps", 60, CVar.CLIENTONLY | CVar.ARCHIVE); /* * MIDI */ public static readonly CVarDef MidiVolume = CVarDef.Create("midi.volume", 0f, CVar.CLIENTONLY | CVar.ARCHIVE); /* * HUB * CVars related to public master server hub */ /// /// Whether to advertise this server to the public server hub. /// public static readonly CVarDef HubAdvertise = CVarDef.Create("hub.advertise", false, CVar.SERVERONLY); /// /// Comma-separated list of tags to advertise via the status server (and therefore, to the hub). /// public static readonly CVarDef HubTags = CVarDef.Create("hub.tags", "", CVar.ARCHIVE | CVar.SERVERONLY); /// /// URL of the master hub server to advertise to. /// public static readonly CVarDef HubMasterUrl = CVarDef.Create("hub.master_url", "https://central.spacestation14.io/hub/", CVar.SERVERONLY); /// /// URL of this server to advertise. /// This is automatically inferred by the hub server based on IP address if left empty, /// but if you want to specify a domain or use ss14:// you should specify this manually. /// You also have to set this if you change status.bind. /// public static readonly CVarDef HubServerUrl = CVarDef.Create("hub.server_url", "", CVar.SERVERONLY); /// /// URL to use to automatically try to detect IPv4 address. /// This is only used if hub.server_url is unset. /// public static readonly CVarDef HubIpifyUrl = CVarDef.Create("hub.ipify_url", "https://api.ipify.org?format=json", CVar.SERVERONLY); /// /// How long to wait between advertise pings to the hub server. /// public static readonly CVarDef HubAdvertiseInterval = CVarDef.Create("hub.advertise_interval", 120, CVar.SERVERONLY); /* * ACZ */ /// /// Whether to use stream compression instead of per-file compression when transmitting ACZ data. /// Enabling stream compression significantly reduces bandwidth usage of downloads, /// but increases server and launcher CPU load. It also makes final files stored on the client compressed less. /// public static readonly CVarDef AczStreamCompress = CVarDef.Create("acz.stream_compress", false, CVar.SERVERONLY); /// /// ZSTD Compression level to use when doing ACZ stream compressed. /// public static readonly CVarDef AczStreamCompressLevel = CVarDef.Create("acz.stream_compress_level", 3, CVar.SERVERONLY); /// /// Whether to do compression on individual files for ACZ downloads. /// Automatically forced off if stream compression is enabled. /// public static readonly CVarDef AczBlobCompress = CVarDef.Create("acz.blob_compress", true, CVar.SERVERONLY); /// /// ZSTD Compression level to use for individual file compression. /// public static readonly CVarDef AczBlobCompressLevel = CVarDef.Create("acz.blob_compress_level", 14, CVar.SERVERONLY); // Could consider using a ratio for this? /// /// Amount of bytes that need to be saved by compression for the compression to be "worth it". /// public static readonly CVarDef AczBlobCompressSaveThreshold = CVarDef.Create("acz.blob_compress_save_threshold", 14, CVar.SERVERONLY); /// /// Whether to ZSTD compress the ACZ manifest. /// If this is enabled (the default) then non-compressed manifest requests will be decompressed live. /// public static readonly CVarDef AczManifestCompress = CVarDef.Create("acz.manifest_compress", true, CVar.SERVERONLY); /// /// Compression level for ACZ manifest compression. /// public static readonly CVarDef AczManifestCompressLevel = CVarDef.Create("acz.manifest_compress_level", 14, CVar.SERVERONLY); /* * CON */ /// /// Add artificial delay (in seconds) to console completion fetching, even for local commands. /// /// /// Intended for debugging the console completion system. /// public static readonly CVarDef ConCompletionDelay = CVarDef.Create("con.completion_delay", 0f, CVar.CLIENTONLY); /// /// The amount of completions to show in console completion drop downs. /// public static readonly CVarDef ConCompletionCount = CVarDef.Create("con.completion_count", 15, CVar.CLIENTONLY); /// /// The minimum margin of options to keep on either side of the completion cursor, when scrolling through. /// public static readonly CVarDef ConCompletionMargin = CVarDef.Create("con.completion_margin", 3, CVar.CLIENTONLY); /* * THREAD */ /// /// The nominal parallel processing count to use for parallelized operations. /// The default of 0 automatically selects the system's processor count. /// public static readonly CVarDef ThreadParallelCount = CVarDef.Create("thread.parallel_count", 0); /* * PROF */ /// /// Enabled the profiling system. /// public static readonly CVarDef ProfEnabled = CVarDef.Create("prof.enabled", false); /// /// Event log buffer size for the profiling system. /// public static readonly CVarDef ProfBufferSize = CVarDef.Create("prof.buffer_size", ConstFullRelease ? 8192 : 65536); /// /// Index log buffer size for the profiling system. /// public static readonly CVarDef ProfIndexSize = CVarDef.Create("prof.index_size", ConstFullRelease ? 128 : 1024); } }