creep.upgradeController() == OK



  • console.log(creep, creep.room.controller, creep.pos.getRangeTo(creep.room.controller), creep.upgradeController(creep.room.controller));
    

    [creep snipper_10] [structure (controller) #5bbcaa9e9099fc012e631ccb] 3 0

    Returns 0, nothing happens. I am absolutely clueless. Any ideas?

    Edit: Tried manually, same result. Also same result in multiple rooms, of two creeps, other one works fine.



  • Hello @Detox,

    could this be related to the simultaneous excecution of creep actions? Does your creep execute build, repair, withdraw, transfer or drop in the same tick?

    If I understand the documentation correctly, then it would fit exactly your described behaviour, because you are getting OK from calling upgradeController, but the actual executed action will be one with higher priority.

    If you try to execute all the dependent methods within one tick, only the most right one will be executed. Each attempt means a correct execution returning the OK result.



  • @murphlaw Sure yeah, but upgradeController() is the only action during tick.

    Also thank you for the reply, was getting walled.

    See &|| test for yourself.

    Creep.prototype.snipper = {};
    Creep.prototype.snipper.run = function(creep){
        if(!creep.respawn()){
            if(creep.slideTo(creep.room.storage.id)){
                if(creep.store.getUsedCapacity() <= creep.getActiveBodyparts(WORK)) creep.withdraw(creep.room.storage, RESOURCE_ENERGY);  // commenting out makes no difference
                if(creep.slideTo(creep.room.controller.id, 3)){ 
                    //console.log(creep, creep.room.controller, creep.pos.getRangeTo(creep.room.controller), creep.upgradeController(creep.room.controller));
                    creep.upgradeController(creep.room.controller);
                }
            }
        }
    }
    


  • It would have helped if you indicated what room that was. But no problem, I found it.

    Once a room is level 8, you can only use 15 WORK to upgrade it's controller. Trying to do more will return 0 for the intent, but not do what you want. The 32 WORK upgraders you were using simply weren't going to fly. Likewise, if there are 2 creeps and the first creep upgrades 15 worth of WORK, the second will return O and do absolutely nothing.



  • @murphlaw said in creep.upgradeController() == OK:

    Anything that can go wrong, will go wrong.

    So I decided to comment out everything else, except upgradeController(), what happened was, execution changed from creep_1 to creep_2.

    My thoughts exactly: constructionSite Edit: Is still valid, the 15 per tick could || should be increased, for || to me my storages are filled with energy, although my Game.market.orders prices are costly. Gave it a thought that maybe I should lower prices, but then again what is low.



  • @smokeman said in creep.upgradeController() == OK:

    It would have helped if you indicated what room that was. But no problem, I found it.

    Once a room is level 8, you can only use 15 WORK to upgrade it's controller. Trying to do more will return 0 for the intent, but not do what you want. The 32 WORK upgraders you were using simply weren't going to fly. Likewise, if there are 2 creeps and the first creep upgrades 15 worth of WORK, the second will return O and do absolutely nothing.

    You're most likely right.

    upgradeController()

    15 energy units per tick regardless of creeps

    To me the sentence structure is slightly &|| highly misleading, the return could be a little more notifying once you reach a level 8 controller. Been puzzling me for weeks. 🤳🏻 😷 👍

    Can i get a confirmation from an administrator?



  • @detox The only actually erroneous part in the upgrade controller text is: "This limit can be increased by using ghodium mineral boost." This alludes to a pre-alpha power creep concept. The actually implemented power creep ability is the Operator's "OPERATE_CONTROLLER" power which uses the "ops" resource.

    But irrespective to that, yes. 15 is the normal cap for a level 8 room. And yes, "0" will be returned from the call because it was a perfectly legal call that returned no error in that it's the CUMULATIVE amount that is eventually checked... this is beyond the purview of the intent system to test for.



  • If it helps at all this is the intent for upgrade controller: https://github.com/screeps/engine/blob/master/src/processor/intents/creeps/upgradeController.js

    It has a special case for 'if RCL 8'

    if(target.level == 8) {
            var limit = C.CONTROLLER_MAX_UPGRADE_PER_TICK;
            var effect = _.find(target.effects, {power: C.PWR_OPERATE_CONTROLLER});
            if(effect && effect.endTime >= gameTime) {
                limit += C.POWER_INFO[C.PWR_OPERATE_CONTROLLER].effect[effect.level-1];
            }
            if(target._upgraded >= limit) {
                return;
            }
            buildEffect = Math.min(buildEffect, limit - target._upgraded);
        }
    

    Ghodium hydride and its OH/X later boosts can increase how much 'upgrade' you do, without increasing energy cost. So 'maybe' if you had a 14W single creep w/ a boost it could go over the 15 cap? That might be what was meant by the increased limit, as smokeman said, (and noted by effect in the RCL 8 snippet there) power-creeps can increase this limit.

    To be clear, returning at this point (in the intent) means you got an OK (intent was generated), but nothing happens (as it returns before changing anything) if your over the limit. This can happen with a few different intents such as a tower executing a repair on an item already being repaired to full by another creep/tower, or a move command into a wall. Their valid intents, but return in the intent causing no change.

    Side note: If your looking to get more GCL, and have a GCL free to spare. a "GCL Temple" is a common tactic to gain more GCL more rapidly.

    https://wiki.screepspl.us/index.php/GCL_temple

    *edited PS: Sorry to hear this has been going on for weeks, would recommend if you haven't trying Screep's Slack, its a bit more dynamic and generally more rapid response than the forums.



  • @smokeman said in creep.upgradeController() == OK:

    @detox The only actually erroneous part in the upgrade controller text is: "This limit can be increased by using ghodium mineral boost." This alludes to a pre-alpha power creep concept. The actually implemented power creep ability is the Operator's "OPERATE_CONTROLLER" power which uses the "ops" resource.

    But irrespective to that, yes. 15 is the normal cap for a level 8 room. And yes, "0" will be returned from the call because it was a perfectly legal call that returned no error in that it's the CUMULATIVE amount that is eventually checked... this is beyond the purview of the intent system to test for.

    These are things which are yet for me to discover, but I would like an elaboration &|| script.example for:

    pre-alpha power creep concept

    @donatzor said in creep.upgradeController() == OK:

    If it helps at all this is the intent for upgrade controller: https://github.com/screeps/engine/blob/master/src/processor/intents/creeps/upgradeController.js

    It has a special case for 'if RCL 8'

    if(target.level == 8) {
            var limit = C.CONTROLLER_MAX_UPGRADE_PER_TICK;
            var effect = _.find(target.effects, {power: C.PWR_OPERATE_CONTROLLER});
            if(effect && effect.endTime >= gameTime) {
                limit += C.POWER_INFO[C.PWR_OPERATE_CONTROLLER].effect[effect.level-1];
            }
            if(target._upgraded >= limit) {
                return;
            }
            buildEffect = Math.min(buildEffect, limit - target._upgraded);
        }
    

    Ghodium hydride and its OH/X later boosts can increase how much 'upgrade' you do, without increasing energy cost. So 'maybe' if you had a 14W single creep w/ a boost it could go over the 15 cap? That might be what was meant by the increased limit, as smokeman said, (and noted by effect in the RCL 8 snippet there) power-creeps can increase this limit.

    To be clear, returning at this point (in the intent) means you got an OK (intent was generated), but nothing happens (as it returns before changing anything) if your over the limit. This can happen with a few different intents such as a tower executing a repair on an item already being repaired to full by another creep/tower, or a move command into a wall. Their valid intents, but return in the intent causing no change.

    Side note: If your looking to get more GCL, and have a GCL free to spare. a "GCL Temple" is a common tactic to gain more GCL more rapidly.

    https://wiki.screepspl.us/index.php/GCL_temple

    *edited PS: Sorry to hear this has been going on for weeks, would recommend if you haven't trying Screep's Slack, its a bit more dynamic and generally more rapid response than the forums.

    These are also things for me yet to discover, but i'll give you a 👏 right there.

    I'd add more to the discussion, but my experiences so far are yet fairly limited, the 20 CPU limit is more || less limiting me, but the temple concept (although, the 15 limit also applies in this case (edit: == +-0 for level 8 rooms) is certainly an idea (edit: too late, most rooms at level 8) for me to implement. Which, most likely would save me some(...1-3~) CPU.

    Side question: How do i underline?



  • @donatzor said in creep.upgradeController() == OK:

    Ghodium hydride and its OH/X later boosts can increase how much 'upgrade' you do, without increasing energy cost. So 'maybe' if you had a 14W single creep w/ a boost it could go over the 15 cap? That might be what was meant by the increased limit, as smokeman said, (and noted by effect in the RCL 8 snippet there) power-creeps can increase this limit.

    The 15 e/t cap is strictly on the amount of energy put into the controller, before any applied boosts. So if you're putting 14 e/t with boosts on one creep, you can only put in additional 1 e/t regardless of boosts.

    And yes, there are now power creeps that can raise this cap.

    @detox said in creep.upgradeController() == OK:

    Side question: How do i underline?

    You can't underline in markdown (which is what the forum uses).



  • @orlet said in creep.upgradeController() == OK:

    @detox said in creep.upgradeController() == OK:

    Side question: How do i underline?

    You can't underline in markdown (which is what the forum uses).

    How unfortunate, bolding doesn't really give the same idea as underlining. Oh well.