<?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[PTR Changelog 2017-09-25: WebAssembly support]]></title><description><![CDATA[<p><em>This post describes changes on the <a href="http://docs.screeps.com/ptr.html" rel="nofollow">Public Test Realm</a>. The estimated launch date is December 14.</em></p>
<p>Enabled experimental WebAssembly support. <a href="http://webassembly.org/" rel="nofollow">WebAssembly</a> is a binary compiled code format that allows to run C/C++ or Rust code (as well as other supported languages in the future) directly with native performance. Please refer to the <a href="https://developer.mozilla.org/en-US/docs/WebAssembly" rel="nofollow">WebAssembly documentation</a> for more info.</p>
<p><strong>This is an experimental feature.</strong> We need your feedback in order to decide if it worth it. Please share your experience of what you were able to build using WebAssembly.</p>
<h1>Example</h1>
<p>Here is a short example of how to compile C/C++ code using <a href="https://kripken.github.io/emscripten-site/index.html" rel="nofollow">Emscripten</a> and upload the binary file to Screeps.</p>
<h2>Build <code>.wasm</code> file</h2>
<p><em>You can skip this step if you use an already compiled <code>.wasm</code> file from the web.</em></p>
<p>Install Emsripten SDK using <a href="https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html#sdk-installation-instructions" rel="nofollow">these instructions</a>.</p>
<p>Write your native C function and save it as <code>addTwo.c</code> file:</p>
<pre><code class="language-c++">int addTwo(int a, int b) {
    return a + b;
}
</code></pre>
<p>Compile it to <code>addTwo.wasm</code> using this command:</p>
<pre><code>emcc -s WASM=1 -s SIDE_MODULE=1 -O3 addTwo.c -o addTwo.wasm
</code></pre>
<h2>Upload binary module</h2>
<details>
<summary><b>Using the in-game IDE</b></summary>
<p>Add a new module <code>addTwo</code> with binary type using this switch:</p>
<p><img src="/forum/assets/uploads/files/1512465738462-chrome_2017-12-05_12-21-33.png" alt="0_1512465735539_chrome_2017-12-05_12-21-33.png" class="img-responsive img-markdown" /></p>
<p>Upload your <code>addTwo.wasm</code> file as binary module contents, so that it looks as follows:</p>
<p><img src="/forum/assets/uploads/files/1512464134406-chrome_2017-12-05_11-52-18.png" alt="0_1512464131501_chrome_2017-12-05_11-52-18.png" class="img-responsive img-markdown" /></p>
<p>Click the <img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/2714.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--heavy_check_mark"
      title=":heavy_check_mark:"
      alt="✔"
    />️ button to commit your modules.</p>
</details>
<details>
<summary><b>Using <a href="https://github.com/screeps/grunt-screeps">grunt-screeps</a></b></summary>
<p>Switch your <code>grunt-screeps</code> to the <code>binary-upload</code> branch on GitHub:</p>
<pre><code>npm install screeps/grunt-screeps#binary-upload
</code></pre>
<p>Now all files with extensions other than <code>.js</code> will be uploaded as binary. Copy your <code>addTwo.wasm</code> file to your upload folder and modify the <code>Gruntfile.js</code> so that it includes <code>.wasm</code> files as well:</p>
<pre><code class="language-javascript">module.exports = function(grunt) {

    grunt.loadNpmTasks('grunt-screeps');

    grunt.initConfig({
        screeps: {
            options: {
                email: 'YOUR_EMAIL',
                password: 'YOUR_PASSWORD',
                branch: 'default',
                ptr: true
            },
            dist: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist/',
                        src: ['**/*.{js,wasm}'],  // &lt;----
                        flatten: true
                    }
                ]
            }
        }
    });
}
</code></pre>
<p>Run <code>grunt screeps</code> to commit your modules.</p>
</details>
<h2>Run your native module in Screeps</h2>
<p>If you uploaded your binary module correctly, you should see the following in your in-game IDE:</p>
<p><img src="/forum/assets/uploads/files/1506332806436-chrome_2017-09-25_12-46-19.png" alt="0_1506332804337_chrome_2017-09-25_12-46-19.png" class="img-responsive img-markdown" /></p>
<p>Now you can use the following code to run your imported binary code in <code>main</code> using WebAssembly API:</p>
<pre><code class="language-javascript">// This will return an ArrayBuffer with `addTwo.wasm` binary contents
const bytecode = require('addTwo');

