<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How is constant CPU cost applied?]]></title><description><![CDATA[<p>I didn't find any information on this but when exactly is the const CPU cost applied on the function call or only if it is successfully scheduled?</p>
<p>Also only for one action or every call that is possible?</p>
<p>In example for two <code>creep.move()</code> calls on the same creep to change direction in a last minute attempt.</p>
]]></description><link>http://screeps.com/forum/topic/2079/how-is-constant-cpu-cost-applied</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 17:46:18 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/2079.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Jan 2018 10:13:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How is constant CPU cost applied? on Wed, 31 Jan 2018 15:54:21 GMT]]></title><description><![CDATA[<p>I didn't find any information on this but when exactly is the const CPU cost applied on the function call or only if it is successfully scheduled?</p>
<p>Also only for one action or every call that is possible?</p>
<p>In example for two <code>creep.move()</code> calls on the same creep to change direction in a last minute attempt.</p>
]]></description><link>http://screeps.com/forum/post/9386</link><guid isPermaLink="true">http://screeps.com/forum/post/9386</guid><dc:creator><![CDATA[MrFaul]]></dc:creator><pubDate>Wed, 31 Jan 2018 15:54:21 GMT</pubDate></item><item><title><![CDATA[Reply to How is constant CPU cost applied? on Invalid Date]]></title><description><![CDATA[<p>If the function returns OK then you are charged to CONST cpu cost</p>
]]></description><link>http://screeps.com/forum/post/9413</link><guid isPermaLink="true">http://screeps.com/forum/post/9413</guid><dc:creator><![CDATA[starwar15432]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to How is constant CPU cost applied? on Wed, 31 Jan 2018 15:15:56 GMT]]></title><description><![CDATA[<p>So that means:</p>
<pre><code>creep.move(TOP) // blocked -&gt;neglected cost 
creep.move(RIGHT) // possible -&gt; 0.2 cost
// More code something happens
creep.move(DOWN) // possible -&gt; 0.2 cost again
</code></pre>
<p>Right? or did I misunderstood something?</p>
]]></description><link>http://screeps.com/forum/post/9421</link><guid isPermaLink="true">http://screeps.com/forum/post/9421</guid><dc:creator><![CDATA[MrFaul]]></dc:creator><pubDate>Wed, 31 Jan 2018 15:15:56 GMT</pubDate></item><item><title><![CDATA[Reply to How is constant CPU cost applied? on Wed, 31 Jan 2018 15:33:56 GMT]]></title><description><![CDATA[<p>Sounds about right, except that each type of intent will only cost once for each creep. If your creep moves once and changes it mind in the same tick and moves somewhere else the constant cost is only applied for the first move call. In your example above this means that the constant cost will only be applied to <code>creep.move(RIGHT)</code>.</p>
<p>Also keep in mind that multiple creeps trying to move to the same tile, interacting with the same object or conflicting actions will not conflict with each other inside your code, they will both return <code>OK</code> and the constant cost will be applied multiple times, even if only one of those actions is actually executed.</p>
]]></description><link>http://screeps.com/forum/post/9425</link><guid isPermaLink="true">http://screeps.com/forum/post/9425</guid><dc:creator><![CDATA[PostCrafter]]></dc:creator><pubDate>Wed, 31 Jan 2018 15:33:56 GMT</pubDate></item><item><title><![CDATA[Reply to How is constant CPU cost applied? on Invalid Date]]></title><description><![CDATA[<p>Thx for the info.
<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f601.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--grin"
      title=":grin:"
      alt="😁"
    /></p>
]]></description><link>http://screeps.com/forum/post/9427</link><guid isPermaLink="true">http://screeps.com/forum/post/9427</guid><dc:creator><![CDATA[MrFaul]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to How is constant CPU cost applied? on Thu, 01 Feb 2018 07:49:17 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/85">@mrfaul</a> said in <a href="/forum/post/9421">How is constant CPU cost applied?</a>:</p>
<blockquote>
<p>So that means:</p>
<pre><code>creep.move(TOP) // blocked -&gt;neglected cost &lt;&lt;&lt;&lt;&lt;&lt; this is consuming 0.2 anyway as move is returning OK
creep.move(RIGHT) // possible -&gt; 0.2 cost
// More code something happens
creep.move(DOWN) // possible -&gt; 0.2 cost again
</code></pre>
<p>Right? or did I misunderstood something?</p>
</blockquote>
<p>The result of this code is 0.6 CPU used. if you get <code>OK</code> back from the API you will have consumed the CPU.</p>
<p>EDIT:<br />
<strong>I'm wrong</strong>. Looked at the code and it's only 0.2:
<a href="https://github.com/screeps/driver/blob/master/lib/runtime/runtime.js#L148" rel="nofollow">https://github.com/screeps/driver/blob/master/lib/runtime/runtime.js#L148</a></p>
]]></description><link>http://screeps.com/forum/post/9438</link><guid isPermaLink="true">http://screeps.com/forum/post/9438</guid><dc:creator><![CDATA[Dissi]]></dc:creator><pubDate>Thu, 01 Feb 2018 07:49:17 GMT</pubDate></item><item><title><![CDATA[Reply to How is constant CPU cost applied? on Thu, 01 Feb 2018 12:00:18 GMT]]></title><description><![CDATA[<p>Maybe this should somewhere into the CPU limit doc...<br />
Apparently even veterans are slightly confused <img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--joy"
      title=":joy:"
      alt="😂"
    /></p>
]]></description><link>http://screeps.com/forum/post/9443</link><guid isPermaLink="true">http://screeps.com/forum/post/9443</guid><dc:creator><![CDATA[MrFaul]]></dc:creator><pubDate>Thu, 01 Feb 2018 12:00:18 GMT</pubDate></item></channel></rss>