It is out of our control to save data consistently. The only thing we can do is to use old "architecture" cause it is not as buggy as new one.
Posts made by Actium
-
RE: creepCounter problemposted in Help
-
RE: creepCounter problemposted in Help
It does not work because nodes the game world is simulated on do not see the same data at the same time. In simple words, data are inconsistent.
-
RE: Ticks Usedposted in General Discussion
Optimized a bit:
average CPU consumption: 11.64
average creep count: 55.88
number of rooms: 5
CPU limit: 20 -
CPU limitposted in Help
Can somebody explain me why does a script containing the single line
console.log(Game.cpuLimit);
output the following:[10:45:31 AM] 261
[10:45:44 AM] 281 // ok, +20 (CPU limit is set to 20)
[10:46:08 AM] 279 // strange, -2
[10:46:15 AM] 296 // basically, ok, +17
[10:46:27 AM] 313
[10:46:31 AM] 328
[10:46:39 AM] 289 // very strange, -39
[10:46:44 AM] 308
[10:46:56 AM] 325
[10:47:01 AM] 325 // strange, 0
[10:47:12 AM] 341
[10:47:25 AM] 360
[10:47:37 AM] 380
[10:47:48 AM] 399
[10:48:01 AM] 418
[10:48:13 AM] 418 // 0 again -
Ticks get longer and longer and longerposted in General Discussion
Yesterday the length of a tick was about 3 seconds. At the moment one tick is simulated in 10 seconds. Where the world is heading...
-
RE: Ticks Usedposted in General Discussion
average CPU consumption: 14.77
average creep count: 45.24
number of rooms: 4
CPU limit: 20I want to optimize my code but do not have enough time

-
RE: What is a good way to build proper defense at start?posted in General Discussion
Having 2 energy sources in the room you can upgrade the controller up to level 4 until walls down.
-
RE: How are we upgrading our creeps?posted in General Discussion
You can predefine levels for every role as follows:
var carrier_levels = [ { cost: 100, body: [ CARRY, MOVE ] }, { cost: 200, body: [ CARRY, MOVE, CARRY, MOVE ] } ];
Then select most appropriate level for certain conditions.
-
Profilingposted in General Discussion
Disclaimer: I did not program with javascript until started playing screeps.
Recently my script has been terminated due to CPU limit. In order to deal with this issue I wrote the following code:
var enable_profiling = true; if (enable_profiling) { Memory.p = Memory.p || {}; var wrap = function(c, n) { var p = Memory.p[n] || { usage: 0, count: 0 }; Memory.p[n] = p; var f = c.prototype[n]; c.prototype[n] = function() { var ts = Game.getUsedCpu(); var rc = f.apply(this, arguments); p.usage += Game.getUsedCpu() - ts; ++p.count; return rc; }; }; wrap(RoomPosition, 'isNearTo'); wrap(RoomPosition, 'findPathTo'); wrap(RoomPosition, 'isEqualTo'); wrap(RoomPosition, 'findClosest'); wrap(Creep, 'moveByPath'); wrap(Creep, 'moveTo'); wrap(Creep, 'pickup'); wrap(Creep, 'build'); wrap(Creep, 'repair'); wrap(Creep, 'harvest'); wrap(Creep, 'upgradeController'); wrap(Room, 'lookForAt'); wrap(Room, 'find'); wrap(Spawn, 'createCreep'); } .... // main code var report_interval = 200; if (Game.time % report_interval == 0) { var summary = 0; for (var n in Memory.p) { var p = Memory.p[n]; if (p.count === 0) { p.average = 0; continue; } p.average = p.usage / p.count; summary += p.average; } for (var n in Memory.p) { var p = Memory.p[n]; console.log(n + ': ' + p.usage.toFixed(2) + '/' + p.count + ' == ' + p.average.toFixed(2) + ' (' + (p.average * 100 / summary).toFixed(2) + '%)'); } console.log('--- ' + summary.toFixed(2)); Memory.p = {}; }Feel free to use it.
-
RE: A potential very fast js pathfinder algorithmposted in General Discussion
chris, probably not. I have slightly optimized the search function by caching neighbors for traversed points. The cache is gone after leaving the function.
-
RE: A potential very fast js pathfinder algorithmposted in General Discussion
The results posted above have been got with A*.
-
RE: Abusive playersposted in General Discussion
Wow, I did not know that spawning creeps for attacking adjacent rooms is prohibited. OK, fixed

-
RE: Abusive playersposted in General Discussion
Devs replied that they took action against this player.
Yesterday my room was cleared (buildings destroyed, creeps killed) by the support team as response to a player's request. Moreover, I cannot play the game because the respawn feature is not available. So if you can live with stamp of sneaker just send a message to the support team and all your problems will be eliminated.
-
RE: A potential very fast js pathfinder algorithmposted in General Discussion
Do you use built-in path finder so far? Just compare results of searching a path between random points within a room (self-written path finder vs. built-in one):
sw 7.04 bi 36.29
sw 4.73 bi 33.55
sw 7.34 bi 13.41
sw 2.26 bi 8.91
sw 1.26 bi 12.67
sw 1.63 bi 11.81
sw 1.45 bi 2.55
sw 1.88 bi 3.96
sw 1.11 bi 8.32 -
RE: Ticks Usedposted in General Discussion
Amount of cpu overusage is more interesting, I think. Using this one can calculate average overuse to understand how close it is to the limit.
-
RE: Ticks Usedposted in General Discussion
There is some "static" CPU consumption not related to AI at all (for instance, cpu used for loading modules).
-
RE: A potential very fast js pathfinder algorithmposted in General Discussion
It was time to get my implementations of path finding algorithms from the attic. I have found some of them are very useful in context of the game

-
RE: CPU usage statisticsposted in Feature Requests
Well, I can gather statistics myself, but I cannot see it real-time (do not suggest me to use console.log(), please) and reset without changing the code.