Skip to content

Commit

Permalink
v0.5.2 release (botarena 202 version)
Browse files Browse the repository at this point in the history
  • Loading branch information
bencbartlett committed Feb 2, 2019
1 parent 75fc1b9 commit 9dd7615
Show file tree
Hide file tree
Showing 23 changed files with 425 additions and 182 deletions.
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format

## [Unreleased]

## Overmind [0.5.2] - 2019.2.1

This patch adds improvements to Overmind's performance at lower RCL, fixes boosting logic to account for the removal of pre-boosting, and improves road planning, room intel, and swarms. This release is the version running in botarena 202.

### Added
- Visualizer improvements:
- Added a dashboard section for the evolution chamber
Expand All @@ -29,7 +33,7 @@ All notable changes to this project will be documented in this file. The format
- Creep occupancy data over the last 25 ticks (computed only in owned rooms)
- Safety data, tracking consecutive safe, unsafe ticks and rolling average of safety over last 1k and 10k ticks
- `CombatIntel.isEdgeDancing` uses creep occupancy data tracked in `RoomIntel` to determine if a likely tower drain attack is occurring; towers will adjust their firing patterns accordingly.

- Initial (incomplete) implementation of `CombatPlanner`, which will coordinate automatic offensive and defensive actions betweeen colonies.