const wasmModule = new WebAssembly.Module(bytecode);

const imports = {};

// Some predefined environment for Emscripten
imports.env = {
    memoryBase: 0,
    tableBase: 0,
    memory: new WebAssembly.Memory({ initial: 256 }),
    table: new WebAssembly.Table({ initial: 0, element: 'anyfunc' })    
};

const wasmInstance = new WebAssembly.Instance(wasmModule, imports);

console.log(wasmInstance.exports._addTwo(2,3));
</code></pre>
]]></description><link>http://screeps.com/forum/topic/1945/ptr-changelog-2017-09-25-webassembly-support</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 12:43:36 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/1945.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Sep 2017 10:17:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Tue, 05 Dec 2017 09:32:54 GMT]]></title><description><![CDATA[<p><em>This post describes changes on the <a href="http://docs.screeps.com/ptr.html" rel="nofollow">Public Test Realm</a>. The estimated launch date is December 14.</em></p>
<p>Enabled experimental WebAssembly support. <a href="http://webassembly.org/" rel="nofollow">WebAssembly</a> is a binary compiled code format that allows to run C/C++ or Rust code (as well as other supported languages in the future) directly with native performance. Please refer to the <a href="https://developer.mozilla.org/en-US/docs/WebAssembly" rel="nofollow">WebAssembly documentation</a> for more info.</p>
<p><strong>This is an experimental feature.</strong> We need your feedback in order to decide if it worth it. Please share your experience of what you were able to build using WebAssembly.</p>
<h1>Example</h1>
<p>Here is a short example of how to compile C/C++ code using <a href="https://kripken.github.io/emscripten-site/index.html" rel="nofollow">Emscripten</a> and upload the binary file to Screeps.</p>
<h2>Build <code>.wasm</code> file</h2>
<p><em>You can skip this step if you use an already compiled <code>.wasm</code> file from the web.</em></p>
<p>Install Emsripten SDK using <a href="https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html#sdk-installation-instructions" rel="nofollow">these instructions</a>.</p>
<p>Write your native C function and save it as <code>addTwo.c</code> file:</p>
<pre><code class="language-c++">int addTwo(int a, int b) {
    return a + b;
}
</code></pre>
<p>Compile it to <code>addTwo.wasm</code> using this command:</p>
<pre><code>emcc -s WASM=1 -s SIDE_MODULE=1 -O3 addTwo.c -o addTwo.wasm
</code></pre>
<h2>Upload binary module</h2>
<details>
<summary><b>Using the in-game IDE</b></summary>
<p>Add a new module <code>addTwo</code> with binary type using this switch:</p>
<p><img src="/forum/assets/uploads/files/1512465738462-chrome_2017-12-05_12-21-33.png" alt="0_1512465735539_chrome_2017-12-05_12-21-33.png" class="img-responsive img-markdown" /></p>
<p>Upload your <code>addTwo.wasm</code> file as binary module contents, so that it looks as follows:</p>
<p><img src="/forum/assets/uploads/files/1512464134406-chrome_2017-12-05_11-52-18.png" alt="0_1512464131501_chrome_2017-12-05_11-52-18.png" class="img-responsive img-markdown" /></p>
<p>Click the <img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/2714.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--heavy_check_mark"
      title=":heavy_check_mark:"
      alt="✔"
    />️ button to commit your modules.</p>
