Minor config default changes (#3543)

Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
Pieter-Jan Briers
2022-12-20 23:20:52 +01:00
committed by GitHub
parent 8c5e790cb5
commit 20bbe30a23
5 changed files with 56 additions and 15 deletions

View File

@@ -35,7 +35,8 @@ END TEMPLATE-->
### Breaking changes
*None yet*
* Changed default for `net.buffer_size` to `2`.
* Changed default for `auth.mode` to `Required`. On development builds, the default is overriden to remain at `Optional`, so this only affects published servers.
### New features
@@ -47,7 +48,7 @@ END TEMPLATE-->
### Other
*None yet*
* Cleaned up some `FULL_RELEASE` CVar default value overrides into `CVarDefaultOverrides.cs`.
### Internal

View File

@@ -321,6 +321,8 @@ namespace Robust.Client
_configurationManager.LoadCVarsFromAssembly(typeof(GameController).Assembly); // Client
_configurationManager.LoadCVarsFromAssembly(typeof(IConfigurationManager).Assembly); // Shared
CVarDefaultOverrides.OverrideClient(_configurationManager);
if (Options.LoadConfigAndUserData)
{
var configFile = Path.Combine(userDataDir, Options.ConfigFileName);
@@ -347,9 +349,6 @@ namespace Robust.Client
_parallelMgr.Initialize();
_prof.Initialize();
#if !FULL_RELEASE
_configurationManager.OverrideDefault(CVars.ProfEnabled, true);
#endif
_resourceCache.Initialize(Options.LoadConfigAndUserData ? userDataDir : null);

View File

@@ -183,6 +183,8 @@ namespace Robust.Server
_config.LoadCVarsFromAssembly(typeof(BaseServer).Assembly); // Robust.Server
_config.LoadCVarsFromAssembly(typeof(IConfigurationManager).Assembly); // Robust.Shared
CVarDefaultOverrides.OverrideServer(_config);
_config.OverrideConVars(EnvironmentVariables.GetEnvironmentCVars());
if (_commandLineArgs != null)

View File

@@ -0,0 +1,45 @@
using Robust.Shared.Configuration;
using Robust.Shared.Network;
namespace Robust.Shared;
/// <summary>
/// Contains some preset CVar overrides applied in the engine to aid development.
/// </summary>
internal static class CVarDefaultOverrides
{
public static void OverrideClient(IConfigurationManager cfg)
{
OverrideShared(cfg);
#if FULL_RELEASE
return;
#endif
// Profiling is currently only useful on the client, so only enable it there.
cfg.OverrideDefault(CVars.ProfEnabled, true);
}
public static void OverrideServer(IConfigurationManager cfg)
{
OverrideShared(cfg);
#if FULL_RELEASE
return;
#endif
// Set auth to optional in case you're doing any funny development shenanigans.
cfg.OverrideDefault(CVars.AuthMode, (int) AuthMode.Optional);
}
private static void OverrideShared(IConfigurationManager cfg)
{
#if FULL_RELEASE
return;
#endif
// Increase default profiler memory use on local builds to make it more useful.
cfg.OverrideDefault(CVars.ProfBufferSize, 65536);
cfg.OverrideDefault(CVars.ProfIndexSize, 1024);
}
}

View File

@@ -10,16 +10,10 @@ using Robust.Shared.Physics;
namespace Robust.Shared
{
/// <seealso cref="CVarDefaultOverrides"/>
[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");
@@ -121,7 +115,7 @@ namespace Robust.Shared
/// The target number of game states to keep buffered up to smooth out network inconsistency.
/// </summary>
public static readonly CVarDef<int> NetBufferSize =
CVarDef.Create("net.buffer_size", 0, CVar.ARCHIVE | CVar.CLIENTONLY);
CVarDef.Create("net.buffer_size", 2, CVar.ARCHIVE | CVar.CLIENTONLY);
/// <summary>
/// Enable verbose game state/networking logging.
@@ -1384,12 +1378,12 @@ namespace Robust.Shared
/// <summary>
/// Event log buffer size for the profiling system.
/// </summary>
public static readonly CVarDef<int> ProfBufferSize = CVarDef.Create("prof.buffer_size", ConstFullRelease ? 8192 : 65536);
public static readonly CVarDef<int> ProfBufferSize = CVarDef.Create("prof.buffer_size", 8192);
/// <summary>
/// Index log buffer size for the profiling system.
/// </summary>
public static readonly CVarDef<int> ProfIndexSize = CVarDef.Create("prof.index_size", ConstFullRelease ? 128 : 1024);
public static readonly CVarDef<int> ProfIndexSize = CVarDef.Create("prof.index_size", 128);
/*
* CFG