Skip to content

Commit 2928f4d

Browse files
committed
Merge branch 'master' into engine-release
2 parents 4f0f278 + 0620336 commit 2928f4d

Some content is hidden

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

47 files changed

+187
-61
lines changed

.github/workflows/release-engine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
if: ${{ env.IS_PUBLIC != 'YES' }}
137137
run: |
138138
source="private-maps/$RELEASE_ARTIFACT_ID"
139-
dest="$RELEASE_ARTIFACT_ID/maps"
139+
dest="engine/src/main/battlecode/world/resources"
140140
if [ -d "$source" ]; then
141141
cp -r -i "$source/." "$dest/" < /dev/null &> private-maps-copy-log
142142
if [ -s "private-maps-copy-log" ]; then

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/colors.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,35 @@ export const Presets: ColorPreset[] = [
154154
TEAM_TWO: '#c91c7e'
155155
}
156156
}
157+
},
158+
{
159+
displayName: 'Battlecode 2025',
160+
data: {
161+
version: 0,
162+
colors: {
163+
GAMEAREA_BACKGROUND: '#2e2323',
164+
SIDEBAR_BACKGROUND: '#3f3131',
165+
RED: '#ff9194',
166+
PINK: '#ffb4c1',
167+
GREEN: '#00a28e',
168+
CYAN: '#02a7b9',
169+
CYAN_DARK: '#1899a7',
170+
BLUE: '#04a2d9',
171+
BLUE_LIGHT: '#26abd9',
172+
BLUE_DARK: '#00679e',
173+
DARK: '#1f2937',
174+
DARK_HIGHLIGHT: '#140f0f',
175+
BLACK: '#140f0f',
176+
WHITE: '#fcdede',
177+
LIGHT: '#aaaaaa22',
178+
LIGHT_HIGHLIGHT: '#ffffff33',
179+
LIGHT_CARD: '#f7f7f722',
180+
WALLS_COLOR: '#547f31',
181+
TILES_COLOR: '#4c301e',
182+
TEAM_ONE: '#cdcdcc',
183+
TEAM_TWO: '#fee493'
184+
}
185+
}
157186
}
158187
]
159188

client/src/components/sidebar/game/game.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ export const GamePage: React.FC<Props> = React.memo((props) => {
143143
<div /*className="flex items-center gap-2"*/>
144144
{/* Note: to keep animation smooth, we should still keep the elements rendered, but we pass showStats into
145145
them so that they don't render any data (since we're likely hiding stats to prevent lag) */}
146+
<ResourceGraph
147+
active={showStats}
148+
property="globalCheeseAmount"
149+
propertyDisplayName="Global Cheese "
150+
/>
151+
<br />
146152
<ResourceGraph
147153
active={showStats}
148154
property="cheeseAmount"
149-
propertyDisplayName="Cheese Amount "
155+
propertyDisplayName="Cheese Transferred "
150156
/>
151157
<br />
152158
<ResourceGraph

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
6262
let catDamagePercent = 0
6363
let ratKingCount = 0
6464
let ratKingPercent = 0
65+
let globalCheese = 0
6566

6667
if (map && teamStat) {
6768
cheeseAmount = teamStat.cheeseAmount
@@ -70,6 +71,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
7071
catDamagePercent = teamStat.catDamagePercent
7172
ratKingCount = teamStat.ratKingCount
7273
ratKingPercent = teamStat.ratKingPercent
74+
globalCheese = teamStat.globalCheeseAmount
7375
}
7476

7577
const formatPercent = (val: number) => (val * 100).toFixed(1).toString() + '%'
@@ -131,6 +133,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
131133
</div>
132134
</div>
133135
</div>
136+
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">Global Cheese Amount: {globalCheese}</div>
134137
</div>
135138
)
136139
}
@@ -148,9 +151,9 @@ export const UnitsTable: React.FC<UnitsTableProps> = ({ teamStat, teamIdx }) =>
148151
['Baby Rats', <UnitsIcon teamIdx={teamIdx} img="rat" key="3" />]
149152
]
150153

151-
let data: [string, number[]][] = [['Count', [0, 0, 0, 0]]]
154+
let data: [string, number[]][] = [['Count:', [0, 0, 0, 0]]]
152155
if (teamStat) {
153-
data = [['Count', [teamStat.dirtAmount, teamStat.ratTrapAmount, teamStat.catTrapAmount, teamStat.babyRatCount]]]
156+
data = [['Count:', [teamStat.dirtAmount, teamStat.ratTrapAmount, teamStat.catTrapAmount, teamStat.babyRatCount]]]
154157
}
155158