</details>
<details>
<summary><b>Using <a href="https://github.com/screeps/grunt-screeps">grunt-screeps</a></b></summary>
<p>Switch your <code>grunt-screeps</code> to the <code>binary-upload</code> branch on GitHub:</p>
<pre><code>npm install screeps/grunt-screeps#binary-upload
</code></pre>
<p>Now all files with extensions other than <code>.js</code> will be uploaded as binary. Copy your <code>addTwo.wasm</code> file to your upload folder and modify the <code>Gruntfile.js</code> so that it includes <code>.wasm</code> files as well:</p>
<pre><code class="language-javascript">module.exports = function(grunt) {

    grunt.loadNpmTasks('grunt-screeps');

    grunt.initConfig({
        screeps: {
            options: {
                email: 'YOUR_EMAIL',
                password: 'YOUR_PASSWORD',
                branch: 'default',
                ptr: true
            },
            dist: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist/',
                        src: ['**/*.{js,wasm}'],  // &lt;----
                        flatten: true
                    }
                ]
            }
        }
    });
}
</code></pre>
<p>Run <code>grunt screeps</code> to commit your modules.</p>
</details>
<h2>Run your native module in Screeps</h2>
<p>If you uploaded your binary module correctly, you should see the following in your in-game IDE:</p>
<p><img src="/forum/assets/uploads/files/1506332806436-chrome_2017-09-25_12-46-19.png" alt="0_1506332804337_chrome_2017-09-25_12-46-19.png" class="img-responsive img-markdown" /></p>
<p>Now you can use the following code to run your imported binary code in <code>main</code> using WebAssembly API:</p>
<pre><code class="language-javascript">// This will return an ArrayBuffer with `addTwo.wasm` binary contents
const bytecode = require('addTwo');

const wasmModule = new WebAssembly.Module(bytecode);

const imports = {};

// Some predefined environment for Emscripten
imports.env = {
    memoryBase: 0,
    tableBase: 0,
    memory: new WebAssembly.Memory({ initial: 256 }),
    table: new WebAssembly.Table({ initial: 0, element: 'anyfunc' })    
};

const wasmInstance = new WebAssembly.Instance(wasmModule, imports);

