Skip to content

Commit

Permalink
Merge branch 'master' into release-config
Browse files Browse the repository at this point in the history
  • Loading branch information
TheApplePieGod committed Jan 18, 2024
2 parents f8c4511 + c003c09 commit 3185085
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 15 deletions.
4 changes: 2 additions & 2 deletions client/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { schema } from 'battlecode-schema'

export const GAME_VERSION = '2.0.0'
export const SPEC_VERSION = '2.0.0'
export const GAME_VERSION = '2.0.1'
export const SPEC_VERSION = '2.0.1'
export const BATTLECODE_YEAR: number = 2024
export const MAP_SIZE_RANGE = {
min: 30,
Expand Down
2 changes: 1 addition & 1 deletion client/src/playback/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action> = {
// To dicuss
}
draw(match: Match, ctx: CanvasRenderingContext2D): void {
const radius = 3.3 // in between the two sizes of the explosion
const radius = Math.sqrt(4)
const map = match.currentTurn.map
const loc = map.indexToLocation(this.target)
const coords = renderUtils.getRenderCoords(loc.x, loc.y, map.dimension, true)
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/battlecode/common/GameConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class GameConstants {
/**
* The current spec version the server compiles with.
*/
public static final String SPEC_VERSION = "2.0.0";
public static final String SPEC_VERSION = "2.0.1";

// *********************************
// ****** MAP CONSTANTS ************
Expand Down
8 changes: 7 additions & 1 deletion engine/src/main/battlecode/common/GlobalUpgrade.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ public enum GlobalUpgrade {
/**
* Capture upgrade increases the dropped flag delay from 4 rounds to 12 rounds. It also decreases the movement penalty for holding a flag by 8.
*/
CAPTURING(0, 0, 8, -8);
CAPTURING(0, 0, 8, -8),

/**
* !DO NOT USE!
* NOOP upgrade that is mostly equivalent to ATTACK and exists for backwards compatability
*/
ACTION(0, 0, 0, 0);

/**
* How much base attack changes
Expand Down
17 changes: 15 additions & 2 deletions engine/src/main/battlecode/common/MapInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,27 @@ public boolean isSpawnZone() {
return spawnZone > 0;
}

/**
* Returns 1 if this square is a Team A spawn zone,
* 2 if this square is a Team B spawn zone, and
* 0 if this square is not a spawn zone.
*
* @return 1 or 2 if the square is a Team A or B spawn zone, respectively; 0 otherwise
*
* @battlecode.doc.costlymethod
*/
public int getSpawnZoneTeam() {
return spawnZone;
}

/**
* Returns the team that owns that spawn zone at this location, or Team.NEUTRAL if the location is not a spawn zone.
*
* @return The team that owns the spawn zone, or Team.NEUTRAL
*
* @battlecode.doc.costlymethod
*/
public Team getSpawnZoneTeam() {
public Team getSpawnZoneTeamObject() {
return spawnZone == 0 ? Team.NEUTRAL : (spawnZone == 1 ? Team.A : Team.B);
}

Expand Down Expand Up @@ -158,4 +171,4 @@ public String toString(){
'}';
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ battlecode/common/MapInfo/toString 15 fal
battlecode/common/MapInfo/isWall 2 false
battlecode/common/MapInfo/isDam 2 false
battlecode/common/MapInfo/getSpawnZoneTeam 2 false
battlecode/common/MapInfo/getSpawnZoneTeamObject 2 false
battlecode/common/MapInfo/getTrapType 2 false
battlecode/common/MapInfo/getTeamTerritory 2 false
battlecode/common/MapInfo/isSpawnZone 2 false
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/battlecode/util/FlatHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static byte getWinTypeFromDominationFactor(DominationFactor factor) {
}

public static byte getGlobalUpgradeTypeFromGlobalUpgrade(GlobalUpgrade gu) {
if (gu == GlobalUpgrade.ATTACK)
if (gu == GlobalUpgrade.ATTACK || gu == GlobalUpgrade.ACTION)
return GlobalUpgradeType.ACTION_UPGRADE;
if (gu == GlobalUpgrade.HEALING)
return GlobalUpgradeType.HEALING_UPGRADE;
Expand Down
5 changes: 3 additions & 2 deletions engine/src/main/battlecode/world/RobotControllerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,10 @@ public MapLocation[] senseBroadcastFlagLocations() {
public boolean senseLegalStartingFlagPlacement(MapLocation loc) throws GameActionException{
assertCanSenseLocation(loc);
if(!gameWorld.isPassable(loc)) return false;
boolean hasFlag = robot.hasFlag();
boolean valid = true;
for(Flag x : gameWorld.getAllFlags()) {
if(x.getId() != robot.getFlag().getId() && x.getTeam() == robot.getTeam() &&
if((!hasFlag || x.getId() != robot.getFlag().getId()) && x.getTeam() == robot.getTeam() &&
x.getLoc().distanceSquaredTo(loc) <= GameConstants.MIN_FLAG_SPACING_SQUARED && !x.isPickedUp()) {
valid = false;
break;
Expand Down Expand Up @@ -962,7 +963,7 @@ public void writeSharedArray(int index, int value) throws GameActionException {

private void assertCanBuyGlobal(GlobalUpgrade ug) throws GameActionException{
int i = -1;
if(ug == GlobalUpgrade.ATTACK)
if(ug == GlobalUpgrade.ATTACK || ug == GlobalUpgrade.ACTION)
i = 0;
else if(ug == GlobalUpgrade.CAPTURING)
i = 1;
Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/battlecode/world/TeamInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void incrementGlobalUpgradePoints(Team team){
*/
public boolean makeGlobalUpgrade(Team team, GlobalUpgrade upgrade){
if(this.globalUpgradePoints[team.ordinal()] > 0){
if (upgrade == GlobalUpgrade.ATTACK && !this.globalUpgrades[team.ordinal()][0]) {
if ((upgrade == GlobalUpgrade.ATTACK || upgrade == GlobalUpgrade.ACTION) && !this.globalUpgrades[team.ordinal()][0]) {
this.globalUpgrades[team.ordinal()][0] = true;
this.globalUpgradePoints[team.ordinal()]--;
return true;
Expand Down
16 changes: 12 additions & 4 deletions specs/specs.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# **Formal specification**

_This is the formal specification of the Battlecode 2024 game._ Current version: *2.0.0*
_This is the formal specification of the Battlecode 2024 game._ Current version: *2.0.1*

**Welcome to Battlecode 2024: Breadwars.**

Expand Down Expand Up @@ -141,7 +141,7 @@

The goal of attacking is to retrieve your opponent’s flags and bring them to your side. To retrieve this flag, your robots must first find the opponent's flag.

Robots can sense all flags within vision radius at all times, including flags that are picked up by other robots. Additionally, at the end of the setup phase, dropped enemy flags start broadcasting their approximate locations, which serves as a hint for seeking them out. Robots can sense locations of dropped enemy flags outside of vision radius that are accurate within a radius of **$\sqrt{10}$** cells. Every **100** turns, the broadcast location is updated to a new random location within that radius.
Robots can sense all flags within vision radius at all times, including flags that are picked up by other robots. Additionally, at the end of the setup phase, dropped enemy flags start broadcasting their approximate locations, which serves as a hint for seeking them out. Robots can sense locations of dropped enemy flags outside of vision radius that are accurate within a radius of **$\sqrt{100}$** cells. Every **100** turns, the broadcast location is updated to a new random location within that radius.

Robots can pick up and drop flags as described in the actions section. While holding a flag, robots cannot perform any actions besides movement, and robots may carry only one flag at a time. If your robot enters a friendly spawn zone while carrying an enemy flag, your team captures the flag and it is permanently removed from the game. Flags cannot be captured by being dropped into the spawn zone.

Expand Down Expand Up @@ -286,6 +286,13 @@

# **Appendix: Changelog**

- Version 2.0.1 (January 17, 2024)
- Engine fixes
- getSpawnZoneTeam() will still return int for backwards compatability
- getSpawnZoneTeamObject() will return a Team object
- 'ACTION' global upgrade retained for backwards compatability, will function as 'ATTACK'
- Fixed null pointer exception with senseLegalStartingFlagPlacement

- Version 2.0.0 (January 17, 2024)
- Balance changes
- Decreased attack level XP requirements
Expand All @@ -297,8 +304,8 @@
- Explosive trap nerf
- Radius when triggered by walking on trap $\sqrt{13}$ -> $\sqrt{4}$
- Radius when triggered by building $\sqrt{9}$ -> $\sqrt{2}$
- Damage when triggered by building 500 -> 200 (fixed bug causing damage to always be 750)
- Stun trap and explosive trap trigger radius 1 -> $\sqrt{2}$
- Damage when triggered by building, digging, or filling 500 -> 200 (fixed bug causing damage to always be 750)
- Stun trap and water trap trigger radius 1 -> $\sqrt{2}$
- Stun trap stun rounds 40 -> 50
- Flag broadcast radius $\sqrt{10}$ -> $\sqrt{100}$
- Global upgrades can now be acquired every 600 rounds instead of 750
Expand All @@ -308,6 +315,7 @@
- Engine improvements
- The senseLegalStartingFlagPlacement method no longer checks if the location is adjacent to the robot
- Added getAttackDamage() and getHealAmount() methods
- getSpawnZoneTeam() now returns a Team object

- Version 1.2.5 (January 16, 2024)
- Engine improvements
Expand Down

0 comments on commit 3185085

Please sign in to comment.