156159
return (

client/src/playback/Map.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,11 @@ export class CurrentMap {
317317
}
318318
if (ratTrap) {
319319
info.push('Rat Trap')
320+
info.push(`Placed by ${TEAM_COLOR_NAMES[ratTrap - 2]}`)
320321
}
321322
if (catTrap) {
322323
info.push('Cat Trap')
324+
info.push(`Placed by ${TEAM_COLOR_NAMES[catTrap - 2]}`)
323325
}
324326
if (cheese) {
325327
info.push(`Cheese: ${cheese}`)

client/src/playback/RoundStat.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class TeamRoundStat {
1919
ratKingCount: number = 0
2020
ratKingPercent: number = 0
2121
dirtAmount: number = 0
22+
globalCheeseAmount: number = 0
2223
babyRatCount: number = 0
2324
ratTrapAmount: number = 0
2425
catTrapAmount: number = 0
@@ -75,10 +76,13 @@ export default class RoundStat {
7576
let totalCheese = 0
7677
let totalCatDamage = 0
7778
let totalRatKings = 0
79+
80+
7881
for (let i = 0; i < delta.teamIdsLength(); i++) {
82+
const combinedStat = delta.teamAliveRatKings(i)!
7983
totalCheese += delta.teamCheeseTransferred(i)!
8084
totalCatDamage += delta.teamCatDamage(i)!
81-
totalRatKings += delta.teamAliveRatKings(i)!
85+
totalRatKings += (combinedStat%10) //lmao
8286
}
8387

8488
for (let i = 0; i < delta.teamIdsLength(); i++) {
@@ -87,10 +91,14 @@ export default class RoundStat {
8791
const teamStat = this.teams.get(team) ?? assert.fail(`team ${i} not found in team stats in round`)
8892

8993
teamStat.cheeseAmount = delta.teamCheeseTransferred(i) ?? assert.fail('missing cheese amount')
94+
teamStat.globalCheeseAmount = Math.floor(delta.teamAliveRatKings(i)! / 10)
9095
teamStat.cheesePercent = totalCheese ? teamStat.cheeseAmount / totalCheese : 0
9196
teamStat.catDamageAmount = delta.teamCatDamage(i) ?? assert.fail('missing cat damage amount')
9297
teamStat.catDamagePercent = totalCatDamage ? teamStat.catDamageAmount / totalCatDamage : 0
98+
9399
teamStat.ratKingCount = delta.teamAliveRatKings(i) ?? assert.fail('missing rat king count')
100+
teamStat.ratKingCount %= 10
101+
94102
teamStat.ratKingPercent = totalRatKings ? teamStat.ratKingCount / totalRatKings : 0
95103
teamStat.dirtAmount = delta.teamDirtAmounts(i) ?? assert.fail('missing dirt amount')
96104
teamStat.ratTrapAmount = delta.teamRatTrapCount(i) ?? assert.fail('missing rat trap amount')

engine/src/crossplay_python/battlecode26/__main__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,20 @@ def main(args=None):
280280
get_code(team_a, dir_a)
281281
get_code(team_b, dir_b)
282282

283+
kwargs = {
284+
"shell": False,
285+
"stdin": None,
286+
"stdout": None,
287+
"stderr": None,
288+
"close_fds": True,
289+
}
290+
291+
if os.name == "nt":
292+
kwargs["creationflags"] = DETACHED_PROCESS
293+
283294
Popen(
284295
new_args,
285-
shell=False,
286-
stdin=None,
287-
stdout=None,
288-
stderr=None,
289-
close_fds=True,
290-
creationflags=DETACHED_PROCESS,
296+
**kwargs
291297
)
292298
else:
293299
play(team_a=parsed_args.teamA, team_b=parsed_args.teamB,

engine/src/crossplay_python/python_docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Battlecode 2026 Python Documentation
2-
v1.1.0
2+
v1.1.4
33

44
## Getting Started
55

engine/src/crossplay_python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
],
2727
python_requires='>=3.12, <3.13',
2828
zip_safe=False,
29-
version='1.1.0',
29+
version='1.1.4',
3030
)

0 commit comments

Comments
 (0)