console.log(wasmInstance.exports._addTwo(2,3));
</code></pre>
]]></description><link>http://screeps.com/forum/post/8464</link><guid isPermaLink="true">http://screeps.com/forum/post/8464</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Tue, 05 Dec 2017 09:32:54 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Mon, 25 Sep 2017 12:39:14 GMT]]></title><description><![CDATA[<p>This is incredibly awesome feature! Some questions:</p>
<ul>
<li>What is it actually aimed at? Is performance of native modules the main reason? Or, is it a next step of virtualization reworking?</li>
<li>How will CPU consuming be counted while using native modules? And what about exception and hard-interruption points in case of CPU-, stack- or heap- overflows?</li>
<li>Are any <code>NATIVE &lt;=&gt; GAME</code> APIs planned? Alternatively, will users be able to use raw <code>WA &lt;=&gt; JS</code> APIs (memory mappings, pointers sharing etc.)?</li>
<li>As I remember, promises (and other async stuff) aren't handled correctly for now by game engine: is it guaranteed that native module loading will be consistent (no resets until new file will be uploaded, for example)?</li>
</ul>
<p>Being a cpp developer and being faced some time ago with WA projects, I assume that WA introducing is really, REALLY hard and breaking change for run-time environment (new APIs, new bugs, new non-portabilities, suddenly new vulnerabilities -- hello native LLVM!), I just wanna wish good luck and make sure such a useful and powerful feature will be implemented with such a close attention as previous roadmap implemented features.</p>
]]></description><link>http://screeps.com/forum/post/8466</link><guid isPermaLink="true">http://screeps.com/forum/post/8466</guid><dc:creator><![CDATA[Mototroller]]></dc:creator><pubDate>Mon, 25 Sep 2017 12:39:14 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>I played with WASM a bit when they did the node 8 test, from my experience, we will be able to use full JS &lt;--&gt; WASM APIs, binary support actually makes that easier than before, I had to encode the binary data in base64 then decode it into an ArrayBuffer myself. I'm sure someone in the community will write bindings between the two API sets, I for one look forward to using WASM for all my binary manipulation stuff, such as packing paths and distance transforms.</p>
]]></description><link>http://screeps.com/forum/post/8467</link><guid isPermaLink="true">http://screeps.com/forum/post/8467</guid><dc:creator><![CDATA[ags131]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/43">@mototroller</a></p>
<blockquote>
<p>What is it actually aimed at? Is performance of native modules the main reason? Or, is it a next step of virtualization reworking?</p>
</blockquote>
<p>It's an option to write critical code natively to increase your script's performance.</p>
<blockquote>
<p>How will CPU consuming be counted while using native modules? And what about exception and hard-interruption points in case of CPU-, stack- or heap- overflows?</p>
</blockquote>
<p>Everything remains the same, all WebAssembly manipulations are done within your regular VM environment.</p>
<blockquote>
<p>Are any NATIVE &lt;=&gt; GAME APIs planned?</p>
</blockquote>
<p>Not officially, but it's an interesting vacant area for community projects.</p>
<blockquote>
<p>Alternatively, will users be able to use raw WA &lt;=&gt; JS APIs (memory mappings, pointers sharing etc.)?</p>
</blockquote>
<p>All APIs in the <code>WebAssembly</code> namespace are exposed to the user space in full.</p>
<blockquote>
<p>As I remember, promises (and other async stuff) aren't handled correctly for now by game engine: is it guaranteed that native module loading will be consistent (no resets until new file will be uploaded, for example)?</p>
</blockquote>
<p>Using async API is not mandatory. The example above is already changed to the synchronous instantiation.</p>
<blockquote>
<p>Being a cpp developer and being faced some time ago with WA projects, I assume that WA introducing is really, REALLY hard and breaking change for run-time environment (new APIs, new bugs, new non-portabilities, suddenly new vulnerabilities -- hello native LLVM!), I just wanna wish good luck and make sure such a useful and powerful feature will be implemented with such a close attention as previous roadmap implemented features.</p>
</blockquote>
<p>Actually, <code>WebAssembly</code> object is exposed by default on Node 8.x, so I don't think it is really that breaking.</p>
]]></description><link>http://screeps.com/forum/post/8468</link><guid isPermaLink="true">http://screeps.com/forum/post/8468</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Mon, 25 Sep 2017 15:34:02 GMT]]></title><description><![CDATA[<blockquote>
<p>Please share your experience of what you were able to build using WebAssembly.</p>
</blockquote>
<p>Sorry, missed the request. Some words about WA experience:</p>
<p>Being inspired by Screeps, I was looking for a <em>scalable</em>, <em>high performance</em> and <em>virtualization-friendly</em> solution for Screeps-like AI environment. The candidates were Lua (provides high performance virtual machine and a simple script language) and WA (extremely high performance + built-in virtualization by design). Well, Python should be mentioned here: it's very difficult to build a bulletproof VM for it, and its performance without dirty hacks is really bad. I realized that Lua is not popular enough to be a main language for AI describing and developing, so WA was chosen.</p>
<p>There were several underwater rocks while implementing scalable architecture of shared AI sandboxes:</p>
<ul>
<li>It was difficult to find a compromise between API flexibility, performance and environment restrictions (&quot;Game map as a shrared mmaped raw memory? Awesome, but memory protection? Map updates? Synchronization?&quot;)</li>
<li>For now it's still not very comfortable to perform IPC with WA (message queue layer was written as dirty mix of WA API, JS and native C++ -- this layer and its endpoints seems for me overcomplicated, but all the workarounds are using pretty same API calls, and I've found the performance of portable robust solution is not very nice due to tons of unnecessary memory copying). Memory mapping and sharing (<code>mmap</code> or <code>shmem</code> etc.) are sometimes broken due to unexpected Node or WA restrictions.</li>
<li>Due to environment restrictions, it's very difficult to debug native modules or write correct test suits. Moreover, I'm not sure about C++11 exception support by WA nowadays. So, it's extremely easy to hang or drop native module... <strong>or even write a malicious code due to leaky Node + WA API and permissions vulnerabilities</strong> -- it still seems not safe enough.</li>
</ul>
<p>Because of points mentioned above, I've found WA modules are very useful for &quot;dense&quot; computational (some difficult algorithmic code <strong>with few inputs and outputs</strong>), but not flexible enough to be a full replacement of JS in most egine's cases despite on performance benefits. For now my project is frozen, but I've got tons of experience, and gonna return to it later with new vision and experience (and may be some followers:).</p>
<hr />
<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a>: Thank you for reply!</p>
<blockquote>
<p>It's an option to write critical code natively to increase your script's performance.</p>
</blockquote>
<p>Nice idea, imho. Endpoints and synchronization problems are still difficult (see above), but it can really increase performance.</p>
<blockquote>
<p>All APIs in the <code>WebAssembly</code> namespace are exposed to the user space in full.</p>
</blockquote>
<p>It's a disputable point due to safety problems, but still nice for beginning. <em>Offtop</em>: Screeps community is really very nice here to not to abuse or even looking for vulnerabilities, and report them:)</p>
<blockquote>
<p>Actually, <code>WebAssembly</code> object is exposed by default on Node 8.x, so I don't think it is really that breaking.</p>
</blockquote>
<p>Oh, it's nice, but I'm mostly about safety underwater rocks (and, as you pointed out, about rewriting critical code).</p>
]]></description><link>http://screeps.com/forum/post/8469</link><guid isPermaLink="true">http://screeps.com/forum/post/8469</guid><dc:creator><![CDATA[Mototroller]]></dc:creator><pubDate>Mon, 25 Sep 2017 15:34:02 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>I've been testing with wasm and so it seems to perform very well, I'm not sure of the memory usage, but overall CPU usage tends to be less than similar JS code, even with the calls back into JS space. My current testing code is on <a href="https://github.com/ags131/screeps-cpp" rel="nofollow">GitHub</a>, it uses a different approach than the guide above and handles much more of the marshaling of types and helps deal with pointers and such. With this, I'm easily able to spawn and random move over 300 creeps with almost no overhead. If this ends up being available, I wouldn't want to switch all my code over to it, I'm not a C++ guy, but I would implement the more computationally intensive tasks in C++ to reduce CPU. Stuff like distance transform, skeletonization, layout planning, path compression, this can all be done in C++ and reduce overall CPU required.</p>
]]></description><link>http://screeps.com/forum/post/8475</link><guid isPermaLink="true">http://screeps.com/forum/post/8475</guid><dc:creator><![CDATA[ags131]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>I'll give it a try now.</p>
<p>I wonder if webassambly could not only be used in the user side of code ... but maybe also make some of the server code faster ?</p>
]]></description><link>http://screeps.com/forum/post/8479</link><guid isPermaLink="true">http://screeps.com/forum/post/8479</guid><dc:creator><![CDATA[W4rl0ck]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>Nice, this is definitely something I would use if it ever makes it in. Finally my work experience apply to something that matters! <img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>WebAssembly says it does or will eventually support pthreads, OpenGL and other system libraries. Will those be available in screeps and how would pthreads for example impact CPU usage? (haven't had a chance to actually try it on PTR yet)</p>
<p>Would .wasm file size would count against max script size I assume?</p>
]]></description><link>http://screeps.com/forum/post/8486</link><guid isPermaLink="true">http://screeps.com/forum/post/8486</guid><dc:creator><![CDATA[UnFleshedOne]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/45">@unfleshedone</a></p>
<blockquote>
<p>WebAssembly says it does or will eventually support pthreads, OpenGL and other system libraries. Will those be available in screeps and how would pthreads for example impact CPU usage? (haven't had a chance to actually try it on PTR yet)</p>
</blockquote>
<p>All WebAssemply features should backed by Node.js to be supported in Screeps. OpenGL, obviously, doesn't make any sense. pthreads would require Web Workers AFAIK, and it is not supported in Node.js since they are designed for browsers, and Node.js is single-threaded.</p>
<blockquote>
<p>Would .wasm file size would count against max script size I assume?</p>
</blockquote>
<p>Yes, they are stored in the same storage in base64 format (approximately 4/3 of the original binary size).</p>
]]></description><link>http://screeps.com/forum/post/8489</link><guid isPermaLink="true">http://screeps.com/forum/post/8489</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Thu, 28 Sep 2017 16:03:06 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a> OpenGL might make sense actually -- rendering room map to a texture, running shaders on it (I'm sure many image processing and computer vision algorithms can be done this way) then exposing resulting texture to the main script. Shared tenancy on GPU might be a problem though.</p>
<p>(Not that I'm saying we need openGL support, but that people will try to use it if it is available, and that's another resource that will need to be charged to CPU)</p>
]]></description><link>http://screeps.com/forum/post/8504</link><guid isPermaLink="true">http://screeps.com/forum/post/8504</guid><dc:creator><![CDATA[UnFleshedOne]]></dc:creator><pubDate>Thu, 28 Sep 2017 16:03:06 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Thu, 28 Sep 2017 19:44:23 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/45">@unfleshedone</a> OpenGL doesn't make sense merely due to the absence of GPU on our runtime servers.</p>
]]></description><link>http://screeps.com/forum/post/8507</link><guid isPermaLink="true">http://screeps.com/forum/post/8507</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Thu, 28 Sep 2017 19:44:23 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Mon, 02 Oct 2017 14:51:28 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a>: halp, <code>require('binary')</code> seems to be broken since last PTR patch or smth other update?</p>
<p><code>const binary = require('bytecode_file')</code> causes following error:</p>
<pre><code>wasm:1
(function __module(module,exports){ [object Object]
                                            ^^^^^^
SyntaxError: Unexpected identifier
    at main:12:17
    at sigintHandlersWrap (vm.js:92:15)
    at ContextifyScript.Script.runInContext (vm.js:50:12)
</code></pre>
<p>I just finished lzw native implementation+porting and gonna try it inside screeps, but got an error.</p>
<p><strong><em>BTW: please, don't disable WASM on PTR at least for now</em></strong>. For example, I'm working on <em>proof-of-concepts</em> and gonna release some API and Emscripten bindings examples and tested production tools (such as native lzw en/decoder) soon this week, so I think it will be easier for community to start working with WASM after giving of some complete examples and utilities.</p>
]]></description><link>http://screeps.com/forum/post/8547</link><guid isPermaLink="true">http://screeps.com/forum/post/8547</guid><dc:creator><![CDATA[Mototroller]]></dc:creator><pubDate>Mon, 02 Oct 2017 14:51:28 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/43">@mototroller</a> Should be fixed now.</p>
]]></description><link>http://screeps.com/forum/post/8558</link><guid isPermaLink="true">http://screeps.com/forum/post/8558</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a>: yep, awesome, thanks!</p>
]]></description><link>http://screeps.com/forum/post/8559</link><guid isPermaLink="true">http://screeps.com/forum/post/8559</guid><dc:creator><![CDATA[Mototroller]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>rust has now a direct wasm build target : <a href="https://www.hellorust.com/news/native-wasm-target.html" rel="nofollow">https://www.hellorust.com/news/native-wasm-target.html</a></p>
]]></description><link>http://screeps.com/forum/post/8933</link><guid isPermaLink="true">http://screeps.com/forum/post/8933</guid><dc:creator><![CDATA[W4rl0ck]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Tue, 05 Dec 2017 09:33:06 GMT]]></title><description><![CDATA[<p>Added binary upload support to the in-game IDE:</p>
<p><img src="https://screeps.com/forum/assets/uploads/files/1512465738462-chrome_2017-12-05_12-21-33.png" alt="" class="img-responsive img-markdown" /> <img src="https://screeps.com/forum/assets/uploads/files/1512464134406-chrome_2017-12-05_11-52-18.png" alt="" class="img-responsive img-markdown" /></p>
<p><strong>This change will be deployed to live servers on December 14 along with upgrade to Node.js 8.</strong></p>
]]></description><link>http://screeps.com/forum/post/9002</link><guid isPermaLink="true">http://screeps.com/forum/post/9002</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Tue, 05 Dec 2017 09:33:06 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a></p>
<p>Yay. Now I need to know two languages to play this game well.</p>
<p>Really, what is the goal here?</p>
<p>All this does is make it incredibly painful to figure out how to write a performant AI using a bunch of undocumented features. Great.</p>
<p>Can we get back to making the actual game better?</p>
]]></description><link>http://screeps.com/forum/post/9014</link><guid isPermaLink="true">http://screeps.com/forum/post/9014</guid><dc:creator><![CDATA[shedletsky]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Wed, 06 Dec 2017 07:55:16 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/56">@shedletsky</a> You don't <em>need</em> to know other languages, you are <em>able</em> to use them, that's a big difference. JavaScript is performant enough if used properly. But now you have a choice.</p>
<p>Supporting WebAssembly is just a side effect of upgrading to Node.js 8, which is inevitable since 8.x branch is now LTS (Long Term Support). WebAssembly is a new standard that is widely adopted in JavaScript world, it's not strictly related to C++, you can compile Rust or something else to it, and more languages will be supported soon. This way Screeps can (at last!) enable support of different languages besides JavaScript, and it's actually a good thing, it extends possible target audience. But you surely are not obliged to learn all these (potentially dozens of them) supported languages and are free to choose any particular language you like.</p>
<p>I would say that supporting WebAssembly and other languages through it may potentially become the biggest thing &quot;making the actual game better&quot;.</p>
]]></description><link>http://screeps.com/forum/post/9015</link><guid isPermaLink="true">http://screeps.com/forum/post/9015</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Wed, 06 Dec 2017 07:55:16 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>The webassembly changes are awesome.</p>
<p>I have a feeling not a lot of people are going to be programming their code directly in other languages, but I can see people building libraries for improved speed. <a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/43">@Mototroller</a> has already started an <a href="https://github.com/screepers/cppreeps" rel="nofollow">open source webasm</a> project, and I can imagine more are coming.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a>, I know this probably isn't setup yet but will there be a way to incorporate webassembly in open source bots? I can compile before pushing to NPM so that isn't an issue, but it would be great if we could include these libraries.</p>
]]></description><link>http://screeps.com/forum/post/9018</link><guid isPermaLink="true">http://screeps.com/forum/post/9018</guid><dc:creator><![CDATA[tedivm]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/8">@tedivm</a> What do you think would prevent you from doing that? You can include both <code>.wasm</code> files and their sources with instructions how to compile them.</p>
]]></description><link>http://screeps.com/forum/post/9020</link><guid isPermaLink="true">http://screeps.com/forum/post/9020</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Thu, 07 Dec 2017 17:06:14 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a> but once they're compiled what do we do with them? Can we just leave the compiled binaries alongside the regular code and expect it to work?</p>
<p>I think my confusion was that previous (I thought) they had to be uploaded to a separate branch, but it looks like that's no longer the case.</p>
]]></description><link>http://screeps.com/forum/post/9024</link><guid isPermaLink="true">http://screeps.com/forum/post/9024</guid><dc:creator><![CDATA[tedivm]]></dc:creator><pubDate>Thu, 07 Dec 2017 17:06:14 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Thu, 07 Dec 2017 20:09:33 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/8">@tedivm</a> I lost you here, why they have to be uploaded to a separate branch? They are plain binary files which are uploaded to binary Screeps modules via either in-game IDE, grunt-screeps or Steam client. Like in the example above, you have:</p>
<pre><code>dist/
  main.js
  addTwo.wasm
