Skip to content

Commit 7abe34f

Browse files
committed
Merge branch 'schema' into client-release
2 parents 09e7a11 + f0868db commit 7abe34f

73 files changed

Lines changed: 859 additions & 1393 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release-engine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
RELEASE_ARTIFACT_ID: battlecode26
1515

1616
# IS_PUBLIC is whether to release deployments publicly. Set to exactly the text "YES" to do so.
17-
IS_PUBLIC: NO
17+
IS_PUBLIC: YES
1818

1919
jobs:
2020
release-java:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ task installPythonPackage(type: Exec) {
4444
if (project.findProperty('forceInstallPythonPackage') ?: false) {
4545
commandLine 'python', '-m', 'pip', 'install', '-e', 'engine/src/crossplay_python'
4646
} else {
47-
commandLine 'python', '-c', "import importlib.util,subprocess,sys; pkg='battlecode26'; importlib.util.find_spec(pkg) or subprocess.check_call([sys.executable,'-m','pip','install','-e',pkg])"
47+
commandLine 'python', '-c', "import importlib.util,subprocess,sys; assert sys.version_info[0] == 3 and sys.version_info[1] == 12, 'Error: Must use Python 3.12!'; pkg='battlecode26'; importlib.util.find_spec(pkg) or subprocess.check_call([sys.executable,'-m','pip','install','-e','engine/src/crossplay_python'])"
4848
}
4949
}
5050

client/src/components/sidebar/game/team-table.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { schema } from 'battlecode-schema'
55
import { TeamRoundStat } from '../../../playback/RoundStat'
66
import { DoubleChevronUpIcon } from '../../../icons/chevron'
77
import { CurrentMap } from '../../../playback/Map'
8-
import { useRound } from '../../../playback/GameRunner'
8+
import { useRound, useTurnNumber } from '../../../playback/GameRunner'
99

