You always can look into game engine: https://github.com/screeps/engine/blob/8928228bae60db78c50a7382cc3490c611b03f26/src/utils.js#L981
Looks like first four characters is first position in path and then list of directions to the next position.
You always can look into game engine: https://github.com/screeps/engine/blob/8928228bae60db78c50a7382cc3490c611b03f26/src/utils.js#L981
Looks like first four characters is first position in path and then list of directions to the next position.
@duckymirror No, you can't. You can't spawn on PTR server. Only one way to access to PTR server is to spawning on official server and wait until PTR server is synced with official.
@ciber Interesting idea. What about ramparts and walls can you build this structure on river?
Можно добавить терминал и будут появляться ордеры, или можно через CLI добавить себе кредитов. Посмотрите команду Adding NPC Terminals
https://wiki.screepspl.us/index.php/Private_Server_Common_Tasks
Продай что-то, без формирования ордера. Game.market.deal(...)
Are you know that you pay for serialization your memory? Try to do JSON.stringify(Memory)
and you'll know about how much. So when you try to get used CPU at the end of tick this is not the same CPU that used your AI, because you will not take account of the CPU to serialization memory.
For example to serialization my memory needs about 18 CPU. You can perform let cpu = Game.cpu.getUsed();JSON.stringify(Memory);console.log(Game.cpu.getUsed()-cpu)
in the game console to check it.
@utiuti What instruction you try to following? To cancel orders on shard you MUST to have creeps or active room on this shard. But you can't have creeps on shard because portals is still closed.
@smokeman I am try to tell you that you can do what you want by using flags. https://bencbartlett.wordpress.com/2018/02/06/screeps-2-interior-design/
@smokeman I think this game about automation everything. I am do not like idea to past mouse position to the server. If you want you can use flags for this.
@calfa I am do not understand what you try to do. What steps you are try to reproduce? Try to use this article https://docs.screeps.com/contributed/ps_ubuntu.html
@calfa said in Need some help improving my CPU usage:
toJSON
I think you are save room and creep object to the memory, but I don't understand why so many count of call for this methods. Are you use JSON.stringify
some where?
@calfa You can use lodash function includes
so your code should look like :
//I have an array called myArray with a few IDs
let myArray = ['1234', '2345', '3456'];
let myStructure = creep.pos.findClosestByPath(FIND_MY_STRUCTURES, {
filter: function(s){
return ((s.structureType == STRUCTURE_SPAWN || s.structureType == STRUCTURE_EXTENSION) && !_.includes(myArray,s.id));
}
});
@wtfrank I think because PathFinder is native library and have better performance then JS library.
@systemparadox You are wrong all methods use new path finder for default. You can look into the method Room.findPath
and you will see this condition
if(register._useNewPathFinder) {
return _findPath2(this.name, fromPos, toPos, opts);
}
And you can look on the Game.js
where register
object are created line 114
:
var register = {
_useNewPathFinder: true,
_objects: {},
@keenathar Try to look attentively, the are swamp in those places.
You should look on the PathFinder
. This is easy way to create flee behavior. This is shor example how you can use it. The enemys
- this is array of enemy creeps, creep
is your creep.
let path = PathFinder.search(creep.pos, enemys.map(c=>{return{pos:c.pos,range:3}},{flee:true}).path
creep.moveByPath(path)
You can found more options in the documentation: https://docs.screeps.com/api/#PathFinder
@kyralee Reservation is not give you vision in room.
I think you can change Game.map.getRoomLinearDistance
on Game.map.findRoute(flag.pos.roomName, Game.rooms[i].name)
. So you will found nearest room by path, not a range. Because some time nearest rooms have very long path to travel between those rooms.
@tigga Are you using TS or some sort of code optimiser? This is not work for me because TS is remove allocation of memory when compiling because this variable is never use.