</code></pre>
<p>This corresponds to Screeps modules:
<img src="/forum/assets/uploads/files/1506332806436-chrome_2017-09-25_12-46-19.png" alt="0_1506332804337_chrome_2017-09-25_12-46-19.png" class="img-responsive img-markdown" /></p>
]]></description><link>http://screeps.com/forum/post/9025</link><guid isPermaLink="true">http://screeps.com/forum/post/9025</guid><dc:creator><![CDATA[artch]]></dc:creator><pubDate>Thu, 07 Dec 2017 20:09:33 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Thu, 07 Dec 2017 20:33:49 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/3">@artch</a> thanks for clarifying. I had misread this-</p>
<p><img src="/forum/assets/uploads/files/1512678780888-screen-shot-2017-12-07-at-12.32.27-pm-resized.png" alt="0_1512678788663_Screen Shot 2017-12-07 at 12.32.27 PM.png" class="img-responsive img-markdown" /></p>
<p>and thought we were uploading binaries to a separate branch on screeps. What you're saying makes for more sense.</p>
]]></description><link>http://screeps.com/forum/post/9026</link><guid isPermaLink="true">http://screeps.com/forum/post/9026</guid><dc:creator><![CDATA[tedivm]]></dc:creator><pubDate>Thu, 07 Dec 2017 20:33:49 GMT</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/43">@mototroller</a> said in <a href="/forum/post/8469">PTR Changelog 2017-09-25: WebAssembly support</a>:</p>
<blockquote>
<p>Being inspired by Screeps, I was looking for a <em>scalable</em>, <em>high performance</em> and <em>virtualization-friendly</em> solution for Screeps-like AI environment. The candidates were Lua (provides high performance virtual machine and a simple script language) and WA (extremely high performance + built-in virtualization by design).</p>
</blockquote>
<p>I've been in a similar situation recently and when evaluating WA vs Lua I decided for Lua.</p>
<p>WA is definitely a big thing, but in it's current state you are in for a lot of trouble. Even if you ignore security risks - and since this thing is basically still alpha you actually really shouldn't - the issues when trying to get a project done with WA are currently too excessive. Eventually WA will become a reasonable alternative, but that's something far in the future.</p>
<p>The main issue with WA is error handling. Even the best programmer will eventually make a mistake, and at this point you need good debugging and logging to find and fix it. WA makes debugging a nightmare. All tools you are used to from JS debugging will not function, and also all tools you might be used to from C/C++ developing will not function either. You can handle some issues with logging, recompiling and waiting (which is very tedious), but some of the lower-level issues like incorrect memory access, pointer failures, off-by-one errors, all that are a major pain to find and fix when you have zero tools to help you. In the end all you can do is to write extensive test-cases and hope to catch all errors, then spend days debugging those you didn't catch.</p>
<p>And on top of that most JS programmers are not experienced with these kind of bugs, as they simply do not exist (in that way) in JS. Which means that many people will have to learn a completely new language (and all the issues that come with it) first, and in the worst way possible.</p>
<p>Lua was definitely the better choice for my kind of problem. While it is not as fast as native C, it's still much faster than JS and therefore suitable for performance-critical parts. On the other hand debugging and writing code is much simpler, as Lua is much closer to JS than C.</p>
]]></description><link>http://screeps.com/forum/post/9042</link><guid isPermaLink="true">http://screeps.com/forum/post/9042</guid><dc:creator><![CDATA[TwoThe]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to PTR Changelog 2017-09-25: WebAssembly support on Invalid Date]]></title><description><![CDATA[<p>Can somebody give me a simple example of using wasp with C++ classes?
For example, i'm using binary heap in my js script and want change it to C++ binary heap... How can I do, structurally?
Can I just use in my binary_heap.js module functions that uses wasp function compiled from c++? Can I use full C++ class module in some js-wrapper module?</p>
]]></description><link>http://screeps.com/forum/post/9839</link><guid isPermaLink="true">http://screeps.com/forum/post/9839</guid><dc:creator><![CDATA[Chaotic_Good]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>