<?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>Javascript &#8211; Rotates.org V12</title>
	<atom:link href="https://www.rotates.org/category/webdev/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.rotates.org</link>
	<description>The personal blog of developer, photographer and designer Lewis &#039;SEPTiMUS&#039; Lane</description>
	<lastBuildDate>Thu, 26 Jun 2025 19:01:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.rotates.org/wp-content/uploads/2025/06/cropped-rotates-logo-32x32.png</url>
	<title>Javascript &#8211; Rotates.org V12</title>
	<link>https://www.rotates.org</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">6964888</site>	<item>
		<title>CodePen greatest hits pt. 1</title>
		<link>https://www.rotates.org/2025/06/26/codepen-greatest-hits-pt-1/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Thu, 26 Jun 2025 19:01:24 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Past]]></category>
		<category><![CDATA[Plugs]]></category>
		<guid isPermaLink="false">https://www.rotates.org/?p=399</guid>

					<description><![CDATA[I&#8217;ve always enjoyed short, snappy little projects that deliver a quick dose of dopamine, and I&#8217;m a big fan of CodePen as a way to exercise that &#8216;tinker and play&#8217; attitude. One of my earlier and more involved pens was the result of a thought: &#8220;What if 8-bit but open world?&#8221;. A great candidate seemed [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve always enjoyed short, snappy little projects that deliver a quick dose of dopamine, and I&#8217;m a big fan of <a href="https://codepen.io/lewster32">CodePen</a> as a way to exercise that &#8216;tinker and play&#8217; attitude.</p>



<p>One of my earlier and more involved pens was the result of a thought: <em>&#8220;What if 8-bit but open world?&#8221;</em>. A great candidate seemed to be Jet Set Willy, and luckily there&#8217;s an absolutely excellent <a href="https://skoolkit.ca/disassemblies/jet_set_willy/index.html">disassembly of the game</a> available. It was fascinating to dive into the data and see how efficiently everything was packed in there while remaining pretty readable. Before the days of widespread fast and convenient compression, programmers just squeezed things down to the last bit.</p>



<p>I ended up writing various routines to process things in a way that looked true to the original, including figuring out how to parse the attributes (the way the Speccy encoded colour and more into 8&#215;8 pixel blocks with a single byte) and generate all of the graphics, rooms and movement patterns.</p>



<p>It&#8217;s not complete unfortunately &#8211; the arrows and the rope swinging routine got the better of me at the time, but I still think it&#8217;s still a really cool little bit of nostalgia, and decently structured (for the time at least; this is pre-ES6 JavaScript).</p>



<p>Anyway, here it is in all its glory. Enjoy!</p>



<div class="wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper"><iframe id="cp_embed_MKQzPm" src="//codepen.io/anon/embed/MKQzPm?height=450&amp;theme-id=dark&amp;slug-hash=MKQzPm&amp;default-tab=result" height="450" scrolling="no" frameborder="0" allowfullscreen allowpaymentrequest name="CodePen Embed MKQzPm" title="CodePen Embed MKQzPm" class="cp_embed_iframe" style="width:100%;overflow:hidden">CodePen Embed Fallback</iframe></div>



<p>I quite like the big comment attempting to explain all the bitwise stuff:</p>



<pre class="wp-block-code" style="font-size:12px"><code>    // The attribute format is a single byte containing 2x 1-bit values for flash and bright, then 2x 3-bit values for paper and ink
    // So the value 221 (binary 11011101) broken down becomes flash 1 (1), bright 1 (1), paper 011 (3) and ink 101 (5)
    // To extract these, we perform up to two operations:
    // 1. We perform a bitwise AND on the value with a bitmask of corresponding length for how many bits you want to extract - if 
    // we're looking for a boolean here (using a single bit in the mask), we can just coerce it with the !! operator as the outcome
    // will be zero for false and non-zero for true
    // 2. We perform a bitwise shift to the right so that the bits we're interested in are at far right side
    //
    // Examples:
    // To get the bright value (1 - true) from 221 (11011101):
    // 221 &amp; 64 = 64  (binary: 11001101 AND 01000000 becomes 01000000)
    // !!64 = true    (binary: 01000000 is non-zero, so it becomes true)
    //
    // To get the paper value (3) from 221 (11011101):
    // 221 &amp; 56 = 24  (binary: 11011101 AND 00111000 becomes 00011000)
    // 24 &gt;&gt; 3  = 3   (binary: 00011000 shifted right 3 times becomes 00000011)
    //
    // Quite a nice explanation of what you can do with bitwise operators can be found here:
    // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators
    // 
    // P.S. I revised this whole intro in September 2020 as I realised I didn't understand bitwise operations as well as I should
    // have. Littered throughout this code are examples of the old inefficient method of "shift then and", as opposed to the
    // 'correct' way of doing things (especially for single bits). No doubt there's more on this for me to learn but it's good to
    // be honest.</code></pre>



<p>I&#8217;ll write up a few more of these for other pens I&#8217;ve done if there&#8217;s any interest. Let me know in the comments or via one of my socials if you&#8217;d like to know more about any of these, or indeed anything else I&#8217;ve done!</p>



<ul class="wp-block-social-links is-layout-flex wp-block-social-links-is-layout-flex"><li class="wp-social-link wp-social-link-bluesky  wp-block-social-link"><a href="https://bsky.app/profile/lewster32.dev" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M6.3,4.2c2.3,1.7,4.8,5.3,5.7,7.2.9-1.9,3.4-5.4,5.7-7.2,1.7-1.3,4.3-2.2,4.3.9s-.4,5.2-.6,5.9c-.7,2.6-3.3,3.2-5.6,2.8,4,.7,5.1,3,2.9,5.3-5,5.2-6.7-2.8-6.7-2.8,0,0-1.7,8-6.7,2.8-2.2-2.3-1.2-4.6,2.9-5.3-2.3.4-4.9-.3-5.6-2.8-.2-.7-.6-5.3-.6-5.9,0-3.1,2.7-2.1,4.3-.9h0Z"></path></svg><span class="wp-block-social-link-label screen-reader-text">Bluesky</span></a></li>

<li class="wp-social-link wp-social-link-x  wp-block-social-link"><a href="https://x.com/lewster32" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z" /></svg><span class="wp-block-social-link-label screen-reader-text">X</span></a></li>

<li class="wp-social-link wp-social-link-codepen  wp-block-social-link"><a href="https://codepen.io/lewster32" class="wp-block-social-link-anchor"><svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M22.016,8.84c-0.002-0.013-0.005-0.025-0.007-0.037c-0.005-0.025-0.008-0.048-0.015-0.072 c-0.003-0.015-0.01-0.028-0.013-0.042c-0.008-0.02-0.015-0.04-0.023-0.062c-0.007-0.015-0.013-0.028-0.02-0.042 c-0.008-0.02-0.018-0.037-0.03-0.057c-0.007-0.013-0.017-0.027-0.025-0.038c-0.012-0.018-0.023-0.035-0.035-0.052 c-0.01-0.013-0.02-0.025-0.03-0.037c-0.015-0.017-0.028-0.032-0.043-0.045c-0.01-0.012-0.022-0.023-0.035-0.035 c-0.015-0.015-0.032-0.028-0.048-0.04c-0.012-0.01-0.025-0.02-0.037-0.03c-0.005-0.003-0.01-0.008-0.015-0.012l-9.161-6.096 c-0.289-0.192-0.666-0.192-0.955,0L2.359,8.237C2.354,8.24,2.349,8.245,2.344,8.249L2.306,8.277 c-0.017,0.013-0.033,0.027-0.048,0.04C2.246,8.331,2.234,8.342,2.222,8.352c-0.015,0.015-0.028,0.03-0.042,0.047 c-0.012,0.013-0.022,0.023-0.03,0.037C2.139,8.453,2.125,8.471,2.115,8.488C2.107,8.501,2.099,8.514,2.09,8.526 C2.079,8.548,2.069,8.565,2.06,8.585C2.054,8.6,2.047,8.613,2.04,8.626C2.032,8.648,2.025,8.67,2.019,8.69 c-0.005,0.013-0.01,0.027-0.013,0.042C1.999,8.755,1.995,8.778,1.99,8.803C1.989,8.817,1.985,8.828,1.984,8.84 C1.978,8.879,1.975,8.915,1.975,8.954v6.093c0,0.037,0.003,0.075,0.008,0.112c0.002,0.012,0.005,0.025,0.007,0.038 c0.005,0.023,0.008,0.047,0.015,0.072c0.003,0.015,0.008,0.028,0.013,0.04c0.007,0.022,0.013,0.042,0.022,0.063 c0.007,0.015,0.013,0.028,0.02,0.04c0.008,0.02,0.018,0.038,0.03,0.058c0.007,0.013,0.015,0.027,0.025,0.038 c0.012,0.018,0.023,0.035,0.035,0.052c0.01,0.013,0.02,0.025,0.03,0.037c0.013,0.015,0.028,0.032,0.042,0.045 c0.012,0.012,0.023,0.023,0.035,0.035c0.015,0.013,0.032,0.028,0.048,0.04l0.038,0.03c0.005,0.003,0.01,0.007,0.013,0.01 l9.163,6.095C11.668,21.953,11.833,22,12,22c0.167,0,0.332-0.047,0.478-0.144l9.163-6.095l0.015-0.01 c0.013-0.01,0.027-0.02,0.037-0.03c0.018-0.013,0.035-0.028,0.048-0.04c0.013-0.012,0.025-0.023,0.035-0.035 c0.017-0.015,0.03-0.032,0.043-0.045c0.01-0.013,0.02-0.025,0.03-0.037c0.013-0.018,0.025-0.035,0.035-0.052 c0.008-0.013,0.018-0.027,0.025-0.038c0.012-0.02,0.022-0.038,0.03-0.058c0.007-0.013,0.013-0.027,0.02-0.04 c0.008-0.022,0.015-0.042,0.023-0.063c0.003-0.013,0.01-0.027,0.013-0.04c0.007-0.025,0.01-0.048,0.015-0.072 c0.002-0.013,0.005-0.027,0.007-0.037c0.003-0.042,0.007-0.079,0.007-0.117V8.954C22.025,8.915,22.022,8.879,22.016,8.84z M12.862,4.464l6.751,4.49l-3.016,2.013l-3.735-2.492V4.464z M11.138,4.464v4.009l-3.735,2.494L4.389,8.954L11.138,4.464z M3.699,10.562L5.853,12l-2.155,1.438V10.562z M11.138,19.536l-6.749-4.491l3.015-2.011l3.735,2.492V19.536z M12,14.035L8.953,12 L12,9.966L15.047,12L12,14.035z M12.862,19.536v-4.009l3.735-2.492l3.016,2.011L12.862,19.536z M20.303,13.438L18.147,12 l2.156-1.438L20.303,13.438z"></path></svg><span class="wp-block-social-link-label screen-reader-text">CodePen</span></a></li></ul>



<p></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">399</post-id>	</item>
		<item>
		<title>Phaser Isometric plug-in</title>
		<link>https://www.rotates.org/2014/08/08/phaser-isometric-plug-in/</link>
					<comments>https://www.rotates.org/2014/08/08/phaser-isometric-plug-in/#comments</comments>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Fri, 08 Aug 2014 14:53:43 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Phaser Isometric]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[axonometric]]></category>
		<category><![CDATA[dimetric]]></category>
		<category><![CDATA[Isometric]]></category>
		<category><![CDATA[Phaser]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[plugin]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=358</guid>

					<description><![CDATA[Recently, as part of my continued work on Archaos (yes, I&#8217;m still working on it, never fear!) I put together an isometric (well, axonometric to be a little less precise) renderer for Richard Davey&#8216;s wonderful Phaser HTML5 game development framework. It&#8217;s got a nice adjustable axonometric projection helper, a simple and fast physics engine based on [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Recently, as part of my continued work on Archaos (yes, I&#8217;m still working on it, never fear!) I put together an isometric (well, axonometric to be a little <em>less</em> precise) renderer for <a href="http://twitter.com/photonstorm" target="_blank" rel="noopener noreferrer">Richard Davey</a>&#8216;s wonderful <a href="http://phaser.io" target="_blank" rel="noopener noreferrer">Phaser</a> HTML5 game development framework. It&#8217;s got a nice adjustable axonometric projection helper, a simple and fast physics engine based on Phaser&#8217;s own bread-and-butter Arcade Physics, and it&#8217;s probably close to production ready. I deliberately kept the system simple, and the API as close to the existing Phaser API as possible to allow for quick adoption, and it plugs in pretty much seamlessly.</p>
<p>You can view the microsite I put together for it <a href="http://rotates.org/phaser/iso" target="_blank" rel="noopener noreferrer">here</a>, browse the repo (and maybe even if you feel like it, or spot some of my horrendous and inevitable broken maths, contribute) on GitHub <a href="https://github.com/lewster32/phaser-plugin-isometric/" target="_blank" rel="noopener noreferrer">here</a>, view the API docs <a href="http://udof.org/phaser/iso/doc/Phaser.Plugin.Isometric.html" target="_blank" rel="noopener noreferrer">here</a>, and I&#8217;ll also be posting some simple examples to demonstrate the various features shortly. Enjoy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rotates.org/2014/08/08/phaser-isometric-plug-in/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">358</post-id>	</item>
		<item>
		<title>Future proofing</title>
		<link>https://www.rotates.org/2013/03/23/future-proofing/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Sat, 23 Mar 2013 20:26:31 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[NodeJS]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=337</guid>

					<description><![CDATA[For the last few weeks I&#8217;ve been adding in two very important systems to Archaos &#8211; namely real-time communications via TCP, and the use of a database back-end for the server. The first makes games much more responsive, and allows the server to inform connected players of actions as and when they happen. It will [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>For the last few weeks I&#8217;ve been adding in two very important systems to Archaos &#8211; namely real-time communications via TCP, and the use of a database back-end for the server. The first makes games much more responsive, and allows the server to inform connected players of actions as and when they happen. It will also pave the way for an exciting addition I have planned, which will (hopefully) combat the inevitable pacing problems that arise from typical turn-based games. If you want to know more about what I&#8217;m getting at, give <a href="http://www.lostgarden.com/2005/06/space-crack-fixing-turn-based-strategy.html" target="_blank">this excellent article</a> a read.</p>
<p><div id="attachment_339" style="width: 213px" class="wp-caption alignright"><a href="https://rotates.org/wp-content/uploads/2013/03/servers.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-339" class="size-medium wp-image-339" alt="The database server, client and game server respectively." src="https://rotates.org/wp-content/uploads/2013/03/servers-203x300.png" width="203" height="300" srcset="https://www.rotates.org/wp-content/uploads/2013/03/servers-203x300.png 203w, https://www.rotates.org/wp-content/uploads/2013/03/servers.png 514w" sizes="(max-width: 203px) 100vw, 203px" /></a><p id="caption-attachment-339" class="wp-caption-text">The database server, client and game server respectively.</p></div></p>
<p>The second addition is a solid database-driven server. Until now, as a temporary solution I&#8217;d been storing all of the game data in a single file. When the server opened, it read all of the users and games from this file, and then stored all of the data in memory. If the data changed, the server would periodically save the entire file back to disk. The server would only write the data to disk if it had changed, and only once every so often &#8211; this kept writes to a minimum. The solution was fine for small scale testing, but it would not have scaled up well &#8211; quickly consuming all of the memory in the server machine, as well as being difficult to manage.</p>
<p>Now all of the data is stored on a <a href="http://www.mongodb.org/" target="_blank">mongoDB</a> server in essentially the same format. The game server is then only responsible for the manipulation of the data, and not the storage and management of it. The game server itself is relatively simple in its approach; when a user sends an action, it loads the game, determines if the action can be performed, and if so what the outcomes are. It then saves the changed game back to the database and sends the actions to all of the connected players (which it does via TCP). The game server never keeps games, users, units or anything else in memory for longer than it needs to check or manipulate it. There are no special objects or instances; every function works only on the raw data. I may introduce some caching to reduce database operations later but at this stage the setup is fairly efficient.</p>
<p>So, I have what I feel is a solid base now, I&#8217;ve got some of the actions in and working (such as creating, joining and leaving games, unit movement and engagement) and now it&#8217;s just a case of writing the client-side stuff for the remaining actions, adding in the spell system and then getting it out there for public beta testing!</p>
<p>Look out soon for another post on the spell system and how I intend to tweak it to provide a more balanced start to each game.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">337</post-id>	</item>
		<item>
		<title>Expressing my love</title>
		<link>https://www.rotates.org/2012/01/04/expressing-my-love/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Wed, 04 Jan 2012 00:24:06 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[Projects]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=255</guid>

					<description><![CDATA[Over the last few days I&#8217;ve been planning, and then implementing the RESTful communication part of the server, and this has been built on top of Express&#8216;s fantastic routing. The next few days will see me implementing the rest of the current game logic on top of this routing, using the HTTP GET and POST [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Over the last few days I&#8217;ve been planning, and then implementing the RESTful communication part of the server, and this has been built on top of <a href="http://expressjs.com/" target="_blank">Express</a>&#8216;s fantastic routing. The next few days will see me implementing the rest of the current game logic on top of this routing, using the HTTP GET and POST methods and simple URI schemes in order to provide any client with a stateless, efficient way of communicating with the server.</p>
<p>For example, a client could request &#8216;<code>/games</code>&#8216; from the server and receive a list of games, each with its vital stats (players, board size etc). A client can then request to see more on an individual game by requesting &#8216;<code>/games/game01</code>&#8216; for instance. A client can then finally choose to get the status of the game from a particular point via &#8216;<code>/games/game01/update/20</code>&#8216; which will return all the actions from action 20 and above, or alternatively the client can request &#8216;<code>/games/game01/update/1325635230240</code>&#8216; which retrieves the actions from after that timestamp. The server determines whether a request called for a timestamp or an action ID easily because of the huge numerical difference between the likely amount of actions in a game and the value of a typical timestamp.</p>
<p>I have also decided (for now at least) to focus on JSON as the primary format for data from the server &#8211; I had intended to explore other formats such as XML, <a href="http://bsonspec.org/" target="_blank">BSON</a> and <a href="http://msgpack.org/" target="_blank">MessagePack</a> but keeping things in JSON seems to be efficient enough at the moment.</p>
<p>Once the server is returning everything correctly using this new URI structure, I&#8217;ll shift my focus to the client for a while, and get some of the boring stuff such as creating/editing users and access control sorted out. I&#8217;m being purposely very careful about having something solid and playable before I go and start with the spell phase, and all of the delightful things that brings with it!</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">255</post-id>	</item>
		<item>
		<title>Errors and actions</title>
		<link>https://www.rotates.org/2011/12/18/errors-actions/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Sun, 18 Dec 2011 01:22:59 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[Javascript]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=248</guid>

					<description><![CDATA[I&#8217;ve been getting into a routine of testing, re-writing and bolstering everything over the past week or two. This is in direct contrast to my usual routine of writing massive blocks of code without testing, then firing it up and watching it fail in multiple places, then lose the will to continue (something perhaps familiar [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve been getting into a routine of testing, re-writing and bolstering everything over the past week or two. This is in direct contrast to my usual routine of writing massive blocks of code without testing, then firing it up and watching it fail in multiple places, then lose the will to continue (something perhaps familiar to many developers) &#8211; so this time making sure every routine is working efficiently and giving me verbose feedback in every possible situation has been high on my priority list.</p>
<p>Tonight I implemented error codes and matching error messages &#8211; boring I know, but it&#8217;s just one of many steps I&#8217;ve taken to make sure I know when things aren&#8217;t working, and to make the client/server architecture as bullet-proof as possible. All this work at the front-end is to make sure that when the server&#8217;s launched, it&#8217;ll have a really easy to use API. One of my major goals after all is to make this an &#8216;open&#8217; Chaos server, and invite front-end developers to produce their own ports for various platforms &#8211; indeed it should be very possible to write a front-end for a Spectrum using the same graphics, sounds and so on!</p>
<p>One of the other things I&#8217;ve implemented is a step-by-step list of actions for each game. The stored game data contains a current snapshot of the game, active players, unit positions etc &#8211; but it also now contains a blow-by-blow account of the entire game from when it&#8217;s created, as players join and then start playing. Clients will then be able to store a timestamp (returned from the server after each action they perform) and then put out polled or long-polled requests for updates from the server, quoting that timestamp. Once the server processes new actions, it can return those actions to the requesting client in the correct order (so for instance, if a player moves their wizard in the first turn, the server automatically advances to the next player as they no longer have any units to move &#8211; this logs two actions, a unit movement and then a &#8220;next user&#8217;s turn&#8221; action). Clients may choose to return actions from any timestamp, so as long as the client knows when it last got an update, it can always stay in sync. The client may also optionally request all the actions, in effect providing a way of replaying an entire game, or it can just request a &#8216;refresh&#8217;, which sends the client a snapshot of the game as it stands, with all the data it needs to resume the game from scratch.</p>
<p>Here&#8217;s an example of a typical update:</p>
<pre class="javascript" name="code">{

    "response": {
        "success": [
            {
                "id": 8,
                "action": {
                    "turn": 3,
                    "currentPlayer": 0
                },
                "time": 1324168638420
            },
            {
                "id": 9,
                "action": {
                    "moved": {
                        "id": "wizard_0",
                        "from": {
                            "x": 3,
                            "y": 5
                        },
                        "to": {
                            "x": 4,
                            "y": 5
                        }
                    }
                },
                "time": 1324168655828
            },
            {
                "id": 10,
                "action": {
                    "turn": 3,
                    "currentPlayer": 1
                },
                "time": 1324168655828
            }
        ]
    },
    "currentTime": 1324168722155

}</pre>
<p>So far, I have a very solid base &#8211; board sizes and player counts are limitless and the server will automatically position wizards in a &#8216;Chaos-like&#8217; arrangement around the board, regardless of size, shape or number of wizards, or at least up to 8 wizards, after that I need to write a routine to automatically space them &#8211; probably via some kind of circular distribution. Although spell casting isn&#8217;t yet implemented, units are and can be created by manually editing the game data &#8211; so I&#8217;ve had a wizard and his hydra happily moving around the board to my infinite satisfaction.</p>
<p>Next to be done is the combat routines &#8211; which will lead to the invariably sticky (though hopefully MUCH more manageable) death routine, which is always a bit of a pain with Chaos. Remember, some units die, some units disappear, some units (wizards) disappear and trigger a player defeated routine, blobs engulf, magic fire destroys outright and leaves no corpse, wizards on mounts if attacked by units lose their mount, but if overrun by magic fire disappear and trigger a player defeated routine and so on and on.</p>
<p>Plainly remaking Chaos is not as simple as it seems.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">248</post-id>	</item>
		<item>
		<title>Merry Christmas, happy new year and so on</title>
		<link>https://www.rotates.org/2011/03/12/merry-christmas-happy-new-year-and-so-on/</link>
					<comments>https://www.rotates.org/2011/03/12/merry-christmas-happy-new-year-and-so-on/#comments</comments>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Sat, 12 Mar 2011 02:01:17 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Projects]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=238</guid>

					<description><![CDATA[First of all, apologies for not updating in yonks &#8211; I could give you the usual programmer excuses about real life, work and so on but you&#8217;ve heard them all before, so I&#8217;ll dive right in to what I&#8217;ve been doing: Archaos is very, very slowly moving along &#8211; we&#8217;re talking geologically slow here, but [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>First of all, apologies for not updating in yonks &#8211; I could give you the usual programmer excuses about real life, work and so on but you&#8217;ve heard them all before, so I&#8217;ll dive right in to what I&#8217;ve been doing:</p>
<p><a href="http://chaosremakes.wikia.com/wiki/Archaos" target="_blank">Archaos</a> is very, very slowly moving along &#8211; we&#8217;re talking geologically slow here, but nonetheless there&#8217;s still a roadmap and there&#8217;s still progress on it. My aim now is to have a release before my 30th birthday (next year) and I&#8217;ll be damned if I don&#8217;t make it!</p>
<p>I&#8217;ve been experimenting with presentation and so on, and came up with a <a href="https://rotates.orgarchaos/isotest.htm" target="_blank">little thing</a> tonight which I thought was quite cute.  I&#8217;m really feeling the love for CSS3 and HTML5 now.</p>
<p><a href="http://www.wordpress.org/" target="_blank">WordPress</a> has become my new powerhouse tool at work, and I&#8217;ve been churning out sites left, right and centre in this wonderful blog engine turned CMS (as of 3.1 especially so) &#8211; check out some of the following:</p>
<ul>
<li><a href="http://www.redboxdesign.com/" target="_blank">www.lovegeobar.com</a></li>
<li><a href="http://www.communityfoundation.org.uk" target="_blank">www.communityfoundation.org.uk</a></li>
<li><a href="http://www.redboxdesign.com/" target="_blank">www.redboxdesign.com</a></li>
</ul>
<p>The last is our most recent project, and is very much not a site you&#8217;d expect to be WordPress powered &#8211; such is its flexibility!</p>
<p>I don&#8217;t update on <a href="http://twitter.com/lewster32">Twitter</a> much anymore, as it&#8217;s become a bit of a joke now with all of the celebrities and ridiculous trends; it pains me to say it but I think Twitter is more about Justin Bieber now than anything sensible. Alas, I spend most of my social networking time now on <a href="http://www.facebook.com/lewster32">Facebook</a>.</p>
<p>Finally, I&#8217;ve booked a flight to Arizona in September for a two week photography road trip with two of my good friends &#8211; should be awesome!</p>
<p>Anyway, hopefully that&#8217;s got everyone up to speed on what I&#8217;m doing &#8211; keep your eyes peeled in the coming months for updates on Archaos and other projects.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rotates.org/2011/03/12/merry-christmas-happy-new-year-and-so-on/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">238</post-id>	</item>
		<item>
		<title>Full cycle</title>
		<link>https://www.rotates.org/2010/01/16/full-cycle/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Sat, 16 Jan 2010 23:26:20 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Plugs]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=197</guid>

					<description><![CDATA[The Archaos server now validates, processes and outputs a full turn of human interactions. This is a pretty major milestone in the development process, and I&#8217;m very happy with the results so far: { "turn" : 1, "phase" : "move", "interaction" : "sequence", "finished" : true, "actions" : [ { "type" : "move", "player" : [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The Archaos server now validates, processes and outputs a full turn of human interactions. This is a pretty major milestone in the development process, and I&#8217;m very happy with the results so far:</p>
<pre name="code" class="javascript">{
  "turn" : 1,
  "phase" : "move",
  "interaction" : "sequence",
  "finished" : true,
  "actions" : [
    {
      "type" : "move",
      "player" : "lewster32",
      "time" : 1263682234,
      "data" : {
        "piece" : "p0",
        "path" : [
          {
            "x" : 1,
            "y" : 7
          }
        ]
      }
    },
    {
      "type" : "end_turn",
      "player" : "lewster32",
      "time" : 1263682234
    },
    {
      "type" : "move",
      "player" : "bobster16",
      "time" : 1263682234,
      "data" : {
        "piece" : "p1",
        "path" : [
          {
            "x" : 13,
            "y" : 5
          }
        ]
      }
    },
    {
      "type" : "move",
      "player" : "bobster16",
      "time" : 1263682234,
      "data" : {
        "piece" : "p3",
        "path" : {
          "x" : 11,
          "y" : 4
        },
        "flying" : true
      }
    },
    {
      "type" : "end_turn",
      "player" : "bobster16",
      "time" : 1263682234
    }
  ]
}
</pre>
<p>I&#8217;d like to mention the huge amount of support, encouragement and fantastic resources provided by certain people of late. <a href="http://twitter.com/andy_herbert">@andy_herbert</a> has been a fantastic vocal advocate and provider of much inspiration and technical knowhow (he&#8217;s an utterly brilliant multi-talented programmer in his own right) and I owe an awful lot to his &#8216;cheery&#8217; tone on Twitter! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Secondly, I&#8217;d like to shout out a big hello to the <a href="http://slashdot.org">Slashdot</a> horde, who accosted the site a few days back. I got a hell of a lot of visits from these guys and I&#8217;m sure it&#8217;s helped spread the word about Archaos (even if that wasn&#8217;t actually my intention) and more importantly the Chaos scene in general!</p>
<p><img decoding="async" class="aligncenter size-full wp-image-198" title="slashdotted" src="https://rotates.org/wp-content/uploads/2010/01/slashdotted.png" alt="" width="555" height="232" srcset="https://www.rotates.org/wp-content/uploads/2010/01/slashdotted.png 555w, https://www.rotates.org/wp-content/uploads/2010/01/slashdotted-300x125.png 300w" sizes="(max-width: 555px) 100vw, 555px" /></p>
<p>Finally, a big thanks to <a href="http://twitter.com/Zolyx">@Zolyx</a> for mentioning the project on his <a href="http://www.zolyx.co.uk/">blog</a> along with the other fantastic Chaos projects out there &#8211; muchos appreciated!</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">197</post-id>	</item>
		<item>
		<title>nodelog IRC bot</title>
		<link>https://www.rotates.org/2010/01/10/nodelog-irc-bot/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Sun, 10 Jan 2010 02:43:58 +0000</pubDate>
				<category><![CDATA[NodeJS]]></category>
		<category><![CDATA[NodeLog]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[mirc]]></category>
		<category><![CDATA[node]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=194</guid>

					<description><![CDATA[As a little bit of an aside to &#8216;the main project&#8217; , I&#8217;ve been getting more familiar with node.js by forking a nice simple IRC bot project on github. At the moment I&#8217;ve just got it logging in an mIRC compatible format, and added some missing features to the logging, but in the future I&#8217;m [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>As a little bit of an aside to &#8216;the main project&#8217; , I&#8217;ve been getting more familiar with <a href="http://nodejs.org">node.js</a> by <a href="http://github.com/lewster32/nodelog">forking</a> a nice simple <a href="http://github.com/felixge/nodelog">IRC bot project</a> on github. At the moment I&#8217;ve just got it logging in an mIRC compatible format, and added some missing features to the logging, but in the future I&#8217;m going to extend it into a proper modular IRC bot.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">194</post-id>	</item>
		<item>
		<title>Non techies avert your eyes</title>
		<link>https://www.rotates.org/2010/01/04/non-techies-avert-your-eyes/</link>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Mon, 04 Jan 2010 00:34:39 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[actions]]></category>
		<category><![CDATA[board]]></category>
		<category><![CDATA[chaos]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[mechanics]]></category>
		<category><![CDATA[piece]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[spell]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=190</guid>

					<description><![CDATA[The server is really starting to take shape now. Turns and phases flow along nicely, and I&#8217;ve spent the last few days working on the spellcasting system. If you&#8217;ve read the Google Code page on Spells you&#8217;ll know that the spells themselves are simply sandboxed Javascript functions. I had thoughts before about writing some kind [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The server is really starting to take shape now. Turns and phases flow along nicely, and I&#8217;ve spent the last few days working on the spellcasting system. If you&#8217;ve read the Google Code page on <a href="http://code.google.com/p/archaos/wiki/Spells">Spells</a> you&#8217;ll know that the spells themselves are simply sandboxed Javascript functions. I had thoughts before about writing some kind of scripting language for the spells because I wanted maximum flexibility, but it dawned on me that simply giving the spells access to the game and board data themselves in the native language would be the best way to do it. I also not long after that thought about making the validation step the spell goes through beforehand (i.e. where it tells you you can&#8217;t cast the spell here, or you can&#8217;t cast it on this piece or whatever) in a similar manner, but subsequently rejected it for one very good reason: the clients also need to validate at their end, and they may not be written in Javascript!</p>
<p>For those interested in creating a client (and because the code isn&#8217;t yet ready for viewing!) here&#8217;s the current output of a test run on the server. Note that games, pieces and spells have a unique game ID, which is a letter followed by an incrementing numeric value. One of the current things I&#8217;m working on is cleaning up the code so all possible references are made to these UIDs, and not directly to the objects, as this will make things safer and more manageable within the engine at the expense of a little bit of performance (no doubt I&#8217;ll rewrite much of this at a later date so there are two &#8216;levels&#8217; of code; the UID data-driven level that the users interact with, and the deeper object-driven stuff that processes things.</p>
<pre class="javascript" name="code">{
  "turn" : 1,
  "phase" : "select_spell",
  "interaction" : "all",
  "finished" : true,
  "actions" : [
    {
      "type" : "select_spell",
      "player" : "lewster32",
      "time" : 1262563476,
      "data" : {
        "spell" : "s0"
      }
    },
    {
      "type" : "select_spell",
      "player" : "bobster16",
      "time" : 1262563476,
      "data" : {
        "spell" : "s6"
      }
    }
  ]
}
</pre>
<pre class="javascript" name="code">{
  "turn" : 1,
  "phase" : "cast",
  "interaction" : "sequence",
  "finished" : true,
  "actions" : [
    {
      "type" : "cast",
      "player" : "lewster32",
      "time" : 1262563476,
      "data" : {
        "spell" : "s0",
        "target" : {
          "x" : 0,
          "y" : 1
        }
      }
    },
    {
      "type" : "spawn",
      "player" : "lewster32",
      "time" : 1262563476,
      "data" : {
        "x" : 0,
        "y" : 1,
        "occupant" : {
          "uid" : "p2",
          "owner" : "lewster32",
          "properties" : {
            "movement" : 1,
            "combat" : 7,
            "defense" : 8,
            "maneuver" : 6,
            "resistance" : 4
          }
        }
      }
    },
    {
      "type" : "succeeded",
      "player" : "lewster32",
      "time" : 1262563476,
      "data" : {
        "spell" : "s0",
        "target" : {
          "x" : 0,
          "y" : 1
        }
      }
    },
    {
      "type" : "end_turn",
      "player" : "lewster32",
      "time" : 1262563476
    },
    {
      "type" : "cast",
      "player" : "bobster16",
      "time" : 1262563476,
      "data" : {
        "spell" : "s6",
        "target" : {
          "x" : 11,
          "y" : 1
        }
      }
    },
    {
      "type" : "spawn",
      "player" : "bobster16",
      "time" : 1262563476,
      "data" : {
        "x" : 11,
        "y" : 1,
        "occupant" : {
          "uid" : "p3",
          "owner" : "bobster16",
          "properties" : {
            "movement" : 1,
            "combat" : 6,
            "defense" : 5,
            "maneuver" : 2,
            "resistance" : 4
          }
        }
      }
    },
    {
      "type" : "succeeded",
      "player" : "bobster16",
      "time" : 1262563476,
      "data" : {
        "spell" : "s6",
        "target" : {
          "x" : 11,
          "y" : 1
        }
      }
    },
    {
      "type" : "end_turn",
      "player" : "bobster16",
      "time" : 1262563476
    }
  ]
}
</pre>
<p>These are what every player will receive at the end of each phase. They contain each action performed by the players in the order that they performed them, and timestamped for reference and backup purposes. Players have relatively limited access to the game in terms of actions, just like in the original game. A player may select spells, cast spells, move and attack pieces and end their turn. From these actions however, more actions may occur, so a player casting a spell on tile x will set off a chain of actions, where the server rolls against the spell&#8217;s chance, then (if successful) performs the spell&#8217;s effect, which may be to spawn a new piece or whatever.</p>
<p>Soon I&#8217;ll be locking down the format of these outputs, and documenting the errors and notices a user receives directly. This will allow for anyone wishing to do so to begin planning or working on a client &#8211; and I sincerely hope people do!</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">190</post-id>	</item>
		<item>
		<title>Progress</title>
		<link>https://www.rotates.org/2009/12/31/progress-2/</link>
					<comments>https://www.rotates.org/2009/12/31/progress-2/#comments</comments>
		
		<dc:creator><![CDATA[SEPTiMUS]]></dc:creator>
		<pubDate>Thu, 31 Dec 2009 17:40:34 +0000</pubDate>
				<category><![CDATA[Archaos]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[validation]]></category>
		<guid isPermaLink="false">http://www.rotates.org/?p=187</guid>

					<description><![CDATA[Just a small update to let everyone know I&#8217;m still working feverishly on Archaos&#8217;s server. It&#8217;s looking pretty good at the moment, and the server currently features: Creating games Joining and leaving games Creating and moving pieces on the board Extensive move validation (bounds checking, path checking, engagement checking etc) A customisable turn/phase system (this [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Just a small update to let everyone know I&#8217;m still working feverishly on Archaos&#8217;s server. It&#8217;s looking pretty good at the moment, and the server currently features:</p>
<ul>
<li>Creating games</li>
<li>Joining and leaving games</li>
<li>Creating and moving pieces on the board</li>
<li>Extensive move validation (bounds checking, path checking, engagement checking etc)</li>
<li>A customisable turn/phase system (this has been an absolute pain in the arse to implement &#8211; but it appears to be working as intended now)</li>
<li>Full JSON messaging system (you talk to the server in JSON and it talks back to you in JSON, there&#8217;re no sockets, special protocols or proprietary formats)</li>
</ul>
<p>The Google Code wiki is somewhat out of date (already!) as things slot into place during development, and I&#8217;ll update it as things become more solid. I&#8217;m currently using a private SVN, though as the project nears a working first version (and if there&#8217;s any interest) I&#8217;ll be happy to give access to the SVN &#8211; there&#8217;s a lot of experience and expertise out there, and I&#8217;d greatly appreciate a second opinion on aspects of the code!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rotates.org/2009/12/31/progress-2/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">187</post-id>	</item>
	</channel>
</rss>
