Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. t3jem
    3. Posts
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Posts made by t3jem

    • RE: Cannot convert Circular structure to JSON

      A stack trace would have shown that it was failing while trying to stringify memory rather than a console.log a circular reference though (which I've done before and had a similarly difficult time tracking down).

       

      Errors like this should always provide a stack trace to help point to where the error is (whether it's bad stored data, or a bad log).

      posted in Technical Issues and Bugs
      t3jem
    • RE: Cannot convert Circular structure to JSON

      Thanks for that pointer.  Looks like the issue was a RoomPosition object I was storing in memory.

       

      Any chance we could get a stack trace for this error?

      posted in Technical Issues and Bugs
      t3jem
    • Cannot convert Circular structure to JSON

      My script has stopped working due to a continuous "Cannot convert Circular structure to JSON" error.

       

      I commented out my entire main file (from line 0 to EOF) to try to get the error to stop, but to no avail.  This started last night with no code changes and appears to have been going for most of the night as I lost 3 levels on my 2 controllers.

      What changed?

      posted in Technical Issues and Bugs
      t3jem
    • RE: RangeError: Maximum call stack size exceeded

      The source shouldn't be in another room as I'm doing a room.find, but just in case I went ahead and did as suggested.  I mostly did it at first because I wasn't sure which part of the result was circular and just wanted to create a new object.  The code is still working around the bug though.


      It seems that the objects returned by FIND_DROPPED_ENERGY is circular causing issues with path finding and logging it.

      posted in Help
      t3jem
    • RE: RangeError: Maximum call stack size exceeded

      Ok, I did a little more digging and I believe it's something to do with the objects returned via room.find(FIND_DROPPED_ENERGY).

       

      I'm unable to JSON.stringify these objects due to them having a circular structure, so I wrote the below code to convert them to roomPosition objects only to search using findClosestByPath.  Suddenly the errors went away completely, reverting my code brought it back.  I was able to reliably reproduce via at least one location of dropped energy in the room.

       

      Code to work around bug:

      var newSources = [];
      for (var i = 0; i < sources.length; i++) {
      var pos = sources[i].pos;
      newSources.push(creep.room.getPositionAt(pos.x, pos.y));
      }

      sources = newSources;
      posted in Help
      t3jem
    • RE: RangeError: Maximum call stack size exceeded

      FYI, I just got this error again, new stack trace and code:

      2Error Finding sources: RangeError: Maximum call stack size exceeded
      at RegExp.[Symbol.match] (native)
      at String.match (native)
      at Object.exports.roomNameToXY (/opt/engine/dist/utils.js:343:22)
      at Object.findRoute (/opt/engine/dist/game/map.js:91:46)
      at Object.findExit (/opt/engine/dist/game/map.js:236:30)
      at Room.findExitTo (/opt/engine/dist/game/rooms.js:1032:29)
      at Room.wrappedFunction [as findExitTo] (profiler:96:29)
      at RoomPosition.findPathTo (/opt/engine/dist/game/rooms.js:1137:32)
      at RoomPosition.wrappedFunction [as findPathTo] (profiler:96:29)
      at endNodes.objects.forEach.i (/opt/engine/dist/game/rooms.js:1224:93)

      var droppedEnergy = /*creep.room.droppedEnergy ||*/ creep.room.find(FIND_DROPPED_ENERGY, {filter: (source) => source.energy > 0});
      //creep.room.droppedEnergy = droppedEnergy;
      if (!!droppedEnergy.length && !!!sources.length && !!mustFillCarry) {
      sources = _.filter(droppedEnergy, (source) => source.energy > (creep.carryCapacity - creep.carry.energy));
      }
      if (!!droppedEnergy.length && !!!sources.length && !!!mustFillCarry) {
      sources = droppedEnergy;
      }

      var targetSource;
      try {
      targetSource = !!sources.length && creep.pos.findClosestByPath(sources, {maxOps: 2000});
      } catch (err) {
      console.log("role.transport: Error Finding sources: " + sources.length);
      try {
      targetSource = !!sources.length && creep.pos.findClosestByPath([sources[0]], {maxOps: 2000});
      } catch (e) {
      Game.notify("role.tarnsport test" + e.stack);
      console.log("role.transport: 2Error Finding sources: " + e.stack);
      }
      }

      posted in Help
      t3jem
    • RE: RangeError: Maximum call stack size exceeded

      Hernander: I had a bug due to a falsy object evaluating true once that was fixed with !!, I thus sprinkled it everywhere to be safe :/.  Plus, it makes it more exciting ;).

       

      saturn7: I"ve updated my code to try/catch the first findClosestByPath then retry with sources[0].  Once the error occurs again I'll post it here.

       

      cyberblast: That's an interesting find.  I did find the error occurred even when I didn't perform the per-tick cache though 😕 and also for creeps that were in the middle of the room (the last time the burst happened).  I've removed the cache to be safe though and try to repro.

      posted in Help
      t3jem
    • RE: RangeError: Maximum call stack size exceeded

      I ended up tracing the error to the code below.  I'm not sure what I'm doing wrong though :/.  The findClosestByPath call also uses far more than 2CPU (which is default) per call when this error occurs (it's closer to ~25 CPU/call).

       

      var droppedEnergy =
      creep.room.droppedEnergy || creep.room.find(FIND_DROPPED_ENERGY, {filter: (source) => source.energy > 0});
      creep.room.droppedEnergy = droppedEnergy; // Per-tick caching
      if (!!droppedEnergy.length && !!!sources.length && !!mustFillCarry) {
      sources = _.filter(droppedEnergy, (source) => source.energy > (creep.carryCapacity - creep.carry.energy));
      }
      if (!!droppedEnergy.length && !!!sources.length && !!!mustFillCarry) {
      sources = droppedEnergy;
      }

      var targetSource = !!sources.length && creep.pos.findClosestByPath(sources); // Error starts here
      posted in Help
      t3jem
    • Unable to destroy my owned structure in unclaimed room

      I just unclaimed a room in order to claim another more valuable room; however, I'm not able to destroy any of my structures that were left behind (particularly a Spawn and extensions).

      The UI button is missing and using the destroy() function will return OK, but will not actually destroy the Spawn.

      posted in Technical Issues and Bugs
      t3jem
    • RangeError: Maximum call stack size exceeded

      I'm receiving a "RangeError: Maximum call stack size exceeded" from the game code, but the stack trace isn't providing from where in my code it is coming from.  It appears to be occurring when I am navigating between rooms; hwoever, it's not 100% reproducable.

      Has anyone run into this before and know how to avoid it?


      RangeError: Maximum call stack size exceeded
      at RegExp.test (native)
      at Object.findRoute (/opt/engine/dist/game/map.js:87:38)
      at Object.findExit (/opt/engine/dist/game/map.js:236:30)
      at Room.findExitTo (/opt/engine/dist/game/rooms.js:1032:29)
      at Room.wrappedFunction [as findExitTo] (profiler:96:29)
      at RoomPosition.findPathTo (/opt/engine/dist/game/rooms.js:1137:32)
      at RoomPosition.wrappedFunction [as findPathTo] (profiler:96:29)
      at endNodes.objects.forEach.i (/opt/engine/dist/game/rooms.js:1224:93)
      at Array.forEach (native)
      at RoomPosition.findClosestByPath (/opt/engine/dist/game/rooms.js:1221:30)

      posted in Help
      t3jem