<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WebAssembly | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/category/webassembly/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Wed, 03 Mar 2021 20:26:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>WebAssembly | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>The game of 2048 in C in your browser</title>
		<link>https://learncgames.com/the-game-of-2048-in-c-in-your-browser/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-game-of-2048-in-c-in-your-browser</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Fri, 05 Mar 2021 00:00:12 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[WebAssembly]]></category>
		<category><![CDATA[2048]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2819</guid>

					<description><![CDATA[<p>Back in 2014, an Italian developer called Gabriele Cirulli devised a puzzle game called 2048. It has been implemented on many platforms (I have it on my iPhone) and here is a link to a C version of it (in 300 lines) by developer Nishchith Shetty that plays it in a browser using WebAssembly. The [&#8230;]</p>
The post <a href="https://learncgames.com/the-game-of-2048-in-c-in-your-browser/">The game of 2048 in C in your browser</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:122,&quot;href&quot;:&quot;https:\/\/github.com\/inishchith\/2048.wasm&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251209091006\/https:\/\/github.com\/inishchith\/2048.wasm&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:09:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 20:59:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 22:35:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 14:25:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-23 14:39:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 10:58:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 08:00:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-07 08:12:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 21:28:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-17 05:18:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 02:51:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 09:00:02&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-03-26 09:00:02&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:123,&quot;href&quot;:&quot;https:\/\/en.wikipedia.org\/wiki\/WebAssembly&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260204131036\/https:\/\/en.wikipedia.org\/wiki\/WebAssembly&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:09:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-09 20:59:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 22:35:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-19 14:25:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 15:15:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-28 10:02:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-07 08:12:11&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-11 21:28:50&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 05:18:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-22 02:51:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-26 09:00:02&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-03-26 09:00:02&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:124,&quot;href&quot;:&quot;https:\/\/emscripten.org&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260206121429\/https:\/\/emscripten.org\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-09 20:59:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-14 09:49:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 14:25:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-24 15:16:03&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-28 10:02:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-07 08:12:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 21:28:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-17 05:18:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 02:51:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 03:55:19&quot;,&quot;http_code&quot;:503}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-03-26 03:55:19&quot;,&quot;http_code&quot;:503},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:125,&quot;href&quot;:&quot;https:\/\/2048.nishchith.com&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250718042908\/https:\/\/2048.nishchith.com\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:10:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 20:59:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 22:35:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 14:25:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-24 15:15:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 10:02:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-07 08:12:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 21:28:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-17 05:18:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 02:51:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 09:00:02&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-03-26 09:00:02&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img fetchpriority="high" decoding="async" class="alignleft size-medium wp-image-2820" src="https://learncgames.com/wp-content/uploads/2021/03/2048-230x300.png" alt="2048 game playing in a browser" width="230" height="300" srcset="https://learncgames.com/wp-content/uploads/2021/03/2048-230x300.png 230w, https://learncgames.com/wp-content/uploads/2021/03/2048.png 497w" sizes="(max-width: 230px) 100vw, 230px" />Back in 2014, an Italian developer called Gabriele Cirulli devised a puzzle game called 2048. It has been implemented on many platforms (<em>I have it on my iPhone</em>) and here is <a title="Link to Wasm version of 2048 on GitHub" href="https://github.com/inishchith/2048.wasm" target="_blank" rel="nofollow noopener">a link to a C version</a> of it (<em>in 300 lines</em>) by developer Nishchith Shetty that plays it in a browser using WebAssembly.</p>
<p>The idea behind the puzzle is that you combine the numbered pieces by moving pieces intro same numbered pieces. 2 into 3, 4 into 4 and so on.</p>
<p><a title="Link to WebAssembly on Wikipedia" href="https://en.wikipedia.org/wiki/WebAssembly" target="_blank" rel="nofollow noopener">WebAssembly</a> is the technology that lets you run programs in many languages (<em>including C and C++</em>) in your browser at speeds up to 50% of native code.  It&#8217;s also used in Blazor where you can write C# programs that run in the browser.</p>
<p>To convert the C code to WebAssembly, you have to install a transpiler (<em>a program that converts one programming language to another</em>) called <a title="Link to Emscripten.org" href="https://emscripten.org/" target="_blank" rel="nofollow noopener">Emscripten</a>, then it&#8217;s a single command line instruction to build the WebAssembly from the C sources and SDL2. Or you can just play it online <a title="Link to 2048 running on nishchith.com" href="https://2048.nishchith.com/" target="_blank" rel="nofollow noopener">here</a>.</p>
<p>I&#8217;ve been meaning to do a WebAssembly version of my asteroids game using Emscripten. it&#8217;s just been sheer laziness that I haven&#8217;t got round to it.</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/the-game-of-2048-in-c-in-your-browser/">The game of 2048 in C in your browser</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2819</post-id>	</item>
	</channel>
</rss>
