Skip to content

Commit 8b2a6a1

Browse files
Merge branch 'master' into public-release
2 parents baa68fd + 41ee67b commit 8b2a6a1

File tree

10 files changed

+41
-23
lines changed

10 files changed

+41
-23
lines changed

client/src/client-config.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ export const ConfigPage: React.FC<Props> = (props) => {
105105

106106
if (keyboard.keyCode === 'KeyF')
107107
context.updateConfigValue('focusRobotTurn', !context.state.config.focusRobotTurn)
108+
if (keyboard.keyCode === 'KeyI')
109+
context.updateConfigValue('showAllIndicators', !context.state.config.showAllIndicators)
108110
}, [keyboard.keyCode])
109111

110112
if (!props.open) return null

client/src/components/game/tooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const FloatingTooltip: React.FC<{
5656

5757
return (
5858
<div
59-
className="absolute bg-black/70 opacity-95 z-20 text-white p-2 rounded-md text-xs whitespace-nowrap pointer-events-none"
59+
className="absolute max-w-[500px] bg-black/70 opacity-95 z-20 text-white p-2 rounded-md text-xs whitespace-pre-line pointer-events-none"
6060
style={{
6161
...tooltipStyle,
6262
visibility: showFloatingTooltip ? 'visible' : 'hidden'
@@ -72,7 +72,7 @@ export const DraggableTooltip: React.FC<{ container: Rect; content: React.ReactN
7272
return (
7373
<Draggable width={container.width} height={container.height}>
7474
{content && (
75-
<div className="bg-black/90 opacity-95 z-20 text-white p-2 rounded-md text-xs cursor-pointer relative pointer-events-auto">
75+
<div className="max-w-[500px] bg-black/90 opacity-95 z-20 text-white p-2 rounded-md text-xs cursor-pointer relative pointer-events-auto whitespace-pre-line">
7676
{content}
7777
<div className="absolute top-0 right-0" style={{ transform: 'scaleX(0.57) scaleY(0.73)' }}>
7878
<ThreeBarsIcon />

client/src/components/sidebar/help/help.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const HelpPage: React.FC<Props> = (props) => {
132132
)}
133133
{hotkeyElement(`R`, 'Resets the map camera if it has been panned/zoomed')}
134134
{hotkeyElement(`C`, 'Hides and unhides game control bar')}
135+
{hotkeyElement(`F`, 'Toggles the show all indicators config')}
135136
{hotkeyElement(`T`, 'Toggles per-turn playback for the current game')}
136137
{hotkeyElement(`F`, 'Toggles per-turn robot focus config')}
137138
{hotkeyElement(`.`, 'Skip to the very last round of the current game')}

client/src/components/sidebar/runner/runner.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ const MapSelector: React.FC<MapSelectorProps> = ({ maps, availableMaps, onSelect
378378
)
379379
}
380380

381-
export type ConsoleLine = { content: string; type: 'output' | 'error' | 'bold' }
381+
export type ConsoleLine = { content: string; type: 'output' | 'error' | 'bold'; matchIdx: number }
382382

383383
type Props = {
384384
lines: RingBuffer<ConsoleLine>
@@ -401,19 +401,23 @@ export const Console: React.FC<Props> = ({ lines }) => {
401401
}
402402
}
403403

404-
const focusRobot = (round: number, id: number) => {
404+
const focusRobot = (match: number, round: number, id: number) => {
405405
setPopout(false)
406-
GameRunner.jumpToRound(round)
407-
GameRenderer.setSelectedRobot(id)
408-
409-
// If turn playback is enabled, focus the robot's exact turn as well
410-
if (GameRunner.match?.playbackPerTurn) {
411-
GameRunner.jumpToRobotTurn(id)
412-
}
406+
GameRunner.setMatch(GameRunner.game?.matches[match], round)
407+
408+
// Update selection after a delay so it doesn't get overwritten
409+
setTimeout(() => {
410+
// If turn playback is enabled, focus the robot's exact turn as well
411+
GameRenderer.setSelectedRobot(id)
412+
if (GameRunner.match?.playbackPerTurn) {
413+
GameRunner.jumpToRobotTurn(id)
414+
}
415+
}, 5)
413416
}
414417

415418
const ConsoleRow = (props: { index: number; style: any }) => {
416-
const content = lines.get(props.index)!.content
419+
const row = lines.get(props.index)!
420+
const content = row.content
417421

418422
// Check if the printout is from a bot. If so, add a special click element
419423
// that selects the bot
@@ -429,7 +433,7 @@ export const Console: React.FC<Props> = ({ lines }) => {
429433
<div className="flex items-center gap-1 sele" style={props.style}>
430434
<span
431435
className="text-blueLight decoration-blueLight text-xs whitespace-nowrap underline cursor-pointer"
432-
onClick={() => focusRobot(round, id)}
436+
onClick={() => focusRobot(row.matchIdx, round, id)}
433437
>
434438
{`[Team ${team}, ID #${id}, Round ${round}]`}
435439
</span>

client/src/components/sidebar/runner/scaffold.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,23 @@ export const useScaffold = (): Scaffold => {
5353
const [error, setError] = useState('')
5454
const matchPID = useRef<string | undefined>(undefined)
5555
const forceUpdate = useForceUpdate()
56-
const consoleLines = useRef<RingBuffer<ConsoleLine>>(new RingBuffer(10000))
56+
const consoleLines = useRef<RingBuffer<ConsoleLine>>(new RingBuffer(50000))
5757

5858
const [webSocketListener, setWebSocketListener] = useState<WebSocketListener | undefined>()
5959

6060
const log = (line: ConsoleLine) => {
61+
// Set match index to be the same as the previous log value
62+
if (consoleLines.current.length() > 0) {
63+
line.matchIdx = consoleLines.current.get(consoleLines.current.length() - 1)!.matchIdx
64+
}
65+
66+
// If we encounter the end-of-match message, increment the match index
67+
if (line.content.startsWith('[server]') && line.content.includes('Finished')) {
68+
line.matchIdx++
69+
}
70+
6171
consoleLines.current.push(line)
72+
6273
forceUpdate()
6374
}
6475

@@ -107,7 +118,7 @@ export const useScaffold = (): Scaffold => {
107118
)
108119
matchPID.current = newPID
109120
} catch (e: any) {
110-
consoleLines.current.push({ content: e, type: 'error' })
121+
consoleLines.current.push({ content: e, type: 'error', matchIdx: 0 })
111122
}
112123
forceUpdate()
113124
}
@@ -176,15 +187,15 @@ export const useScaffold = (): Scaffold => {
176187

177188
nativeAPI.child_process.onStdout(({ pid, data }) => {
178189
if (pid !== matchPID.current) return
179-
log({ content: data, type: 'output' })
190+
log({ content: data, type: 'output', matchIdx: 0 })
180191
})
181192
nativeAPI.child_process.onStderr(({ pid, data }) => {
182193
if (pid !== matchPID.current) return
183-
log({ content: data, type: 'error' })
194+
log({ content: data, type: 'error', matchIdx: 0 })
184195
})
185196
nativeAPI.child_process.onExit(({ pid, code, signal }) => {
186197
if (pid !== matchPID.current) return
187-
log({ content: `Exited with code ${code} | ${JSON.stringify(signal)}`, type: 'bold' })
198+
log({ content: `Exited with code ${code} | ${JSON.stringify(signal)}`, type: 'bold', matchIdx: 0 })
188199
matchPID.current = undefined
189200
forceUpdate()
190201
})

client/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const CLIENT_VERSION = '2.0.2'
1+
export const CLIENT_VERSION = '2.0.3'
22
export const SPEC_VERSION = '1'
33
export const BATTLECODE_YEAR: number = 2025
44
export const MAP_SIZE_RANGE = {

client/src/playback/Bodies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export class Body {
509509
}`
510510
]
511511
if (this.indicatorString != '') {
512-
defaultInfo.push(`Indicator: ${this.indicatorString}`)
512+
defaultInfo.push(this.indicatorString)
513513
}
514514

515515
return defaultInfo

client/src/playback/GameRunner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ class GameRunnerClass {
102102
})
103103
}
104104

105-
setMatch(match: Match | undefined): void {
105+
setMatch(match: Match | undefined, round: number = 1): void {
106106
this._trigger(this._matchListeners)
107107
if (match) {
108108
match.game.currentMatch = match
109109
this.setGame(match.game)
110-
match._jumpToStart()
110+
match._jumpToRound(round)
111111
GameRenderer.render()
112112
}
113113
this.setPaused(true)

engine/src/main/battlecode/common/GameConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class GameConstants {
6565
* The maximum length of indicator strings that a player can associate with a
6666
* robot.
6767
*/
68-
public static final int INDICATOR_STRING_MAX_LENGTH = 64;
68+
public static final int INDICATOR_STRING_MAX_LENGTH = 256;
6969

7070
/** The maximum length of a label to add to the timeline. */
7171
public static final int TIMELINE_LABEL_MAX_LENGTH = 64;

specs/specs.pdf

2.73 KB
Binary file not shown.

0 commit comments

Comments
 (0)