1010
interface UnitsIconProps {
1111
teamIdx: 0 | 1
@@ -34,6 +34,8 @@ interface TeamTableProps {
3434

3535
export const TeamTable: React.FC<TeamTableProps> = (props: TeamTableProps) => {
3636
const round = useRound()
37+
// force react to re-render when using turn playback
38+
const _turn = useTurnNumber()
3739
const teamStat = round?.stat?.getTeamStat(round?.match.game.teams[props.teamIdx])
3840
const map = round?.map
3941

@@ -63,6 +65,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
6365
let ratKingCount = 0
6466
let ratKingPercent = 0
6567
let globalCheese = 0
68+
let rawCheese = 0
6669

6770
if (map && teamStat) {
6871
cheeseAmount = teamStat.cheeseAmount
@@ -72,6 +75,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
7275
ratKingCount = teamStat.ratKingCount
7376
ratKingPercent = teamStat.ratKingPercent
7477
globalCheese = teamStat.globalCheeseAmount
78+
rawCheese = teamStat.globalRawCheeseAmount
7579
}
7680

7781
const formatPercent = (val: number) => (val * 100).toFixed(1).toString() + '%'
@@ -133,7 +137,11 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
133137
</div>
134138
</div>
135139
</div>
136-
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">Global Cheese Amount: {globalCheese}</div>
140+
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">
141+
<div>Global Cheese: {globalCheese}</div>
142+
<div>Raw Cheese: {rawCheese}</div>
143+
</div>
144+
137145
</div>
138146
)
139147
}

client/src/components/sidebar/map-editor/map-editor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export const MapEditorPage: React.FC<Props> = (props) => {
145145

146146
const applyBrush = (point: { x: number; y: number }) => {
147147
if (!openBrush) return
148+
if (point === null) return
148149

149150
const undoFunc = openBrush.apply(point.x, point.y, openBrush.fields, true)
150151
strokeUndoStack.current.push(undoFunc)

client/src/constants.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,47 @@ export const ENGINE_BUILTIN_MAP_NAMES: string[] = [
2525
// Default
2626
'DefaultSmall',
2727
'DefaultMedium',
28-
'DefaultLarge'
28+
'DefaultLarge',
2929
// Sprint 1
30+
'sittingducks',
31+
'starvation',
32+
'thunderdome',
33+
'popthecork',
34+
'cheesefarm',
35+
'rift',
36+
'ZeroDay',
37+
'pipes',
38+
'Nofreecheese',
39+
'wallsofparadis',
40+
'dirtpassageway',
41+
'trapped',
42+
'arrows',
43+
'Meow',
44+
'dirtfulcat',
45+
'keepout',
3046
// Sprint 2
47+
'5t4rv4t10n_1337',
48+
'cheesebottles',
49+
'hatefullattice',
50+
'knifefight',
51+
'mercifullattice',
52+
'peaceinourtime',
53+
'jail',
54+
'safelycontained',
55+
'minimaze',
56+
'averyfineline',
57+
'averystrangespace',
58+
'canyoudig',
59+
'streetsofnewyork',
60+
'TheHeist',
61+
'closeup',
62+
'corridorofdoomanddespair',
63+
'EscapeTheNight',
64+
'tiny',
65+
'toomuchcheese',
66+
'uneruesansfin',
67+
'whatsthecatdoin',
68+
'whereisthecheese'
3169
// HS
3270
// Quals
3371
]

client/src/playback/RoundStat.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class TeamRoundStat {
2020
ratKingPercent: number = 0
2121
dirtAmount: number = 0
2222
globalCheeseAmount: number = 0
23+
globalRawCheeseAmount: number = 0
2324
babyRatCount: number = 0
2425
ratTrapAmount: number = 0
2526
catTrapAmount: number = 0
@@ -132,7 +133,10 @@ export default class RoundStat {
132133
// Count number of alive robots
133134
if (body.dead) continue
134135

135-
if (body.robotType == schema.RobotType.RAT) teamStat.babyRatCount++
136+
if (body.robotType == schema.RobotType.RAT) {
137+
teamStat.babyRatCount++
138+
teamStat.globalRawCheeseAmount += body.cheese
139+
}
136140
}
137141

138142
const timems = Date.now() - time

engine/src/crossplay_python/battlecode26/classes.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,16 @@ def __repr__(self) -> str:
189189

190190

191191
class TrapType(_Enum):
192-
RAT_TRAP = (30, 50, 20, 25, 15, 0, 25, 2)
193-
CAT_TRAP = (10, 100, 20, 5, 10, 0, 10, 2)
194-
NONE = (0, 0, 0, 0, 0, 0, 0, 0)
192+
RAT_TRAP = (30, 50, 20, 15, 25, 2)
193+
CAT_TRAP = (10, 100, 20, 10, 10, 2)
194+
NONE = (0, 0, 0, 0, 0, 0)
195195

196-
def __init__(self, build_cost: int, damage: int, stun_time: int, trap_limit: int,
197-
action_cooldown: int, spawn_cheese_amount: int, max_count: int, trigger_radius_squared: int):
196+
def __init__(self, build_cost: int, damage: int, stun_time: int,
197+
action_cooldown: int, max_count: int, trigger_radius_squared: int):
198198
self.build_cost = build_cost
199199
self.damage = damage
200200
self.stun_time = stun_time
201-
self.trap_limit = trap_limit
202201
self.action_cooldown = action_cooldown
203-
self.spawn_cheese_amount = spawn_cheese_amount
204202
self.max_count = max_count
205203
self.trigger_radius_squared = trigger_radius_squared
206204

@@ -281,6 +279,8 @@ class GameConstants:
281279
EXCEPTION_BYTECODE_PENALTY = 500
282280
INITIAL_TEAM_CHEESE = 2500
283281
MAX_NUMBER_OF_RAT_KINGS = 5
282+
MAX_NUMBER_OF_RAT_KINGS_AFTER_CUTOFF = 2
283+
RAT_KING_CUTOFF_ROUND = 1200
284284
MAX_TEAM_EXECUTION_TIME = 1200000000000
285285
MOVE_STRAFE_COOLDOWN = 18
286286
CHEESE_COOLDOWN_PENALTY = 0.01
@@ -297,6 +297,8 @@ class GameConstants:
297297
BUILD_ROBOT_COST_INCREASE = 10
298298
NUM_ROBOTS_FOR_COST_INCREASE = 4
299299
BUILD_DISTANCE_SQUARED = 2
300+
RAT_KING_BUILD_DISTANCE_SQUARED = 8
301+
ATTACK_DISTANCE_SQUARED = 2
300302
RAT_KING_ATTACK_DISTANCE_SQUARED = 8
301303
MESSAGE_ROUND_DURATION = 5
302304
MAX_MESSAGES_SENT_ROBOT = 1
@@ -309,8 +311,8 @@ class GameConstants:
309311
CAT_DIG_ADDITIONAL_COOLDOWN = 5
310312
HEALTH_GRAB_THRESHOLD = 0
311313
RAT_KING_UPGRADE_CHEESE_COST = 50
312-
DIG_DIRT_CHEESE_COST = 10
313-
PLACE_DIRT_CHEESE_COST = 10
314+
DIG_DIRT_CHEESE_COST = 5
315+
PLACE_DIRT_CHEESE_COST = 3
314316
SHARED_ARRAY_SIZE = 64
315317
COMM_ARRAY_MAX_VALUE = 1023
316318
COOLDOWN_LIMIT = 10
@@ -322,6 +324,7 @@ class GameConstants:
322324
CARRY_COOLDOWN_MULTIPLIER = 1.5
323325
MAX_CARRY_TOWER_HEIGHT = 2
324326
MAX_CARRY_DURATION = 10
327+
SAME_ROBOT_CARRY_COOLDOWN_TURNS = 2
325328
THROW_DURATION = 4
326329
HIT_GROUND_COOLDOWN = 10
327330
HIT_TARGET_COOLDOWN = 30

0 commit comments

Comments
 (0)