This is a big game update containing many features:
Tunnels
It is now allowed to build roads on top of natural terrain walls. Such “tunnels” open some interesting tactical opportunities in rooms with complex landscape. Construction and maintenance cost is 150x higher than a normal road on plain land (see documentation):
Hits: 750,000
Decay: Loses 15,000 hits every 1,000 ticks
Roads cannot be built on edge tiles, i.e. you cannot create additional room exits using roads. Other usual rules apply: you can build roads in neutral rooms, but any construction in hostile owned rooms is prohibited.
PTR Discussion
Room event log
Currently Screeps has no API to track what actions have been succesfully performed, or what creeps have made certain actions to which targets. This is especially important in battles, when your creep receives damage, you can’t determine the actual attacker. This update introduces a new system called room event log.
New method is added: Room.getEventLog
. It returns an array containing event items that describe most actions that have taken place in this room on the last tick:
[{
event: EVENT_ATTACK,
objectId: '54bff72ab32a10f73a57d017',
data: {
targetId: '54bff74fb32a10f73a57d018',
attackType: EVENT_ATTACK_TYPE_MELEE,
damage: 20
}
},
{
event: EVENT_HEAL,
objectId: '54bff72ab32a10f73a57d017',
data: {
targetId: '54bff72ab32a10f73a57d017',
amount: 10,
healType: EVENT_HEAL_TYPE_RANGED
}
},
{
event: EVENT_HARVEST,
objectId: '54bff72ab32a10f73a57d017',
data: {
targetId: '54bff74fb32a10f73a57d018',
amount: 50
}
},
{
event: EVENT_REPAIR,
objectId: '54bff72ab32a10f73a57d017',
data: {
targetId: '54bff74fb32a10f73a57d018',
amount: 1000,
energySpent: 10
}
},
{
event: EVENT_UPGRADE_CONTROLLER,
objectId: '54bff72ab32a10f73a57d017',
data: {
targetId: '54bff74fb32a10f73a57d018',
amount: 10,
energySpent: 5
}
},
{
event: EVENT_TRANSFER,
objectId: '54bff72ab32a10f73a57d017',
data: {
targetId: '54bff74fb32a10f73a57d018',
resourceType: RESOURCE_ENERGY,
amount: 200
}
},
{
event: EVENT_EXIT,
objectId: '54bff72ab32a10f73a57d017',
data: {
room: 'W18N23',
x: 0,
y: 28
}
}]
Events last only one tick, so if you need to track event logs for a longer period, you have to store them on your own. Every room has its own event log array. You can track events performed by a particular creep like this:
_.filter(creep.room.getEventLog(), {objectId: creep.id});
Or you can find all hostile actions against your creeps and structures:
_.forEach(Game.rooms, room => {
let eventLog = room.getEventLog();
let attackEvents = _.filter(eventLog, {event: EVENT_ATTACK});
attackEvents.forEach(event => {
let target = Game.getObjectById(event.targetId);
if(target && target.my) {
console.log(event);
}
});
});
Even when the creep object is gone (being killed or leaving the room), the attacking event is still recorded to the log, so you are able to reason on what’s happened.
Not only hostile actions are recorded, but you can also use the events log to track effectiveness of your harvest, upgrade and repair operations.
Since these JSON arrays can become quite big, they are stored and fetched by the engine as raw strings, and deserialized using JSON.parse
when you call the Room.getEventLog()
method for the first time. Thus, if you opt-in to use this feature, it will incur some CPU cost depending on the number of actions in this particular room in the given tick. You can retrieve raw JSON in string format using Room.getEventLog(true)
.
PTR discussion
Draft discussion
Unboosting creeps
Introduced new method StructureLab.unboostCreep
. It removes all boosts from a creep and drops 50% of the mineral resources spent on boosting (15 out of 30 for each body part). The difference between this method and StructureSpawn.recycleCreep
is that unboosting always returns 15 units of mineral compound regardless the creep’s remaining time to live. You can use it to take boosts off an old creep and reapply 50% of them to a new creep.
Unboosting requires cooldown equal to the total time of the reactions needed to produce all the compounds being returned.
Side change: StructureSpawn.renewCreep
now shows a message in console if you try to call it on a creep with boosts. In future, it will throw an error. Use StructureLab.unboostCreep
to remove boosts before you renew a creep.
Other changes
Intershard travel TTL penalty is removed. When a creep enters an intershard portal, its time to live will remain the same on the other side.
New performant methods
Game.map.getRoomTerrain
,Room.getTerrain
, and prototypeRoom.Terrain
. Old methodis considered deprecated now (engine#83 by Mototroller).Game.map.getTerrainAt
Max energy return from
StructureSpawn.recycleCreep
is limited to 125 units per body part.SIGN_NOVICE_AREA
andSIGN_RESPAWN_AREA
are now considered deprecated and replaced with one constantSIGN_PLANNED_AREA
.Creep.build
now is not blocked by the room controller level, you can build any construction site if it’s already placed.ERR_RCL_NOT_ENOUGH
is removed from this method (engine#77 by WolfWings).
This update is supported in private server version 3.1.0
.
Have comments or feedback? You can discuss this post here.