Building spawn in Simulation
-
I'm trying to build a spawn in Simulation mode, creating some creeps through the customize menu and making them harvest and build.
For some reason the progress on the spawn construction site stops at Progress: 14.9K / 15.0K
Whats even stranger is that the build command returns 0 (OK), but the animation is not displayed.
Can anyone help me?
-
Does your creep have a work and carry body component?
Does it have energy?
Do you have the right target selected?Try printing out everything you're trying to do to console. including the elements your using in the commands like build(). You'll often find something you're assuming to be true is not.
Post code if necessary.
-
Rewrote the code to be as simple as possible. Put this in the main loop:
for(var name in Game.creeps) { var creep = Game.creeps[name]; if(creep.memory.harvest) { var source = creep.pos.findClosestByRange(FIND_SOURCES); if(creep.harvest(source) == ERR_NOT_IN_RANGE) { creep.moveTo(source); } if(creep.carry.energy == creep.carryCapacity) creep.memory.harvest = false; } else { var target = creep.pos.findClosestByRange(FIND_CONSTRUCTION_SITES); var res = creep.build(target); if(res == ERR_NOT_IN_RANGE) { creep.moveTo(target); } else { console.log(res); } if(creep.carry.energy == 0) creep.memory.harvest = true; } }
Run simulation in Custom Mode and set out some sources and a construction site for spawn. Set out some creeps with MOVE, WORK and CARRY.
They will start building and build until they reach 99%. Then it will continue to log 0 (OK) to the console, but no more progress is achieved
-
Print out your results.
console.log(creep.name + ' attempting build on ' + target.name + ' getting build code ' + res);I'm guessing your getting a build code you're not expecting and not handling. Everything looks good.
-
Seems to me like you can't construct the first spawn in simulation.
The log like RaskVann suggested:
[2:48:00 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:01 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:01 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:01 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:01 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:01 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:02 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:02 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:02 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:02 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:03 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:03 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:03 PM]Annabelle attempting build on Spawn1 getting build code 0
[2:48:03 PM]Annabelle attempting build on Spawn1 getting build code 0
-
I didnt think we'd need to go this far but just to make sure try the following log.
console.log(creep.name + ' with energy ' + creep.carry.energy + ' attempting build on ' + target.name + '(' + target.progress + '/' + target.progressTotal + ') getting build code ' + res);
-
[5:29:29 PM]Hudson with energy 800 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:29 PM]Jordan with energy 700 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:29 PM]Mia with energy 125 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:29 PM]Wyatt with energy 650 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:30 PM]Hudson with energy 800 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:30 PM]Jordan with energy 700 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:30 PM]Mia with energy 125 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:30 PM]Wyatt with energy 650 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:31 PM]Hudson with energy 800 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:31 PM]Jordan with energy 700 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:31 PM]Mia with energy 125 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:31 PM]Wyatt with energy 650 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:32 PM]Hudson with energy 800 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:32 PM]Jordan with energy 700 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:32 PM]Mia with energy 125 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:32 PM]Wyatt with energy 650 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:33 PM]Hudson with energy 800 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:33 PM]Jordan with energy 700 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:33 PM]Mia with energy 125 attempting build on Spawn1(14925/15000) getting build code 0
[5:29:33 PM]Wyatt with energy 650 attempting build on Spawn1(14925/15000) getting build code 0
-
You could mess around just to troubleshoot to see if there is a problem depending on the structure attempted. Depending on controller level. Etc. But this looks like a dev problem. Your doing nothing wrong and simulation is bugging out.
-
Thank you for helping me. I'll work around it.