Skip to content

Commit 9c1ed28

Browse files
The return of 128 ups
1 parent 5e89a6f commit 9c1ed28

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

client/src/components/controls-bar/controls-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const ControlsBar: React.FC = () => {
167167
icon={<ControlIcons.SkipForwardsIcon />}
168168
tooltip={'Increase Speed'}
169169
onClick={() => GameRunner.multiplyUpdatesPerSecond(2)}
170-
disabled={Math.abs(targetUPS) >= 64}
170+
disabled={Math.abs(targetUPS) >= 128}
171171
/>
172172
<ControlsBarButton
173173
icon={<ControlIcons.PlaybackStopIcon />}

client/src/playback/GameRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class GameRunnerClass {
123123
multiplyUpdatesPerSecond(multiplier: number) {
124124
if (!this.match) return
125125
const scaled = this.targetUPS * multiplier
126-
const newMag = Math.max(1 / 4, Math.min(64, Math.abs(scaled)))
126+
const newMag = Math.max(1 / 4, Math.min(128, Math.abs(scaled)))
127127
this.targetUPS = Math.sign(scaled) * newMag
128128
this._trigger(this._controlListeners)
129129
}

client/src/playback/Match.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,15 @@ export default class Match {
181181
const currentTurnNumber = this.currentRound.turnNumber
182182

183183
this._currentSimulationStep += deltaTime * MAX_SIMULATION_STEPS
184+
184185
if (this.playbackPerTurn) {
186+
// This works because of the way floor works
187+
const deltaTurns = Math.floor(this._currentSimulationStep / MAX_SIMULATION_STEPS)
185188
if (this._currentSimulationStep >= MAX_SIMULATION_STEPS) {
186-
this._stepTurn(1)
189+
this._stepTurn(deltaTurns)
187190
this._currentSimulationStep = 0
188191
} else if (this._currentSimulationStep < 0) {
189-
this._stepTurn(-1)
192+
this._stepTurn(deltaTurns)
190193
this._currentSimulationStep = MAX_SIMULATION_STEPS - 1
191194
}
192195
} else {
@@ -230,6 +233,8 @@ export default class Match {
230233
}
231234

232235
private _updateSimulationRoundsByTime(deltaTime: number): void {
236+
// This works because of the way floor works
237+
const deltaRounds = Math.floor(this._currentSimulationStep / MAX_SIMULATION_STEPS)
233238
if (this.currentRound.roundNumber == this.maxRound && deltaTime > 0) {
234239
// If we are at the end, round the simulation to the max value
235240
this._currentSimulationStep = Math.min(this._currentSimulationStep, MAX_SIMULATION_STEPS)
@@ -239,12 +244,12 @@ export default class Match {
239244
} else if (this._currentSimulationStep < 0) {
240245
// If we are going in reverse, step the rounds back by one. Also,
241246
// apply all turns for that round so that the transition is smooth
242-
this._stepRound(-1)
247+
this._stepRound(deltaRounds)
243248
this.currentRound.jumpToTurn(this.currentRound.turnsLength)
244249
this._currentSimulationStep = MAX_SIMULATION_STEPS - 1
245250
} else if (this._currentSimulationStep >= MAX_SIMULATION_STEPS) {
246251
// If we are going forward, simply step the turn
247-
this._stepRound(1)
252+
this._stepRound(deltaRounds)
248253
}
249254
}
250255

0 commit comments

Comments
 (0)