### Changed
- Rewrote the boosting protocol to account for the removal of [pre-boosting capabilities](https://blog.screeps.com/2018/12/changelog-2018-12-14/#Other-changes). RIP in-spawn boosting, you will be missed... :'(
Expand All @@ -41,7 +45,13 @@ All notable changes to this project will be documented in this file. The format
- Non-stationary managers have fewer move parts in bunker-type colonies
- Reservers allow for a lower reservation buffer and will use the cached reservation info from `RoomIntel` if vision is unavailable
- Queens now spawn with 1:1 move:carry ratios until a storage is built
- Changes to overlord priorities at lower RCL
- Tweaks to safemode and invasionDefense triggers
- UpgradeSites won't place containers until RCL 2
- Consolidated mutalisk and hydralisk body plans

### Removed
- Deprecated directives and overlords for old siege and healpoint logic

### Fixed
- Security patches and bugfixes for the `Assimilator`
Expand Down Expand Up @@ -83,7 +93,6 @@ This patch changes the architecture of Overmind to be much more CPU efficient by
- Preliminary support for formation-based movement and pathfinding using `Swarm`s
- Added behavioral locks to prevent usage of this feature for non-assimilated codebases


### Changed
- Improvements to `RangedDefenseOverlord` which utilize some of the new combat logic developed for SK mining
- Queens now are prespawned 100 ticks in advance of when they are needed (up from 50) until there are multiple spawns in the room
Expand Down Expand Up @@ -118,7 +127,6 @@ This patch changes the architecture of Overmind to be much more CPU efficient by
- Limits the number of owned rooms you can own on CPU-limited `shard3` to three
- Adjustable value in `~settings.ts`; will implement a more sophisticated CPU-based limiter in future


### Fixed
- Bugfix with pioneer recharging behavior to include dropped resources in recharging options
- Bugfix for incorrectly initialized terminalNetwork memory not logging transfer costs correctly (#38, thanks @MaggNorway!)
Expand All @@ -132,11 +140,11 @@ This patch changes the architecture of Overmind to be much more CPU efficient by
- Fixed an issue in testing assimilation status outside `shard2` (#57)
- Fixed a bug where queens could get idle indefinitely at early RCL if minerals ended up in Hatchery battery


### Removed
- `MiningSite`s and `ExtractionSite`s have been removed; their functionalities have been split among the mining/extraction directives and overlords



## Overmind [0.5.0]: "Evolution" - 2018.8.10

This release adds a huge set of new features to Overmind, described in more detail in [this blog post](https://bencbartlett.wordpress.com/2018/08/11/screeps-5-evolution/). The most notable change is the shift in base layout from the classic "box and flower" design to a much more compact circular bunker. Although this layout is more expensive to maintain, it is much more defensible and features a number of hard-coded optimizations.
Expand Down Expand Up @@ -432,7 +440,8 @@ release of the Task system)
- Initial pre-release of Overmind after 190 commits and about 80,000 additions.


[Unreleased]: https://github.com/bencbartlett/Overmind/compare/v0.5.1...HEAD
[Unreleased]: https://github.com/bencbartlett/Overmind/compare/v0.5.2...HEAD
[0.5.1]: https://github.com/bencbartlett/Overmind/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/bencbartlett/Overmind/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/bencbartlett/Overmind/compare/v0.4.1...v0.5.0
[0.4.1]: https://github.com/bencbartlett/Overmind/compare/v0.4.0...v0.4.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Overmind",
"version": "0.5.1",
"version": "0.5.2",
"description": "Overmind Screeps AI",
"author": "Ben Bartlett",
"license": "MIT",
Expand Down
9 changes: 6 additions & 3 deletions src/Overseer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {MUON, MY_USERNAME, USE_TRY_CATCH} from './~settings';
import {DirectiveOutpostDefense} from './directives/defense/outpostDefense';
import {Notifier} from './directives/Notifier';
import {DirectiveColonize} from './directives/colony/colonize';
import {CombatPlanner} from './strategy/CombatPlanner';


// export const DIRECTIVE_CHECK_FREQUENCY = 2;
Expand All @@ -45,6 +46,7 @@ export class Overseer implements IOverseer {
private overlordsByColony: { [col: string]: Overlord[] }; // Overlords grouped by colony
private directives: Directive[]; // Directives across the colony

combatPlanner: CombatPlanner;
notifier: Notifier;

static settings = {
Expand All @@ -58,6 +60,7 @@ export class Overseer implements IOverseer {
this.overlordsByColony = {};
this.sorted = false;
this.notifier = new Notifier();
this.combatPlanner = new CombatPlanner();
}

refresh() {
Expand Down Expand Up @@ -203,8 +206,8 @@ export class Overseer implements IOverseer {
let needsDefending = effectiveInvaderCount >= 3 || colony.room.dangerousPlayerHostiles.length > 0;

// Place defensive directive after hostiles have been present for a long enough time
let safetyData = colony.room.memory.safety;
let invasionIsPersistent = safetyData && safetyData.unsafeFor > 20;
let safetyData = RoomIntel.getSafetyData(colony.room.name);
let invasionIsPersistent = safetyData.unsafeFor > 20;

if (needsDefending && invasionIsPersistent) {
DirectiveInvasionDefense.createIfNotPresent(colony.controller.pos, 'room');
Expand Down Expand Up @@ -297,7 +300,7 @@ export class Overseer implements IOverseer {
// Safe mode condition =============================================================================================

private handleSafeMode(colony: Colony): void {
if (colony.stage == ColonyStage.Larva) {
if (colony.stage == ColonyStage.Larva && onPublicServer()) {
return;
}
// Safe mode activates when there are dangerous player hostiles that can reach the spawn
Expand Down
2 changes: 1 addition & 1 deletion src/console/globals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare const __VERSION__: string;
global.__VERSION__ = '0.5.1';
global.__VERSION__ = '0.5.2';

declare function deref(ref: string): RoomObject | null;

Expand Down
76 changes: 43 additions & 33 deletions src/creepSetups/setups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Roles = {
upgrader : 'upgrader',
// Combat roles
guardMelee : 'broodling',
guardRanged: 'mutalisk',
// guardRanged: 'mutalisk',
melee : 'zergling',
ranged : 'hydralisk',
healer : 'transfuser',
Expand Down Expand Up @@ -177,6 +177,7 @@ export const Setups = {

export const CombatSetups = {

// Zerglings are melee-only creeps (with exception of sourceKeeper setup)
zerglings: {

default: new CreepSetup(Roles.melee, {
Expand Down Expand Up @@ -206,16 +207,22 @@ export const CombatSetups = {

},

// Hydralisks are ranged creeps which may have a small amount of healing
hydralisks: {

early: new CreepSetup(Roles.ranged, {
pattern : [RANGED_ATTACK, MOVE],
sizeLimit: Infinity,
}),

default: new CreepSetup(Roles.ranged, {
pattern : [RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, HEAL, MOVE, MOVE, MOVE, MOVE],
pattern : [RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, MOVE, MOVE, MOVE, MOVE, HEAL],
sizeLimit: Infinity,
}),

boosted_T3: new CreepSetup(Roles.ranged, {
pattern : [TOUGH, TOUGH, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, HEAL,
MOVE, MOVE],
pattern : [TOUGH, TOUGH, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK,
MOVE, MOVE, HEAL],
sizeLimit: Infinity,
}),

Expand All @@ -226,6 +233,7 @@ export const CombatSetups = {

},

// Healers (transfusers) are creeps which only do healing
healers: {

default: new CreepSetup(Roles.healer, {
Expand All @@ -245,48 +253,50 @@ export const CombatSetups = {

},

// Broodlings are primarily melee creeps which may have a small amount of healing
broodlings: {

default: new CreepSetup(Roles.guardMelee, {
pattern : [TOUGH, ATTACK, ATTACK, ATTACK, MOVE, MOVE, MOVE, MOVE, MOVE, HEAL],
sizeLimit: Infinity,
}),

early: new CreepSetup(Roles.guardMelee, {
pattern : [ATTACK, MOVE],
sizeLimit: Infinity,
}),

},

mutalisks: {

default: new CreepSetup(Roles.guardRanged, {
pattern : [RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, MOVE, MOVE, MOVE, MOVE, HEAL],
sizeLimit: Infinity,
}),

early: new CreepSetup(Roles.guardRanged, {
pattern : [RANGED_ATTACK, MOVE],
sizeLimit: Infinity,
}),

},

guards: {

melee: new CreepSetup(Roles.guardMelee, {
default: new CreepSetup(Roles.guardMelee, {
pattern : [TOUGH, ATTACK, ATTACK, ATTACK, MOVE, MOVE, MOVE, MOVE, MOVE, HEAL],
sizeLimit: 3,
}),

melee_early: new CreepSetup(Roles.guardMelee, {
pattern : [ATTACK, MOVE],
sizeLimit: Infinity,
}),

},

// mutalisks: {
//
// default: new CreepSetup(Roles.guardRanged, {
// pattern : [RANGED_ATTACK, RANGED_ATTACK, RANGED_ATTACK, MOVE, MOVE, MOVE, MOVE, HEAL],
// sizeLimit: Infinity,
// }),
//
// early: new CreepSetup(Roles.guardRanged, {
// pattern : [RANGED_ATTACK, MOVE],
// sizeLimit: Infinity,
// }),
//
// },

// guards: {
//
// melee: new CreepSetup(Roles.guardMelee, {
// pattern : [TOUGH, ATTACK, ATTACK, ATTACK, MOVE, MOVE, MOVE, MOVE, MOVE, HEAL],
// sizeLimit: 3,
// }),
//
// melee_early: new CreepSetup(Roles.guardMelee, {
// pattern : [ATTACK, MOVE],
// sizeLimit: Infinity,
// }),
//
// },

// Dismantlers (lurkers) are creeps with work parts for dismantle sieges
dismantlers: {

default: new CreepSetup(Roles.dismantler, {
Expand Down
16 changes: 9 additions & 7 deletions src/declarations/memory.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ interface SavedMineral extends SavedRoomObject {
density: number;
}

interface SafetyData {
safeFor: number;
unsafeFor: number;
safety1k: number;
safety10k: number;
tick: number;
}

interface RoomMemory {
avoid?: boolean;
src?: SavedSource[];
Expand Down Expand Up @@ -198,13 +206,7 @@ interface RoomMemory {
tick: number;
}
}
safety?: {
safeFor: number;
unsafeFor: number;
safety1k: number;
safety10k: number;
tick: number;
}
safety?: SafetyData;
prevPositions?: { [creepID: string]: protoPos };
creepsInRoom?: { [tick: number]: string[] };
tick?: number;
Expand Down
1 change: 1 addition & 0 deletions src/declarations/prototypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type rechargeObjectType = StructureStorage
interface Room {
print: string;
my: boolean;
isOutpost: boolean;
owner: string | undefined;
reservedByMe: boolean;
signedByMe: boolean;
Expand Down
16 changes: 16 additions & 0 deletions src/directives/defense/_DefenseDirective.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {Directive} from '../Directive';
import {Overseer} from '../../Overseer';
import {CombatOverlord} from '../../overlords/CombatOverlord';

export abstract class DefenseDirective extends Directive {

overlord: CombatOverlord;
overlords: {};

constructor(flag: Flag) {
super(flag);
(<Overseer>Overmind.overseer).combatPlanner.directives.push(this);
}


}
2 changes: 2 additions & 0 deletions src/directives/defense/invasionDefense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class DirectiveInvasionDefense extends Directive {
}

spawnMoarOverlords() {

if (!this.room) {
return;
}
Expand All @@ -47,6 +48,7 @@ export class DirectiveInvasionDefense extends Directive {
} else {
this.overlords.meleeDefense = new MeleeDefenseOverlord(this, useBoosts);
}

}

init(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/hiveClusters/upgradeSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class UpgradeSite extends HiveCluster {
}

run(): void {
if (Game.time % 25 == 7) {
if (Game.time % 25 == 7 && this.colony.level >= 2) {
this.buildBatteryIfMissing();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/intel/CombatIntel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ export class CombatIntel {
}

// Total attack/rangedAttack/heal potentials for a group of creeps
static combatPotentials(creeps: Creep[]): CombatPotentials {
static getCombatPotentials(creeps: Creep[]): CombatPotentials {
let attack = _.sum(creeps, creep => this.getAttackPotential(creep));
let rangedAttack = _.sum(creeps, creep => this.getRangedAttackPotential(creep));
let heal = _.sum(creeps, creep => this.getHealPotential(creep));
Expand Down
13 changes: 13 additions & 0 deletions src/intel/RoomIntel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@ export class RoomIntel {
room.memory.safety.tick = Game.time;
}

static getSafetyData(roomName: string): SafetyData {
if (!Memory.rooms[roomName].safety) {
Memory.rooms[roomName].safety = {
safeFor : 0,
unsafeFor: 0,
safety1k : 1,
safety10k: 1,
tick : Game.time
};
}
return Memory.rooms[roomName].safety!;
}

static isInvasionLikely(room: Room): boolean {
const data = room.memory.invasionData;
if (!data) return false;
Expand Down
Loading

0 comments on commit 9dd7615

Please sign in to comment.