Recently a group of screeps players have been engaging in wargames. It was fun and I learned a great deal; bonzAI’s defense/offense has improved substantially. I had 2 rooms tagged and was able to tag 4. Just about everyone got a tag and got tagged themselves. Tons of creative strategies and lessons learned all around.
Atavus, who was the organizer, has a great write-up with more detail on the wargames and the community that participates in them. Hope you will join in on the next round!
You can only code your defense/offense to handle the situations that you are able to imagine, and other people have a way of not sticking to your rules. I hope these are useful for other players as they plan their defense and offense. All the code/commits can currently be found in the
testing branch of bonzAI, which is open source and available to review, should it strike your fancy.
Death By Trebuchet
My first tag was from Seancl fairly early on in the games. He chose an excellent spot in one of my rooms to attack. Unfortunately I didn’t get a gif.
Here is the beginning of my downfall from taiga’s attack. My defense code detected two clusters and spawned one for each cluster. This wasn’t enough, since the majority of taiga’s creeps could use ranged attack to do a decent amount of damage anyway.
My response was to send out a healer/melee squad which worked pretty well…
…some of the time.
Ultimately too much damage had already been done and taiga got the tag on that room due to some excellent creep positioning and distraction tactics. My consolation prize was that DefenseMission improved significantly (although still plenty of room for improvement).
Duck and Cover
There were 8 nukes inbound on that room and I had an interesting time writing code to automatically handle a nuke attack.
Ultimately I got the math right and every structure it tried to save was saved (in hindsight the power spawn should have been in that list). It only put ramparts on the structures that were deemed mission critical, and the two extra labs were considered an unnecessary luxury.
About 800 ticks before they landed I got inspired to write EvacOperation to have creeps flee a room with an imminent nuke. Despite the fact that it was rushed it sort of worked! My solution was to pick a position in the middle of the room and have them try to flee up to a certain range that would require them to leave the room. A couple decided to return before the barrage ended due to a bug in this code (as always!).
Run For Your Life
It turns out taiga had some pretty challenging creep defense as well which included both single melee creeps and a healer+melee squad.
I could sometimes take out the single melee but the squads were a much bigger problem. Many of my creeps gave their parts in service of helping me improve my flee code. These were fully boosted creeps with 30 melee parts so combined with tower damage that could be up to 4500+ damage per tick, well past what could be easily healed. Their chase-code was pretty good so letting one get in range for even a single tick was almost certainly a death sentence.
Eventually my fleeing improved and I was able to do stuff like this. The green overlay shows the cost matrix that the creeps are using for both fleeing and pathing to the target. It was interesting that giving higher costs to the positions that surrounded my creeps forced them to be a little spread out and ended up making it a little more effective. This concept could be used to support flanking behavior if you are trying to chase a ranged attacker. (a little slower because it was taken live)
Fleeing as a squad had some interesting challenges. Do you flee in relation to the healer or the attacker or both? How do you guarantee they will stay together? In the end I decided to handle it like any other squad movement, have the healer lead and the attacker move on to the position that the healer was just standing.
Cowardly But Effective
Another unit that helped me take this room was The Longbow. During the breach phase of the attack, these ranged attackers stand on the edge of the room and alternate back and forth. They turned out to be incredibly effective even for very well healed melee+healer squads. Unit after unit melted up against them with virtually none lost in the process.
Here is what is happening on the other side. Due to all the healing power available and a full tick of safety, it would theoretically take a 1-hit-knockout to make a dent.
I wrote some code to nuke taiga’s room with everything in range, and I didn’t realize how many rooms were in range so there ended up being something like 11 nukes. Instead of trying to outrepair the wall, taiga just moved the wall! I like to think he laughed maniacally as 8+ nukes hit empty ground.
Eventually I got the tag on this room due to a technicality but lets just say it was not my cleanest victory!
Evening The Odds
Making any kind of progress in a raid is very hard work when a room is properly defended. The towers are a significant source of damage and healing. Defender creeps have the advantage of being already on site and a much longer effective ticks-to-live.
Fortunately there are sometimes tricks you can use to get an advantage. It is important to watch the defending creeps and come up with theories about the code that forms their behavior.
I wrote some code that allowed me to designate targets manually with a flag. If the creep has ranged attack parts they will use
range: 3 in Traveler/PathFinder options. This lets them correctly approach structures that are on the other side of the wall. (I’ll be fixing the AutoLayout in bonzAI to make sure nothing can be reached as well!)
There are two things worth noting in the gif below. Sometimes you can “distract” creeps away from your main breach target, depending on how the defending creeps choose their targets. This isn’t so much a problem with target choosing as a bigger issue with the creep-under-the-rampart style of defense. For a long time I’ve considered that the gold-standard of creep defense but it is fairly difficult to rule out distraction.
One solution is to spawn a creep to handle each group of attackers. However, if you are spawning more than one defender, might as well make it a melee+healer squad and then you won’t have to worry about staying under a rampart. I’ll be updating bonzAI to work with this style of defense in certain situations.
Another thing that you can sometimes exploit are attacks on worker creeps or repair units. This potentially makes the spawn busier and interferes with repairing.
Special shout-out to Team Capybara, we fought the good fight! And congratulations to Team 1 for taking the victory. Final score was 6:8. Looking forward to the next round.
There were many more great stories from this event. I’ll close with this gif showing Seancl tagging a room. He had triggered Safe Mode by breaching the wall but wasn’t satisfied to throw in the towel just yet.