renewCreep cost/effectiveness clarification



  • Documentation states these formulas for Spawn.renewCreep:

    Ticks increased by:

    floor(500/body_size)

    Energy cost:

    ceil(creep_cost/3/body_size)

     

    Question: What exactly is body_size here? 


  • SUN

    That's the number of body parts



  • I assumed so.

    After doing some calculating, that would - in theory - put the cost/tick ratio at the exact same spot as for spawning a new creep, and the time it theoretically needs to completely renew the tick from a hypothetical TTL 0 back up to 1500 at the same time it takes to spawn a new one. The only theoretical difference thus is that renewCreep spreads out the cost over the duration of renewing, while spawning a new creep needs the total creep_cost to be present at the start of the process.

    The rounding works to the disadvantage of the player tho since rounding down the ticks and up the costs impacts the efficiency of renewing negatively.

     

    All this put together means: Renewing will always be slightly more expensive and thus less efficient than spawning, and Interrupting a busy creep to send it back to the spawn and renew is incredibly inefficient, especially since you can't wait for it to reach 0. The only advantages I see with renewing is when you renew creeps when they return to the spawn for drop-offs/pickups anyway, since it gives you a bit more reliability.

    This surprises me, since I did the same kind of math for repairing roads vs just rebuilding once they decay, and found building 6 times more expensive than repairing (disregarding decay per use, but that won't make that much of a difference for most use cases). I was expecting the same thing to be true about renewing a creep, making renewing more efficient, but of course requiring a bit more effort to manage than just letting them die and respawn.

    Anyone have additional thoughts on this? Did I miss something?


  • SUN

    You're right, renewCreep() is not a cost-effective alternative of the createCreep() method. And it should not be, imo.

    However, renewCreep() is a great way to prolong life of an existed creep, when respawn is not an option.
    (there are at least 4 cases that can be found here)



  • Just in case someone stumbles across this article:

    The formulas have changed, so that it is now 20% faster to renew a creep than to spawn a new one. The costs are the same. See http://support.screeps.com/hc/en-us/articles/205990342-StructureSpawn#renewCreep 

    I still think it is not worth it (except for special cases as discussed in the thread of neomatrix's link):

    • 20% faster may just compensate for the lost time of traveling back to the spawn point.
    • Another thing to take into account: Requirements for the best configuration of creeps change over time (tend to get bigger of course). So, it is maybe better to just let them die and build new ones with the currently best configuration.
    👏🏻