Add new PVS options slider (#12146)
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
x:Class="Content.Client.Options.UI.Tabs.NetworkTab">
|
||||
<BoxContainer Orientation="Vertical" >
|
||||
<BoxContainer Orientation="Vertical" Margin="8 8 8 8" VerticalExpand="True">
|
||||
<BoxContainer Orientation="Horizontal" Margin="4 10 4 0">
|
||||
<CheckBox Name="NetPredictCheckbox" Text="{Loc 'ui-options-net-predict'}" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" Margin="4 10 4 0">
|
||||
<Label Text="{Loc 'ui-options-net-interp-ratio'}" />
|
||||
<Control MinSize="8 0" />
|
||||
@@ -31,12 +34,26 @@
|
||||
<Label Name="NetPredictTickBiasLabel" MinSize="48 0" Align="Right" />
|
||||
<Control MinSize="4 0"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" Margin="4 10 4 0">
|
||||
<Label Text="{Loc 'ui-options-net-pvs-spawn'}" />
|
||||
<Control MinSize="8 0" />
|
||||
<Slider Name="NetPvsSpawnSlider"
|
||||
ToolTip="{Loc 'ui-options-net-pvs-spawn-tooltip'}"
|
||||
MaxValue="150"
|
||||
MinValue="20"
|
||||
HorizontalExpand="True"
|
||||
MinSize="80 0"
|
||||
Rounded="True" />
|
||||
<Control MinSize="8 0" />
|
||||
<Label Name="NetPvsSpawnLabel" MinSize="48 0" Align="Right" />
|
||||
<Control MinSize="4 0"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" Margin="4 10 4 0">
|
||||
<Label Text="{Loc 'ui-options-net-pvs-entry'}" />
|
||||
<Control MinSize="8 0" />
|
||||
<Slider Name="NetPvsEntrySlider"
|
||||
ToolTip="{Loc 'ui-options-net-pvs-entry-tooltip'}"
|
||||
MaxValue="150"
|
||||
MaxValue="500"
|
||||
MinValue="20"
|
||||
HorizontalExpand="True"
|
||||
MinSize="80 0"
|
||||
|
||||
@@ -24,9 +24,11 @@ namespace Content.Client.Options.UI.Tabs
|
||||
ApplyButton.OnPressed += OnApplyButtonPressed;
|
||||
ResetButton.OnPressed += OnResetButtonPressed;
|
||||
DefaultButton.OnPressed += OnDefaultButtonPressed;
|
||||
NetPredictCheckbox.OnToggled += OnPredictToggled;
|
||||
NetInterpRatioSlider.OnValueChanged += OnSliderChanged;
|
||||
NetInterpRatioSlider.MinValue = _stateMan.MinBufferSize;
|
||||
NetPredictTickBiasSlider.OnValueChanged += OnSliderChanged;
|
||||
NetPvsSpawnSlider.OnValueChanged += OnSliderChanged;
|
||||
NetPvsEntrySlider.OnValueChanged += OnSliderChanged;
|
||||
NetPvsLeaveSlider.OnValueChanged += OnSliderChanged;
|
||||
|
||||
@@ -38,13 +40,20 @@ namespace Content.Client.Options.UI.Tabs
|
||||
ApplyButton.OnPressed -= OnApplyButtonPressed;
|
||||
ResetButton.OnPressed -= OnResetButtonPressed;
|
||||
DefaultButton.OnPressed -= OnDefaultButtonPressed;
|
||||
NetPredictCheckbox.OnToggled -= OnPredictToggled;
|
||||
NetInterpRatioSlider.OnValueChanged -= OnSliderChanged;
|
||||
NetPredictTickBiasSlider.OnValueChanged -= OnSliderChanged;
|
||||
NetPvsSpawnSlider.OnValueChanged -= OnSliderChanged;
|
||||
NetPvsEntrySlider.OnValueChanged -= OnSliderChanged;
|
||||
NetPvsLeaveSlider.OnValueChanged -= OnSliderChanged;
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void OnPredictToggled(BaseButton.ButtonToggledEventArgs obj)
|
||||
{
|
||||
UpdateChanges();
|
||||
}
|
||||
|
||||
private void OnSliderChanged(Robust.Client.UserInterface.Controls.Range range)
|
||||
{
|
||||
UpdateChanges();
|
||||
@@ -54,8 +63,10 @@ namespace Content.Client.Options.UI.Tabs
|
||||
{
|
||||
_cfg.SetCVar(CVars.NetBufferSize, (int) NetInterpRatioSlider.Value - _stateMan.MinBufferSize);
|
||||
_cfg.SetCVar(CVars.NetPredictTickBias, (int) NetPredictTickBiasSlider.Value);
|
||||
_cfg.SetCVar(CVars.NetPVSEntityBudget, (int) NetPvsEntrySlider.Value);
|
||||
_cfg.SetCVar(CVars.NetPVSEntityBudget, (int) NetPvsSpawnSlider.Value);
|
||||
_cfg.SetCVar(CVars.NetPVSEntityEnterBudget, (int) NetPvsEntrySlider.Value);
|
||||
_cfg.SetCVar(CVars.NetPVSEntityExitBudget, (int) NetPvsLeaveSlider.Value);
|
||||
_cfg.SetCVar(CVars.NetPredict, NetPredictCheckbox.Pressed);
|
||||
|
||||
_cfg.SaveToFile();
|
||||
UpdateChanges();
|
||||
@@ -69,7 +80,8 @@ namespace Content.Client.Options.UI.Tabs
|
||||
private void OnDefaultButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
NetPredictTickBiasSlider.Value = CVars.NetPredictTickBias.DefaultValue;
|
||||
NetPvsEntrySlider.Value = CVars.NetPVSEntityBudget.DefaultValue;
|
||||
NetPvsSpawnSlider.Value = CVars.NetPVSEntityBudget.DefaultValue;
|
||||
NetPvsEntrySlider.Value = CVars.NetPVSEntityEnterBudget.DefaultValue;
|
||||
NetPvsLeaveSlider.Value = CVars.NetPVSEntityExitBudget.DefaultValue;
|
||||
|
||||
// Apparently default value doesn't get updated when using override defaults, so using a const
|
||||
@@ -82,8 +94,10 @@ namespace Content.Client.Options.UI.Tabs
|
||||
{
|
||||
NetInterpRatioSlider.Value = _cfg.GetCVar(CVars.NetBufferSize) + _stateMan.MinBufferSize;
|
||||
NetPredictTickBiasSlider.Value = _cfg.GetCVar(CVars.NetPredictTickBias);
|
||||
NetPvsEntrySlider.Value = _cfg.GetCVar(CVars.NetPVSEntityBudget);
|
||||
NetPvsSpawnSlider.Value = _cfg.GetCVar(CVars.NetPVSEntityBudget);
|
||||
NetPvsEntrySlider.Value = _cfg.GetCVar(CVars.NetPVSEntityEnterBudget);
|
||||
NetPvsLeaveSlider.Value = _cfg.GetCVar(CVars.NetPVSEntityExitBudget);
|
||||
NetPredictCheckbox.Pressed = _cfg.GetCVar(CVars.NetPredict);
|
||||
UpdateChanges();
|
||||
}
|
||||
|
||||
@@ -92,15 +106,21 @@ namespace Content.Client.Options.UI.Tabs
|
||||
var isEverythingSame =
|
||||
NetInterpRatioSlider.Value == _cfg.GetCVar(CVars.NetBufferSize) + _stateMan.MinBufferSize &&
|
||||
NetPredictTickBiasSlider.Value == _cfg.GetCVar(CVars.NetPredictTickBias) &&
|
||||
NetPvsEntrySlider.Value == _cfg.GetCVar(CVars.NetPVSEntityBudget) &&
|
||||
NetPredictCheckbox.Pressed == _cfg.GetCVar(CVars.NetPredict) &&
|
||||
NetPvsSpawnSlider.Value == _cfg.GetCVar(CVars.NetPVSEntityBudget) &&
|
||||
NetPvsEntrySlider.Value == _cfg.GetCVar(CVars.NetPVSEntityEnterBudget) &&
|
||||
NetPvsLeaveSlider.Value == _cfg.GetCVar(CVars.NetPVSEntityExitBudget);
|
||||
|
||||
ApplyButton.Disabled = isEverythingSame;
|
||||
ResetButton.Disabled = isEverythingSame;
|
||||
NetInterpRatioLabel.Text = NetInterpRatioSlider.Value.ToString();
|
||||
NetPredictTickBiasLabel.Text = NetPredictTickBiasSlider.Value.ToString();
|
||||
NetPvsSpawnLabel.Text = NetPvsSpawnSlider.Value.ToString();
|
||||
NetPvsEntryLabel.Text = NetPvsEntrySlider.Value.ToString();
|
||||
NetPvsLeaveLabel.Text = NetPvsLeaveSlider.Value.ToString();
|
||||
|
||||
// TODO disable / grey-out the predict and interp sliders if prediction is disabled.
|
||||
// Currently no option to do this, but should be added to the slider control in general
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,8 @@ ui-options-function-shuttle-brake = Brake
|
||||
|
||||
## Network menu
|
||||
|
||||
ui-options-net-predict = Client-side prediction
|
||||
|
||||
ui-options-net-interp-ratio = State buffer size
|
||||
ui-options-net-interp-ratio-tooltip = Increasing this will generally make the game more resistant
|
||||
to server->client packet-loss, however in doing so it
|
||||
@@ -190,11 +192,16 @@ ui-options-net-predict-tick-bias-tooltip = Increasing this will generally make t
|
||||
effectively adds slightly more latency and requires the
|
||||
client to predict more future ticks.
|
||||
|
||||
ui-options-net-pvs-entry = PVS entity budget
|
||||
ui-options-net-pvs-entry-tooltip = This limits the rate at which the server will send new
|
||||
ui-options-net-pvs-spawn = PVS entity spawn budget
|
||||
ui-options-net-pvs-spawn-tooltip = This limits the rate at which the server will send newly spawned
|
||||
entities to the client. Lowering this can help reduce
|
||||
stuttering due to entity spawning, but can lead to pop-in.
|
||||
|
||||
ui-options-net-pvs-entry = PVS entity budget
|
||||
ui-options-net-pvs-entry-tooltip = This limits the rate at which the server will send newly visible
|
||||
entities to the client. Lowering this can help reduce
|
||||
stuttering, but can lead to pop-in.
|
||||
|
||||
ui-options-net-pvs-leave = PVS detach rate
|
||||
ui-options-net-pvs-leave-tooltip = This limits the rate at which the client will remove
|
||||
out-of-view entities. Lowering this can help reduce
|
||||
|
||||
Reference in New Issue
Block a user