KungFuClan / KungFuScreeps

https://screepers.gitbook.io/screeps-typescript-starter/
9 stars 4 forks source link

Create a dynamic rallying system #61

Closed UhmBrock closed 4 years ago

UhmBrock commented 4 years ago

Initial thoughts:

Add a caravanPosition to each squad member, ranging from 0 to x

Create a path to a location before the target room, in a position where creeps will be ready to begin operation.

Use the caravanPosition to find a position along that path that each creep will stop at. caravanPosition 0 will stop at the last position, 1 at the second to last, etc.

if(creep.pos === getRallyPosition(path, creep.caravanPosition)) {
      // creep is rallied
} else {
      // creep needs to rally still
}
UhmBrock commented 4 years ago

We would like for the caravanPosition to be decided when we decide the creeps to spawn in the squad manager. This prevents relying on spawn order or other factors.

so in the array that we define what the squad is define the caravan position, and when we push it to spawn queue, add caravan position to that object as well so when we create the creep it puts it in memory that way we can spawn 20 medics in a squad but they’ll all have different caravan positions in their own

Creep.memory.options.caravanPosition will be the stored location