<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Endel Dreyer on Medium]]></title>
        <description><![CDATA[Stories by Endel Dreyer on Medium]]></description>
        <link>https://medium.com/@endel?source=rss-e6cdfcf44ce1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4uql_TGPERDI14c0pCbbjg.png</url>
            <title>Stories by Endel Dreyer on Medium</title>
            <link>https://medium.com/@endel?source=rss-e6cdfcf44ce1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@endel/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[“Vibe-coding” A Multiplayer 2D Shooter — how far can it scale?]]></title>
            <link>https://endel.medium.com/vibe-coding-a-multiplayer-2d-shooter-how-far-can-it-scale-b77c1a88af24?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b77c1a88af24</guid>
            <category><![CDATA[web-game-development]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[multiplayer]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 18:48:23 GMT</pubDate>
            <atom:updated>2025-12-16T12:42:07.156Z</atom:updated>
            <content:encoded><![CDATA[<h3>“Vibe-coding” A Multiplayer 2D Shooter — how far can it scale?</h3><p>Claude Opus 4.5 made this prototype with 1 prompt.</p><p>…And I wrote this post myself, so please give it a read ☺</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQHx0B7_rkcjL5JneCsYng.png" /><figcaption>“ZombsRoyale”-like prototype made with Cursor + Claude Opus 4.5</figcaption></figure><p>I know what you are thinking — no way a multiplayer game made with AI can scale. And that’s what I’d like to explore here.</p><h4>Kickstarting the project:</h4><p>The project was kickstarted with a simple question: <em>“Are you familiar with zombsroyale/surviv.io gameplay?”</em></p><p>The AI was very familiar with the concept, and we proceeded with a <strong>plan</strong> to use PixiJS + Rapier2d + Colyseus, with the following architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*MTVxdnhcUGVh9l4LE3-kbA.png" /><figcaption>Architecture of initial plan</figcaption></figure><h4>1st Iteration: Reducing excessive state data sync</h4><p>The 1st iteration worked ok locally, but it was unplayable with more than 10 clients when deployed to a cloud server.</p><ul><li><strong>Bullet data: </strong>Every bullet was part of the room state and had its position synced in real time. But because bullets move in a predictable paths, we can cut down on data a lot by just sending the starting position and angle and letting each client figure out the rest</li><li><strong>“Viewport” data:</strong> Every player was receiving the full positions of every other player. To send only the data within a certain proximity of each player, I’ve added a <a href="https://timohausmann.github.io/quadtree-ts/examples/simple/">quadtree</a> implementation combined with Colyseus’ <a href="https://docs.colyseus.io/state/view">StateView</a>. Every second, the quadtree is rebuilt, and players are either added to or removed from each player’s StateView based on their proximity.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*2hrDff9x5_E2u8HbFz7W4g.gif" /><figcaption>Example of quadtree in action (<a href="https://www.npmjs.com/package/@timohausmann/quadtree-ts">@timohausmann/quadtree-ts</a>)</figcaption></figure><p>With these changes, we made the server able to comfortably hold 50+ clients on a small <a href="https://www.vultr.com/?ref=9632185-9J"><strong>1vCPU 1GB RAM High Frequency</strong> on Vultr</a>. (~$6/mo)</p><h4>Load-testing</h4><p>As the messaging between client and server was already working, we can now ask AI to create a <a href="https://docs.colyseus.io/tools/loadtest">loadtest</a> script using the frontend code as reference, so we can simulate multiple client connections.</p><p>I did not have to modify the script, and simply run:</p><pre>npx tsx loadtest/battle-royale.ts --room battle_royale --numClients 20</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FS176BAFEUl0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DS176BAFEUl0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FS176BAFEUl0%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4ff84cd391171a3155468fe6cf268a7/href">https://medium.com/media/c4ff84cd391171a3155468fe6cf268a7/href</a></iframe><h4>2nd iteration: Reducing input messages</h4><p>The AI made every player send inputs at 60fps, even if the player is not moving at all.</p><p>This technique has pros and cons: it enables smooth client-side prediction with precise server authority, but our small VPS struggles to process so many inbound messages (3000 per second!) with 50+ concurrent connections due to resource constraints.</p><p>In order to keep things simple, I’ve just reduced the frequency to send inputs from 60fps to 30fps. This way we can keep the client-prediction algorithm and server authority while comfortably supporting up to 100 clients.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWWWHMeMSl3c%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWWWHMeMSl3c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWWWHMeMSl3c%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/eed6d98786a69590eb05318adf2dec02/href">https://medium.com/media/eed6d98786a69590eb05318adf2dec02/href</a></iframe><h4>The final question… Can a “vibe-coded” multiplayer game scale?</h4><p>Yes, it definitely can!</p><p>You just need to be cautious about the amount of data the client and server are exchanging, and make sure to keep the server’s CPU usage as low as possible. <a href="https://colyseus.io/">Colyseus</a>’ mission is to allow anyone to develop, iterate over, and ship their own multiplayer games, even if it was coded by an AI.</p><p>I hope you enjoyed the read, if you’d like see more content like this, please let me know!</p><p>Cheers!</p><ul><li><a href="https://multiplayer-2d-shooter-prototype.vercel.app/">Play online demo</a> (The server is hosted in Europe — France)</li><li><a href="https://github.com/endel/multiplayer-2d-shooter-prototype">See source-code / MIT License</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b77c1a88af24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Full-stack State Sync with Socket.IO]]></title>
            <link>https://endel.medium.com/full-stack-state-sync-with-socket-io-72ae50c7a989?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/72ae50c7a989</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[multiplayer]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[socketio]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Mon, 09 Jun 2025 20:28:10 GMT</pubDate>
            <atom:updated>2025-06-19T16:40:38.942Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSxb3ULa35PjJ4rDdKtt8Q.png" /></figure><h3>Real-time State Sync with Socket.IO</h3><p>What if you could combine the familiarity of Socket.io with the ease of realtime state synchronization from Colyseus?</p><blockquote>TLDR: Check out the full source-code at <a href="https://github.com/endel/fullstack-statesync-socket.io">endel/realtime-statesync-socket.io</a></blockquote><p>I’ve been working on my own <em>incremental</em> binary state serializer for <a href="https://github.com/colyseus/schema/graphs/contributors">a few years now</a>, and let me share why I think it deserves a spot in your toolkit alongside the many state sync libraries out there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*TQ8tkEgb5Vc_c2W4" /><figcaption>Commits on @colyseus/schema from 2018 to 2025</figcaption></figure><h3>Meet Colyseus’ State Synchronization</h3><p>You can think of <a href="https://github.com/colyseus/schema">@colyseus/schema</a> as Protocol Buffers with <em>incremental</em> encoding, <em>automatic</em> change tracking and a <em>callback system</em> at the client-side.</p><p>Sounds complicated? It definitely is (under the hood)! But it was built so the public APIs are very friendly to use and operate.</p><h4>Schema Definition &amp; Binary Encoding</h4><p>By having the definition of your state structures both in the server and in the client, the serializer is capable of compressing field names into field indexes, without the need to self-describe any of its structures — just like Protocol Buffers.</p><pre>import { Schema, type } from &#39;@colyseus/schema&#39;;<br><br>class Player extends Schema {<br>  @type(&quot;string&quot;) name: string;<br>}<br><br>class GameState extends Schema {<br>  @type(“string”) status = “waiting”;<br>  @type({ map: Player }) players = new MapSchema&lt;Player&gt;();<br>}</pre><h4>Incremental Updates &amp; Automatic Change Detection</h4><p>You can naturally change your data structures and have only its <strong>mutations</strong> automatically synchronized from the server to the client. Not the entire state, not diffs of JSON objects — just the exact bytes that represent the changes you made.</p><p>No need for manual dirty checking, or complex diffing algorithms.</p><pre>// Server-side<br>state.status = &quot;started&quot;;<br><br>const player1 = new Player();<br>player1.name = &quot;Player One&quot;;<br>state.players.set(&quot;one&quot;, player1);<br><br>const player2 = new Player();<br>player2.name = &quot;Player Two&quot;;<br>state.players.set(&quot;two&quot;, player2);</pre><p>From the client-side, you can subscribe to granular changes via callbacks:</p><pre>// Client-side: Listen to granular changes<br><br>// On Player added:<br>$(state).players.onAdd((player, id) =&gt; {<br>  console.log(`Player ${player.name} joined!`);<br><br>  // On Player &quot;name&quot; property change:<br>  $(player).listen(&quot;name&quot;, (value, previousValue) =&gt; {<br>    console.log(`Player name changed: ${previousValue} → ${value}`);<br>  });<br>});<br><br>// On Player removed:<br>$(state).players.onRemove((player, id) =&gt; {<br>  console.log(`Player ${player.name} left!`)<br>});<br><br>// On &quot;status&quot; property change:<br>$(state).listen(&quot;status&quot;, (value, previousValue) =&gt; {<br>  console.log(`Status changed: ${previousValue} → ${value}`);<br>});</pre><h3>Full example with Socket.io (<a href="https://github.com/endel/fullstack-statesync-socket.io">Full source-code</a>)</h3><p>This small demonstration combines <strong>Colyseus State Sync</strong> library with <strong>Socket.io</strong>, using Node.js.</p><p>Let’s install the dependencies:</p><pre>npm install @colyseus/schema socket.io socket.io-client</pre><h4>Server-side:</h4><p>Now let’s write our entrypoint file to put it all together on the server. It’s fairly straightforward, as we use a single Encoder.</p><pre>import { Schema, type, Encoder } from &quot;@colyseus/schema&quot;;<br>import { Server } from &quot;socket.io&quot;;<br><br>class Player extends Schema {<br>  @type(&quot;string&quot;) name: string;<br>  @type(&quot;number&quot;) x: number = 0;<br>  @type(&quot;number&quot;) y: number = 0;<br>}<br><br>class GameState extends Schema {<br>  @type({ map: Player }) players = new MapSchema&lt;Player&gt;();<br>}<br><br>const io = new Server(3000);<br>const state = new GameState();<br>const encoder = new Encoder(state);<br><br>io.on(&quot;connection&quot;, (socket) =&gt; {<br>  // Add new &quot;player&quot; to the state<br>  const player = new Player();<br>  state.players.set(socket.id, player);<br><br>  // Send full state on connection<br>  socket.emit(&quot;sync&quot;, Buffer.from(encoder.encodeAll()));<br><br>  socket.on(&quot;move&quot;, (data) =&gt; {<br>    player.x = data.x;<br>    player.y = data.y;<br>  });<br><br>  socket.on(&quot;disconnect&quot;, () =&gt; {<br>    console.log(&quot;Player disconnected:&quot;, socket.id);<br>    state.players.delete(socket.id);<br>  });<br>});<br><br>function broadcastChanges() {<br>  const changes = encoder.encode();<br>  if (changes.byteLength &gt; 0) {<br>    // This is the sweet part - only sends what changed!<br>    io.emit(&quot;sync&quot;, Buffer.from(changes));<br>  }<br>  encoder.discardChanges();<br>}<br><br>setInterval(broadcastChanges, 1000 / 60);</pre><p>(You can extend this solution to support a multiple Encoder‘s per Socket.io Room, if you’d like to.)</p><h4>Client side:</h4><p>Now it’s time to set-up the Decoder on the client-side.</p><pre>import { Schema, Decoder, getDecoderStateCallbacks } from &quot;@colyseus/schema&quot;;<br>import io from &quot;socket.io-client&quot;;<br><br>const socket = io(&quot;http://localhost:3000&quot;);<br>const state: GameState = new GameState();<br>const decoder = new Decoder(state);<br><br>// Decode incoming state changes<br>socket.on(&quot;sync&quot;, (data) =&gt; decoder.decode(data));<br><br>const $ = getDecoderStateCallbacks(decoder);<br><br>$(state).players.onAdd((player, id) =&gt; {<br>  console.log(&quot;Player joined:&quot;, player.name);<br>  // Add player to your game world<br><br>  $(player).onChange(() =&gt; {<br>    console.log(&quot;Player moved:&quot;, player.name, player.x, player.y);<br>    // Update player position in your game world<br>  });<br>});<br><br>$(state).players.onRemove((player, id) =&gt; {<br>  console.log(&quot;Player left:&quot;, player.name);<br>  // Remove player from the game world<br>});</pre><blockquote>Check out the full source-code at <a href="https://github.com/endel/fullstack-statesync-socket.io">endel/realtime-statesync-socket.io</a> (MIT License)</blockquote><h3>Join the Community!</h3><p>This state synchronization library and Colyseus itself are open-source under the most permissive MIT License. If you find it useful, here’s how you can get involved:</p><ul><li>⭐ Star the <a href="https://github.com/colyseus/schema">@colyseus/schema repo</a> (it really helps!)</li><li>🐛 <a href="https://github.com/colyseus/schema/issues">Report issues</a> or suggest features</li><li>💬 Join Colyseus <a href="https://discord.gg/RY8rRS7">Discord community</a></li><li>📖 Check out the <a href="https://docs.colyseus.io/state">full documentation</a> of @colyseus/schema</li></ul><h3>What’s Next?</h3><p>This year the StateView has been introduced, and is currently being tested by the Colyseus community. The StateView allows you to control which parts of the state are visible to each client. — <a href="https://docs.colyseus.io/state/view">Read more about </a><a href="https://docs.colyseus.io/state/view">StateView</a>.</p><p>I’d love to hear your thoughts! Have you tried @colyseus/schema? Are there specific use cases you’d like me to cover in future posts?</p><p>Cheers! ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72ae50c7a989" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Colyseus is fully independent again!]]></title>
            <link>https://endel.medium.com/colyseus-is-fully-independent-again-4fa7f1774303?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fa7f1774303</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[colyseus]]></category>
            <category><![CDATA[indiedev]]></category>
            <category><![CDATA[solopreneur]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Thu, 04 May 2023 13:11:00 GMT</pubDate>
            <atom:updated>2023-05-12T13:34:11.983Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s a new and exciting chapter for Colyseus!</h4><blockquote>“Colyseus Arena” has been shut down on <em>31 March 2023</em>.<br>“Colyseus Arena” was a managed hosting service developed and provided by the company <strong>Lucid Sight, Inc</strong>. My relationship with the company was limited to a consulting contract that has also been terminated on 31 March 2023.</blockquote><ul><li><strong>Colyseus Cloud</strong> is the replacement for <em>“Colyseus Arena”</em></li><li>Colyseus will continue to be <strong>MIT Licensed</strong></li><li>My <a href="https://github.com/sponsors/endel"><strong>GitHub Sponsors</strong> is now open</a> for anyone who would like to contribute financially to my open-source work</li><li><a href="https://github.com/colyseus/colyseus/releases/tag/0.15.0"><strong>Colyseus 0.15 has been released!</strong></a></li></ul><p>In case you missed it, here are the contents of the open letter published on the colyseus.io website on 5th April 2023:</p><h4>A brief summary of the project</h4><ul><li>2016 — The <a href="https://github.com/colyseus/colyseus/commit/6c3814eefb1d11ad062e7a8e09673c7d31c5fd60">first version was released</a> as a hobby/personal project</li><li>2018 — Quit my job to focus on Colyseus and freelancing</li><li>2021 — <a href="https://venturebeat.com/games/lucid-sight-acquires-colyseus-open-source-multiplayer-game-engine/">A LA-based startup acquired Colyseus</a></li><li>2023 — <a href="https://twitter.com/endel/status/1641204209952468992">The LA startup failed</a> —the ownership has been transferred back</li><li>2023-onwards — The sustainability issue, <strong>Colyseus Cloud,</strong> and lots of work ahead!</li></ul><h3>The acquisition</h3><p>In February 2021, <a href="https://venturebeat.com/games/lucid-sight-acquires-colyseus-open-source-multiplayer-game-engine/">VentureBeat announced that a startup based in Los Angeles acquired Colyseus</a>.</p><h4>Behind the acquisition</h4><p>The proposal was made in December 2020, when I was feeling overwhelmed and frustrated. I was spending countless hours on the project while having very little in return.</p><p>Letting go of ownership of the project was one of the hardest decisions I’ve ever made. I had to go through tremendous mental gymnastics to detach myself from it while also considering new project(s) to start before the contract with that company would expire.</p><p>The papers were signed in January 2021.</p><h4>After the acquisition</h4><p>I can’t share much due to contract agreements, but I’ve joined the startup’s team and they were lovely with me. It felt surreal that they would refer to “Colyseus” as a real business the whole time. It felt much bigger than it was. I was really excited in the beginning.</p><p>The team managed to launch “Colyseus Arena” (the managed hosting service) a few months after the acquisition. It worked well and was growing steadily.</p><p>By the end of 2021, the upcoming version 0.15 of the framework was ready to be released — which could reduce server costs considerably. Its release was being postponed until the “Arena” service could support it to avoid user friction.</p><p>“Arena” never supported the upcoming version 0.15. I felt that the work I was doing on the open-source framework wasn’t being appreciated enough, and I started to slowly lose my enthusiasm. Eventually, I decided to focus most of my energy on a side project.</p><h4>“Colyseus Arena” shutting down</h4><p>Fast forward to March 31, 2023 — Colyseus Arena had to be abruptly discontinued due to a lack of funds. My contract with the company was also terminated.</p><p><em>(I feel really sorry for everyone who had their games and projects affected by this. It wasn’t meant to be this way.)</em></p><p>With the “Arena” service discontinued, Colyseus would serve no purpose to the startup anymore, so they were nice enough to return the ownership of the project to me.</p><h3>Having the ownership back</h3><p>The feelings of attachment to the project were quick to come back after they told me they’d give me back ownership. I immediately began working on my own hosting service.</p><p>I have a new challenge now. Only receiving donations as before won’t pay my bills.</p><h3>A business — “Colyseus Cloud”</h3><p>For Colyseus as an open-source framework to continue existing and evolving, it must have a viable business.</p><p>The main purpose of <strong>Colyseus Cloud</strong> is to offer dead simple and effective Colyseus hosting.</p><p>No serverless, no edge-computing, no auto-scaling, no Kubernetes. (<em>At the time of this writing.</em>)</p><h3>The future</h3><p>I have ambitious plans for Colyseus and even more ambitious plans for a side project I’ve been working on recently.</p><h4>Colyseus Version 1.0</h4><p>There are many long-lasting bugs, and feature requests that must be taken care of. Version 1.0 must include most of them.</p><p>I don’t have a public roadmap yet, but I’m expecting to have version 1.0 released somewhere between the year of 2024 and 2025.</p><p>After the 1.0 release, I’m expecting to explore tighter integration between Colyseus Cloud and user-facing features. It’s too soon to share any plans here, but I don’t wanna simply copy what the competition is doing.</p><h4>An ambitious side-project [?]</h4><p>The web is about to change completely in the upcoming years when new standards become mainstream: <a href="https://www.rfc-editor.org/rfc/rfc9000.html">QUIC</a>, <a href="https://www.rfc-editor.org/rfc/rfc9114.html">HTTP/3</a>, <a href="https://w3c.github.io/webtransport/">WebTransport</a>, and <a href="https://datatracker.ietf.org/doc/charter-ietf-moq/">MoQ</a>.</p><p>During this period between 2021 and 2023, I was researching and prototyping a QUIC implementation in the <a href="https://ziglang.org/">Zig programming language</a>. It is so primitive at the moment it doesn’t even worth sharing.</p><p>Having a set of portable lower-level networking libraries would serve a much broad audience by being reusable mostly anywhere.</p><p>Anyway, this is way more ambitious than Colyseus — the focus should be 100% on making Colyseus sustainable right now.</p><h3>Thank you for caring for Colyseus ❤️</h3><p>The project has only come this far because of the constant feedback the community has given. I will continue doing my best to listen to you and improve wherever possible.</p><p>Yours truly, Endel.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fa7f1774303" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working Solo: How To Stay Focused and Motivated]]></title>
            <link>https://endel.medium.com/working-solo-how-to-stay-focused-and-motivated-18e8359c767d?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/18e8359c767d</guid>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[planning]]></category>
            <category><![CDATA[focus]]></category>
            <category><![CDATA[indiedev]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Fri, 18 Sep 2020 02:16:36 GMT</pubDate>
            <atom:updated>2020-09-21T02:06:20.125Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is for anyone working on a side project, or passion project, and ends up feeling lost or stuck — ultimately resulting in an abandoned project, or shifting the attention to something else.</p><blockquote><em>TLDR: I’ve created a Trello Board Template which I’m using for every single project I’m participating, even if only I’m gonna see it. </em><a href="https://trello.com/b/gcEXQMk2/solo-project-board-%F0%9F%91%A8%F0%9F%92%BB"><em>Check it out here!</em></a></blockquote><p>The best thing that I’ve started doing a few months from now is having a <a href="https://trello.com/">Trello</a> board for each and every single project I work on. Even if it’s a 2-week project. It helps me to have realistic expectations for myself.</p><p>I personally tend to underestimate a lot of small tasks and have the feeling I can do a lot of stuff at the same time. When in reality, my attention span is very limited, and there’s a limit on the number of context switches and things I can do.</p><h3>It’s frustrating!</h3><ul><li>It is frustrating when you haven’t done what you think you could or should in one day or a week.</li><li>It is frustrating when you’re looking for your next task and can’t decide between way too many options.</li><li>It is frustrating not knowing how long a task will take.</li><li>It is frustrating not having a plan.</li></ul><p>All of these frustrations are symptoms of poor planning. I’ve become a Trello freak because of them, and probably many more.</p><p>Your Trello board must have an <strong>objective</strong>. The objective will be different for each project. For <a href="http://brawlball.io/">brawlball.io</a> the objective is simple: to release a playable version!</p><h3>Planning: <a href="https://trello.com/b/gcEXQMk2/solo-project-board-%F0%9F%91%A8%F0%9F%92%BB">My Kanban Template</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xkgDLzERg6oTutpNVgCidw.png" /><figcaption>My Trello board for the development of <a href="http://brawlball.io/">brawlball.io</a></figcaption></figure><p>I recommend using a clean (that won’t distract you) and inspiring image for your background. It gives you some feelings. I can’t explain, It’s good. Lol.</p><p>Here’s a brief summary of what you should place on each column of the template. It is basically a classic Kanban board, though.</p><p><strong>Backlog</strong> — Things you need to do in the future. Only actionable stuff. If it’s not 100% relevant to your objective, don’t even list it. Tasks that depend on other tasks should be kept on the backlog.</p><p><strong>Todo</strong> — List of things you are already capable of starting working, free of dependencies. When your <strong>Doing</strong> column is free, just pick the next one you feel fits best from the list and move to <strong>Doing.</strong></p><p><strong>Doing </strong>— List of things you’re currently working on. Keep this list very short. Ideally just one card. Three at maximum. If you have more than this, make sure to move them either back to <strong>Todo</strong>, or to <strong>Review</strong>.</p><p><strong>Review</strong> — List of things you’ve finished doing, but are not 100% certain it’s really finished. You may move things from <strong>Doing</strong> to <strong>Review</strong> just to be able to pick up a new item from <strong>Todo</strong> and start <strong>Doing</strong> immediately, but don’t want to bother on reviewing yet. You may review a bunch of things altogether in the other day. What is important is that you keep your mind in peace here.</p><p><strong>Done</strong> — All things that passed your <strong>Review</strong> process. Congratulations! You have another item on this list to be proud of!</p><p>Make sure to only work on tasks listed in cards. New cards can be included at any point during the execution of the project. What is important is that you have a clear picture of everything involved in order to reach your objective.</p><p>This way you’re being true to yourself. If the project is delaying — at least you have a big list of items you can look back and can be proud of the progress so far.</p><p>Be kind to yourself. You don’t need to get 200% done in one day. Be slow and steady. Plan things properly, and don’t over-plan it — cards can be a single sentence, without a full description. Only create cards for really actionable stuff your project absolutely needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18e8359c767d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Colyseus 0.10: Introducing the New State Serialization Algorithm]]></title>
            <link>https://endel.medium.com/colyseus-0-10-introducing-the-new-state-serialization-algorithm-88409ce5a660?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/88409ce5a660</guid>
            <category><![CDATA[serialization]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[multiplayer]]></category>
            <category><![CDATA[colyseus]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 14:46:50 GMT</pubDate>
            <atom:updated>2019-03-29T14:45:10.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*trqghxTuvAPIQ6T6vIa1Yw.png" /></figure><p>I’m really excited to announce the release 0.10 of <a href="https://github.com/colyseus/colyseus">Colyseus</a>. This version basically introduces a more performant state serialization algorithm and a different way of decoding the state in the client-side. It’s currently available for <a href="https://github.com/colyseus/colyseus.js">JavaScript</a>, <a href="https://github.com/colyseus/colyseus-defold">Defold Engine</a> and <a href="https://github.com/colyseus/colyseus-unity3d">Unity3D</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*2aU8zy4JniM1Muhp1Ry2dg.png" /></figure><p>The new serializer (<a href="https://github.com/colyseus/schema"><strong>@colyseus/schema</strong></a>) optimizes not only the throughput of your application but also memory and CPU consumption on both server-side and client-side. See the comparison between the number of bytes transferred using previous and new serializer of Colyseus.</p><p>This is possible through strictly defining the data types of each property in the state. Only types with the “<strong>@type</strong>” annotation are going to be synchronized. There’s no need to use “<strong>@nosync</strong>” non-synchronizable properties anymore.</p><h3>What was the problem with the previous serializer?</h3><p>Besides being pretty easy to use, the previous serializer had some disadvantages both when encoding AND decoding large state objects.</p><ul><li>The server needed to take a snapshot of the state at every patch, even if no changes were made — to be able to check if the previous state snapshot differs from the current one. The patch was then broadcasted as a binary diff between them.</li><li>To apply the changes in the client-side, the patches were applied on top of the last snapshot sent by the server — which means the <strong>whole state needed</strong> to be deserialized again, creating a new copy of the state per patch and having a performance penalty if your state was slightly big.</li></ul><p>The good news is that the new serializer solves both of these problems.</p><h3>The New Serializer — Server-side</h3><p>In the state definition below, you’ll see a map of Player instances.</p><pre>import { Schema, MapSchema, type } from &quot;@colyseus/schema&quot;;<br><br>class Player extends Schema {<br>    @type(&quot;number&quot;)<br>    width: number;<br><br>    @type(&quot;number&quot;)<br>    height: number;<br>}<br><br>class MyState extends Schema {<br>    @type({ map: Player })<br>    players = new MapSchema&lt;Player&gt;();<br>}</pre><p>Now, let’s instantiate the state in our room handler:</p><pre>import { Room } from &quot;colyseus&quot;;<br>import { MyState } from &quot;./MyState&quot;;</pre><pre>class MyRoom extends Room {<br>    onInit() {<br>        this.setState(new MyState());<br>    }<br>}</pre><p>In the client-side, the state is available right after successfully joining the room. You can listen for additions, removals, and changes by registering callbacks directly into your decoded state variables.</p><h3>The New Serializer — Client-side (JavaScript)</h3><p>The way you listen for a change in the client-side depends on the structure you’re interested in. Variable changes within a container are available through the “<strong>onChange</strong>” callback:</p><pre>var client = new Colyseus.Client(&quot;ws://localhost:2567&quot;);<br>var room = client.join(&quot;my_room&quot;);</pre><pre>room.onJoin.add(() =&gt; {<br>    room.state.onChange = (changes) =&gt; {<br>        changes.forEach(change =&gt; {<br>            console.log(change.field);<br>            console.log(change.value);<br>            console.log(change.previousValue);<br>        });<br>    };<br>})</pre><p>Additions and removals of entries on Array’s and Map’s are available through “<strong>onAdd</strong>” and “<strong>onRemove</strong>” callbacks in the container variable.</p><pre>room.state.players.onAdd = (player, key) =&gt; {<br>    console.log(player, &quot;has been added at&quot;, key);<br>};</pre><pre>room.state.players.onRemove = (player, key) =&gt; {<br>    console.log(player, &quot;has been removed at&quot;, key);<br>};</pre><p>For child entities inside Array’s and Map’s, you may detect changes of either the whole object or particular variables:</p><pre>// callback for a whole object change <br>// not possible to know which properties have changed here<br>room.state.players.onChange = (player, key) =&gt; {<br>    console.log(player, &quot;has been changed at&quot;, key);<br>};</pre><pre>// callback for checking particular property changes<br>// this way you know exactly which properties have changed<br>room.state.players.onAdd = (player, key) =&gt; {<br>    player.onChange = function(changes) {<br>        changes.forEach(change =&gt; {<br>            console.log(change.field);<br>            console.log(change.value);<br>            console.log(change.previousValue);<br>        });<br>    }<br>};</pre><p><a href="http://docs.colyseus.io/migrating/0.10/">See the migration guide from version 0.9 to 0.10 here</a>.</p><h3>That’s it for 0.10</h3><p>I highly suggest you upgrade to version 0.10, even if you’re not going to use the new serializer yet. The previous serializer is still available and won’t be deprecated any time soon.</p><h3>Next challenge: data filters! (work in progress)</h3><p>I’ve started experimenting to allow filtering the data in the state for each client. The plan is to have different callbacks in the client-side whenever the data becomes available or unavailable.</p><p>The syntax for data filtering will most likely look like the example below — which demonstrates filtering entities by distance.</p><pre>import { Schema, type, filter } from &quot;@colyseus/schema&quot;;<br><br>export class State extends Schema {<br>  @filter(function(this: State, client: any, value: Entity) {<br>    const currentPlayer = this.entities[client.sessionId]<br><br>    var a = value.x - currentPlayer.x;<br>    var b = value.y - currentPlayer.y;<br><br>    return (Math.sqrt(a * a + b * b)) &lt;= 10;<br><br>  })<br>  @type({ map: Entity })<br>  entities = new MapSchema&lt;Entity&gt;();<br>}</pre><h3>Feedback is always very welcome!</h3><p>Feel free to join the <a href="https://discord.gg/RY8rRS7">Discord server</a> if you have any suggestions. If you just want to hang out with us, you’re welcome too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88409ce5a660" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Colyseus — HTML5 Multiplayer Games Made Simple (v0.5.0 update)]]></title>
            <link>https://endel.medium.com/colyseus-html5-multiplayer-games-made-simple-v0-6-0-alpha-update-d5d0e5eba4a0?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d0e5eba4a0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[multiplayer]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Mon, 17 Jul 2017 10:18:45 GMT</pubDate>
            <atom:updated>2017-08-15T14:20:13.994Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pxqjCEQXhStSg5A2qZdjw.png" /><figcaption><a href="https://github.com/gamestdio/colyseus">https://github.com/gamestdio/colyseus</a></figcaption></figure><p>Almost 2 years ago, the very <a href="https://medium.com/@endel/colyseus-minimalistic-mmo-game-server-for-node-js-a29fe1cebbfe">first version of Colyseus</a> was published. It started out as a wild and naive experiment for my own multiplayer experiments.</p><p>Since then, the community slowly started to try it out and release some games using it, such as:</p><ul><li><a href="http://gunfight.io/">GunFight.io</a> — made by <a href="https://twitter.com/tinydobbins">@tinydobbins</a></li><li><a href="http://splatty.io/">Splatty.io</a> — made by <a href="https://twitter.com/bmovement">@bmovement</a></li></ul><p>The focus of Colyseus has always been to be the easiest solution for building multiplayer experiences using JavaScript and HTML5, while having a minimalist architecture. It still is in a sort of experimental stage, but steadily evolving into a concrete solution.</p><h4>What’s new on v0.5.0?</h4><ul><li><strong>Vertical scalability:</strong> Version 0.5.0 introduced a new architecture by using NodeJS’s <a href="https://nodejs.org/dist/latest-v6.x/docs/api/cluster.html">cluster module</a>. Now your game server can scale <strong>vertically</strong>. This architectural change should evolve towards <strong>horizontal</strong> scalability soon (<a href="https://github.com/gamestdio/colyseus/issues/57">#57</a>).</li><li><strong>Ranked matches:</strong> As you may already know, whenever a client requests to join a game session, the requestJoin(options) is called in the server-side to determine if that user <strong>is allowed to </strong>join the room. Previously, the first room in the list of available rooms returning true would be selected to connect. Now, you can return a float number (0..1) instead of boolean. The match-making service will select the room with <strong>highest number</strong> to connect. <a href="https://github.com/gamestdio/colyseus/wiki/Match-making">Read more</a>.</li><li><strong>Unique client / session ids: </strong>You can now identify when the same user is connecting more than once into the same room. The client.id is a unique identifier <strong>per user</strong> whilst client.sessionId is <strong>always</strong> unique. In short, if you don’t want to care about this, always use client.sessionId to identify your users.</li><li><strong>Disposing rooms:</strong> Introduced the autoDispose property (default is true) which determines if the room should be automatically disposed when the last client disconnects from it. (thanks <a href="https://github.com/seiyria">@seiyria</a>) — also all intervals/timeouts set within this.clock will be cleared on disposal.</li></ul><h4>Breaking changes:</h4><p>There’s a few breaking changes on both server-side and client-side. See links below if you’re migrating from a previous version to 0.5.0.</p><ul><li><a href="https://github.com/gamestdio/colyseus/blob/master/MIGRATING.md#migrating-from-04-to-05">Server-side migration highlights (from 0.4 to 0.5)</a></li><li><a href="https://github.com/gamestdio/colyseus.js/blob/e325751e7a2197341d44feab69e26cd8ae506fbe/MIGRATING.md#migrating-from-06-to-07">Client-side migration highlights (from 0.6 to 0.7)</a></li></ul><h4>Roadmap for version 1.0.0:</h4><p>We now have a <a href="https://github.com/gamestdio/colyseus/wiki/Roadmap">clear roadmap</a> for what’s still a must<strong> </strong>to release<strong> </strong>the version 1.0.0. One of the most requested features is the ability to filter the room state before sending patches to a particular client (<a href="https://github.com/gamestdio/colyseus/issues/59">#59</a>).</p><blockquote>Colyseus has its very first sponsor!</blockquote><blockquote>EvenNode provides Node.js hosting. Discount is available to Colyseus projects on request. Contact support for more information.</blockquote><blockquote><a href="https://www.evennode.com/?utm_source=colyseus"><strong>Go check them out!</strong></a></blockquote><h4>Join us!</h4><p>The community in the <a href="https://gitter.im/gamestdio/colyseus">Gitter Channel</a> is super friendly and open. If you have any question or just want to share your crazy ideas you’ll find lovely fellows over there! New contributors for code and/or documentation are always welcome too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d0e5eba4a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authoring TypeScript/JavaScript libraries]]></title>
            <link>https://endel.medium.com/authoring-typescript-javascript-libraries-e9ac8a9d1add?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9ac8a9d1add</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Wed, 15 Mar 2017 21:16:47 GMT</pubDate>
            <atom:updated>2017-03-15T21:34:02.205Z</atom:updated>
            <content:encoded><![CDATA[<p>TLDR: Check out a simple and productive template for authoring libraries with browser testing: <a href="https://github.com/endel/library-template.ts">https://github.com/endel/library-template.ts</a></p><p>At exactly one year ago, André Staltz wrote about why <a href="http://staltz.com/all-js-libraries-should-be-authored-in-typescript.html">all JavaScript libraries should be authored in TypeScript</a>. I must admit I wasn’t a TypeScript believer at that time.</p><p>A lot has changed since then. TypeScript ecosystem evolved like crazy. Today, If I have the opportunity to choose between writing pure JavaScript or TypeScript, I’d choose TypeScript without a doubt. Excellent tooling and less error-prone.</p><p>I love TypeScript because it lets you write whatever style you want. Don’t want to use property and method access level (public, private, protected)? Fine. Don’t want to explicitly type everything? Fine. Using an external node module without type definitions for it? Fine (didn’t used to be). Even if your code doesn’t compile, it’s also fine - your JavaScript output can be generated anyway.</p><p>Using this template you can author your own TypeScript/JavaScript libraries with ease: <a href="https://github.com/endel/library-template.ts">https://github.com/endel/library-template.ts</a></p><p>It has as little configuration as possible for testing on browser and node environments.</p><p>I’d encourage you to start developing, and more importantly — authoring your libraries — using TypeScript.</p><p>🚀🚀🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9ac8a9d1add" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HOOK — Open-source alternative to Parse.com written in PHP]]></title>
            <link>https://endel.medium.com/hook-open-source-alternative-to-parse-com-written-in-php-ad25d26c625?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad25d26c625</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[parse]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Tue, 02 Feb 2016 23:12:42 GMT</pubDate>
            <atom:updated>2016-02-03T21:40:53.408Z</atom:updated>
            <content:encoded><![CDATA[<p>HOOK — Open-source alternative to Parse.com written in PHP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/1*cE9NLI-0x-Xdf3HERwakkA.png" /><figcaption><a href="https://speakerdeck.com/endel/number-tdc2015-know-hook-and-how-to-use-it">know hook and how to use it</a> / <a href="http://hook-platform.org/">hook-platform.org</a></figcaption></figure><p>With the <a href="http://blog.parse.com/announcements/moving-on/">official announcement</a> of Parse.com retirement, I feel that I have to “sell” the backend I’ve been working on in the past couple of years.</p><p><a href="http://github.com/doubleleft/hook">HOOK</a> is a backend as a service designed with real needs of a digital agency: usually with small projects and a tight deadline. It’s all about making developers happy and delivering the final product faster, such as websites, mobile applications, interactive installations, etc.</p><p>It makes you feel like you’re using a NoSQL database, even though you’re not. You’ll be able to manipulate your tables as-you-go during the discovery process of your product, as little things always change on development time.</p><p>It has a <a href="https://github.com/doubleleft/hook-cli">commandline interface</a> that enables developers to have full control of the database, back-end modules and application configuration during development and after production deployment.</p><p>There’s more details and explanations about its usage <a href="https://speakerdeck.com/endel/number-tdc2015-know-hook-and-how-to-use-it">on this presentation.</a> Also feel free to ask if you have any questions on <a href="https://gitter.im/doubleleft/hook">gitter channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad25d26c625" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Colyseus — Minimalist MMO Game Server for Node.js]]></title>
            <link>https://endel.medium.com/colyseus-minimalistic-mmo-game-server-for-node-js-a29fe1cebbfe?source=rss-e6cdfcf44ce1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a29fe1cebbfe</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Endel Dreyer]]></dc:creator>
            <pubDate>Sun, 03 Jan 2016 19:31:56 GMT</pubDate>
            <atom:updated>2023-04-03T17:24:43.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pxqjCEQXhStSg5A2qZdjw.png" /><figcaption><a href="https://github.com/gamestdio/colyseus">https://github.com/gamestdio/colyseus</a></figcaption></figure><blockquote><a href="https://medium.com/@endel/colyseus-0-10-introducing-the-new-state-serialization-algorithm-88409ce5a660">Read the 0.10 update.</a></blockquote><blockquote><a href="https://medium.com/@endel/colyseus-html5-multiplayer-games-made-simple-v0-6-0-alpha-update-d5d0e5eba4a0">Read the 0.5.0 update.</a></blockquote><p>For the last couple of months I’ve been prototyping some multiplayer games in HTML5/JavaScript. I thought it wouldn’t be painful since the community has grown a lot — having a library ready-to-go for everything you want out there. Unfortunately it doesn’t seem to be the case for multiplayer games.</p><p>Most people who want a multiplayer game tend to re-implement a lobby system using socket.io or sockjs, which is fine if you want to do a single game. What I wanted was just a lobby system with rooms support, and synching room state without the hassle of managing particular messages back and forth.</p><p>So the idea of having a generic game server evolved and <a href="https://github.com/gamestdio/colyseus">Colyseus</a> does just like that. It basically is a match-making system which spawns rooms with custom code and sync its state with all connected clients.</p><p>Here’s an overview of how it works:</p><p><strong>Match-making cycle:</strong></p><p>1. User asks to connect in a specific room, with optional <strong>“join”</strong> arguments.</p><pre>// (client-side)<br>var Colyseus = new Colyseus(&quot;ws://localhost:3553&quot;);<br>var battleRoom = colyseus.join(&#39;battle&#39;, {options: &#39;here&#39;})</pre><p>2. Server will loop through all spawned room handlers named ‘battle’ and call <a href="https://github.com/endel/tanx/blob/bff333921a7b5c4cdc41b47135f2236f36f0ed56/rooms/battle_room.js#L153-L155">requestJoin</a> method against that handler.</p><pre>// (server-side)<br>// only accept new users if limit isn&#39;t reached<br>requestJoin (options) {<br>  return ( this.clients.length &lt; 12 )<br>}</pre><p>3. If <a href="https://github.com/endel/tanx/blob/bff333921a7b5c4cdc41b47135f2236f36f0ed56/rooms/battle_room.js#L153-L155">requestJoin</a> succeeds, a method named <a href="https://github.com/endel/tanx/blob/bff333921a7b5c4cdc41b47135f2236f36f0ed56/rooms/battle_room.js#L157-L164">onJoin</a> will be called with the client reference and client options given.</p><pre>// (server-side)<br>onJoin (client) {<br>  // setup new player here<br>}</pre><p>4. If <a href="https://github.com/endel/tanx/blob/bff333921a7b5c4cdc41b47135f2236f36f0ed56/rooms/battle_room.js#L153-L155">requestJoin</a> fails on every available room, a new handler will be spawned if requestJoin succeeds in a fresh handler state. In case it fails again, an ‘error’ event will be dispatched on client room instance.</p><pre>// (client-side)<br>battleRoom.on(&#39;error&#39;, function(message) {<br>  console.log(&quot;error triggered on battle room:&quot;, message)<br>})</pre><p><strong>Room state handling:</strong></p><p>Once the player received the room state <a href="https://github.com/endel/tanx/blob/bff333921a7b5c4cdc41b47135f2236f36f0ed56/rooms/battle_room.js#L158">upon its connection</a>, he only needs to receive the state difference on later broadcasts, called patches.</p><p>By default, room handlers will deliver the patched room state to all clients each 50ms.</p><pre>// (client-side)<br>battleRoom.on(&#39;update&#39;, function(newState, patches) {<br>  console.log(patches)  // array of patches<br>  console.log(newState) // newState with patches applied<br>})</pre><p>The array of patches usually look like this: (<a href="http://tools.ietf.org/html/rfc6902">JSON-Patch format</a>)</p><pre>[<br>  { &quot;op&quot;: &quot;remove&quot;, &quot;path&quot;: &quot;/players/N150OHMve&quot; },<br>  { &quot;op&quot;: &quot;add&quot;, &quot;path&quot;: &quot;/players/NkfeqSGPx&quot;, &quot;value&quot;: {&quot;x&quot;: 10, &quot;y&quot;: 10} },<br>  { &quot;op&quot;: &quot;replace&quot;, &quot;path&quot;: &quot;/players/NkfeqSGPx/x&quot;, &quot;value&quot;: 5 }<br>]<br>// JSON-Patch Spec - RFC6902</pre><p>You can take a look at <a href="https://github.com/endel/tanx/blob/master/frontend/client.js#L74-L116">patch handling on tanx project</a> to see how it looks like.</p><p>Here’s some game prototypes you can play online:</p><ul><li><a href="https://playcanvas.com/project/367035/overview/tanxcolyseus">PlayCanvas tanx fork</a> (original game is <a href="http://playcanv.as/p/aP0oxhUr">here</a>)</li><li><a href="http://ludumdare.com/compo/ludum-dare-35/?action=preview&amp;uid=50958">DoTower</a> (made in 72h for LD35)</li><li><a href="http://ludumdare.com/compo/ludum-dare-34/?action=preview&amp;uid=50958">Redneck River Race</a> (made in 72h for LD34)</li></ul><p>Colyseus’s code base still quite straightforward, which is good for its growth as a library. It doesn’t do much, but it tries to do really well what is meant to.</p><p>Thanks for reading until here, and feel free to ask questions on <a href="http://gitter.im/gamestdio/colyseus">gitter chat channel</a> in case you have any.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a29fe1cebbfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>