<?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>asgaard</title>
  <description></description>
  <link>https://blog.asgaard.co.uk/2012</link>
  <lastBuildDate>Tue, 12 May 26 17:16:00 +0000</lastBuildDate>
  <language>en</language>
  <count>38</count>
  <offset>0</offset>
      <item>
    <title>PlanetSide 2 is pay-to-win, and this is bad.</title>
    <link>https://blog.asgaard.co.uk/2012/12/26/planetside-2-is-pay-to-win-and-this-is-bad</link>
    <pubDate>Wed, 26 Dec 12 23:38:19 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/12/26/planetside-2-is-pay-to-win-and-this-is-bad</guid>
    <description><![CDATA[
<p>
Air vehicles in PS2 are completely broken. They are extremely powerful and made even more deadly by the fact that there are no strongly effective ways to destroy them from the ground. They are effective against infantry and armour. Heavy tanks can be virtually instagibbed by a well aimed rear rocket attack from a fighter.
<p>
There are weak counters to air: lock-on AA rockets and flak cannons (the MAX&#039;s burster). But lock-on rockets are prohibitively expensive. They cost 1000 certs. In game terms, you tend to gain certs at a rate of about 30-40 an hour [edit: actually, I&#039;ve just done the arithmetic on my <a href='http://www.planetside-universe.com/character.php?stats=zilt0id' rel='external'>PS Universe stats</a>, and it&#039;s exactly 30 an hour]. That&#039;s (at least) 25 hours of play to buy *one* item, which is comparatively pretty weak!
<p>
The MAX has a single burster by default. It&#039;s very effective at getting a fighter down to about 50% hit points before it decides it&#039;s time to tootle off and repair. There is absolutely no chance of taking down a competent pilot who engages wit[...]]]></description>
    <content:encoded><![CDATA[
<p>
Air vehicles in PS2 are completely broken. They are extremely powerful and made even more deadly by the fact that there are no strongly effective ways to destroy them from the ground. They are effective against infantry and armour. Heavy tanks can be virtually instagibbed by a well aimed rear rocket attack from a fighter.
<p>
There are weak counters to air: lock-on AA rockets and flak cannons (the MAX&#039;s burster). But lock-on rockets are prohibitively expensive. They cost 1000 certs. In game terms, you tend to gain certs at a rate of about 30-40 an hour [edit: actually, I&#039;ve just done the arithmetic on my <a href='http://www.planetside-universe.com/character.php?stats=zilt0id' rel='external'>PS Universe stats</a>, and it&#039;s exactly 30 an hour]. That&#039;s (at least) 25 hours of play to buy *one* item, which is comparatively pretty weak!
<p>
The MAX has a single burster by default. It&#039;s very effective at getting a fighter down to about 50% hit points before it decides it&#039;s time to tootle off and repair. There is absolutely no chance of taking down a competent pilot who engages with most of his vehicle&#039;s hit points intact. A second burster will have a good chance of killing a pilot who makes a misjudgement, but again, it&#039;s prohibitively expensive.
<p>
Of course, you *can* unlock these weapons by grinding. But it doesn&#039;t make sense to invest your first 50 hours in the game in only two upgrades for your character, especially at the cost of smaller, varied upgrades to your damage resistance and general killing power. In reality, unless you are willing to put in actual cash into the game, it will be a long time before you are effectively equipped to repel air units.
<p>
Ironically, air units by default aren&#039;t *overly* dangerous against the ground. It&#039;s just once they have their own respective (prohibitively expensive) upgrades that they become ridiculous.
<p>
You can argue that this isn&#039;t technically pay-to-win because all these things are accessible without putting money into the game, but you are rather missing the point. Whilst it <em>is</em> important in any pay-to-win game that many people do not realise it&#039;s pay-to-win, PS2 is rather blatant about it and I doubt everyone is quite so blind.
<p>
The free to play model is fundamentally hostile to the player because it greatly overvalues the game&#039;s content. I can buy a recent AAA title for £30 and get the whole game. If I were to pay for all of PS2&#039;s content, I&#039;d be looking at an order of magnitude greater than that. Plus, it&#039;s a strange business model. Intuition suggests that there would be a negative correlation between the people who don&#039;t balk at the idea of spending £5 on a virtual item and the people old enough to earn money.
<p>
Game devs: Learn from TF2, please.<hr/>
<p>
It&#039;ll be interesting to see over the next six months how this compares to Tribes Ascend. One of Ascend&#039;s big problems in player retention was the amount of grind to unlock items; a lot of players cottoned on fairly quickly that they were being killed by weapons inaccessible to them, approximated the time investment required to unlock them for themselves, and then thought &quot;forget it&quot;. (As someone who put in 400+ hours and was frustrated by other things, it&#039;s easy to forget that this was a serious issue for new players, but there was an insightful Reddit topic in /r/gaming where a lot of people chimed in saying they checked it out, but quit soon after because of this). 
<p>
PS2 seems a lot more grindy than Ascend ever was. What&#039;s worrying is that the cert prices were cut during beta as people complained they were ridiculous. What&#039;s more worrying is that SoE were quite resistant to doing this at first, which, to me, shows that they don&#039;t really get their market. This is exacerbated by the fact that earning certs is something that happens directly from certain actions in the game; actions which do not correspond well to doing something useful for your team. At least Ascend had a layer of obfuscation in its XP distribution so farming XP at the expense of everything else was never really an option.
<p>
For what it&#039;s worth, Amerish on Mallory is a ghost town already and Esamir&#039;s not holding up too well either, indicating that player retention has been poor. PS2 relies upon players to a far greater extent than most games; the players *are* the content. Alienating the free to play crowd is incredibly short-sighted.]]></content:encoded>
  </item>
      <item>
    <title>PlanetSide 2 Cert Earning and Spending</title>
    <link>https://blog.asgaard.co.uk/2012/12/09/planetside-2-cert-earning-and-spending</link>
    <pubDate>Sun, 09 Dec 12 22:06:20 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/12/09/planetside-2-cert-earning-and-spending</guid>
    <description><![CDATA[
<p>
Certs in Planetside 2 are gained by XP, at a rate of 250XP per cert. A kill earns about 100 XP. Capturing a big facility (e.g. Biolab) nets 1000XP/4 certs, which is kind of pathetic when it can take 5-10 minutes of doing nothing but sitting on a control node. Killing infantry is a good, reliable way to earn certs. Capturing points, sadly, is not. I hope they fix this, but until then, focus on combat.
<p>
<img src='/assets/media/09-12-12/planetside2-amp-station.jpg' class='float-right border width-50' title='Here are lots of people not earning certs. Unfortunately' alt='Here are lots of people not earning certs. Unfortunately'/>
<p>
A cert investment is a cert bought to increase the rate you earn XP. These are what you should probably focus on to begin with. It seems the best way is to spread certs out over several classes. This is for two reasons:<ol><li>PS2 is a very broad game, and being able to switch your class to fit the situation is an asset</li><li>The certs get much more expensive at their higher levels, and give a diminishing return</li></ol>
<p>
Bear in mind that only one cert per slot can be equipped at once, so don&#039;t buy two in the same slot expecting to equip them both together. Check the loadout page if you&#039;re confused.<h2> Some vague class rela</h2>[...]]]></description>
    <content:encoded><![CDATA[
<p>
Certs in Planetside 2 are gained by XP, at a rate of 250XP per cert. A kill earns about 100 XP. Capturing a big facility (e.g. Biolab) nets 1000XP/4 certs, which is kind of pathetic when it can take 5-10 minutes of doing nothing but sitting on a control node. Killing infantry is a good, reliable way to earn certs. Capturing points, sadly, is not. I hope they fix this, but until then, focus on combat.
<p>
<img src='/assets/media/09-12-12/planetside2-amp-station.jpg' class='float-right border width-50' title='Here are lots of people not earning certs. Unfortunately' alt='Here are lots of people not earning certs. Unfortunately'/>
<p>
A cert investment is a cert bought to increase the rate you earn XP. These are what you should probably focus on to begin with. It seems the best way is to spread certs out over several classes. This is for two reasons:<ol><li>PS2 is a very broad game, and being able to switch your class to fit the situation is an asset</li><li>The certs get much more expensive at their higher levels, and give a diminishing return</li></ol>
<p>
Bear in mind that only one cert per slot can be equipped at once, so don&#039;t buy two in the same slot expecting to equip them both together. Check the loadout page if you&#039;re confused.<h2> Some vague class related observations </h2>
<p>
Sniper seems pretty good by default. A slightly more powerful scope is nice, but apart from that, there are more profitable ways to spend early level certs.
<p>
Light assault is very capable by default. The jetpack is invaluable, so it&#039;s worth focussing a few certs on that. By using the jetpack intelligently, you can escape from combat when injured, you can quickly flank your enemy, or you can place yourself on rooftops and rain bullets down on people who never think to look upwards. When positioning between two foes is unequal, nine times of out ten, the one with the better positioning will win. It is a deciding factor. And the jetpack gives you many, many options for positioning, and therefore slaughtering large numbers of foes.
<p>
Medic and Engineer are very similar in that they both offer a support role where their main purpose is to heal or repair stuff, which they do via a beam gun/tool. Despite this, they&#039;re also very good at killing, so you can still use them as a generalist combat class while offering support as necessary. In both cases, healing and repair earns XP quite quickly when there&#039;s a need for it (i.e. lots of suicidal teammates/tanks), so it&#039;s worth buying a few levels of their heal/repair tool upgrades. The engineer can haul in certs by putting down ammo boxes near choke-points, and there are a few certs which make the ammo boxes stay for longer. You can also select your turret, press b, and get a second deployable ammo box (who knows why).
<p>
Heavy assault isn&#039;t a cert machine. It just isn&#039;t. At least for my NC character, the primary weapon HA seems to fire bullets made of foam and has huge recoil. Okay, so it has a 100 bullet magazine, but that&#039;s no use when you&#039;ll miss half of them and the other half seem to bounce off enemies. Maybe the other guns are better, but the primary is rubbish.
<p>
<img src='/assets/media/09-12-12/planetside2-armour-assault.jpg' title='Forget Heavy Assault, this is how you attack enemy tanks.' class='border float-left width-40' alt='Forget Heavy Assault, this is how you attack enemy tanks.'/>
<p>
The HA gets a rocket launcher, but few rockets. HA&#039;s main purpose is to take down tanks with his rocket launcher, but the launcher does too little damage and carries too few rockets to do so with any reliability. Taking down a tank yields a pitiful amount of XP anyway (100 - same as an infantry kill), especially considering how many infantry you could have killed in the same time. My advice is don&#039;t play HA unless you&#039;re surrounded by tanks who happen to have their backs to you (they have weak armour from behind). Tanks are generally best left to other tanks.
<p>
You can rake in certs with a heavy tank. The heavy tank is a bit underwhelming by default, but it becomes a beast with a few upgrades. It&#039;s worth upgrading the performance/speed, because it&#039;s bit of a sloth otherwise. The zoom on the cannon is also very useful; if you want to stay alive for prolonged periods you&#039;ll want to be engaging at long range if you can (and tank-sniping libs/galaxies is great fun). And your upgraded engineer repair tool is a godsend for emergency repairs. I&#039;d also recommend putting some certs towards making your gunner&#039;s life easier. Extra ammo for the both of you is nice, but the downside of living longer is that you&#039;ll still spend most of your time trying to stay in range of the nearest ammo tower.
<p>
The lightning class tank is a bit less impressive. It&#039;s very weak and does not to no damage against armour. It&#039;s effective against infantry, but it&#039;s also a huge target. Don&#039;t put many certs into it to begin with.]]></content:encoded>
  </item>
      <item>
    <title>PlanetSide 2 Criticisms</title>
    <link>https://blog.asgaard.co.uk/2012/12/06/planetside-2-criticisms</link>
    <pubDate>Thu, 06 Dec 12 22:55:08 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/12/06/planetside-2-criticisms</guid>
    <description><![CDATA[
<p>
I&#039;m enjoying it overall but I have some specific criticisms:<h2> It&#039;s kind of pointless </h2>
<p>
The territories rarely change much. You can capture one area, okay, but in a few hours it&#039;ll probably have been reverted. There&#039;s not much incentive to stay and defend a territory. It just seems like musical chairs with base facilities. 
<p>
A related problem is having three factions and three continents - one faction will dominate a particular continent and exert little effort in the others. Which means you have a choice between ridiculously advantaged or ridiculously disadvantaged. Neither is particularly fun. On Mallory, you can guarantee that the Terran Republic will have 70% of Indar, VS Esamir and NC Amerish.
<p>
The exact bases controlled by whom may change a little, but the big picture does not.
<p>
It seems like the way to fix this is to either make controlled facilities give bigger personal rewards, i.e. make them more valuable and more diverse, and/or to give slight XP multiplier bonuses to outnumbere[...]]]></description>
    <content:encoded><![CDATA[
<p>
I&#039;m enjoying it overall but I have some specific criticisms:<h2> It&#039;s kind of pointless </h2>
<p>
The territories rarely change much. You can capture one area, okay, but in a few hours it&#039;ll probably have been reverted. There&#039;s not much incentive to stay and defend a territory. It just seems like musical chairs with base facilities. 
<p>
A related problem is having three factions and three continents - one faction will dominate a particular continent and exert little effort in the others. Which means you have a choice between ridiculously advantaged or ridiculously disadvantaged. Neither is particularly fun. On Mallory, you can guarantee that the Terran Republic will have 70% of Indar, VS Esamir and NC Amerish.
<p>
The exact bases controlled by whom may change a little, but the big picture does not.
<p>
It seems like the way to fix this is to either make controlled facilities give bigger personal rewards, i.e. make them more valuable and more diverse, and/or to give slight XP multiplier bonuses to outnumbered factions on a continent by continent basis.<h2> Capturing Facilities Is Too Slow And Too Obscured </h2>
<p>
Sitting on a control node for 5-10 minutes isn&#039;t very fun. It&#039;s even less fun when you&#039;re only managing to get 3/6 players because nobody else seems to know that they have to be in short range of the node for the base to be captured. The progress bar isn&#039;t very obvious.
<p>
And while you&#039;re doing this, you&#039;re not doing much else, which means you&#039;re not earning certs until the base ownership flips. Unless you&#039;re defending in which case you get none. Oh and if you get killed right before it flips and then spawn out of range, you also get none. It&#039;s basically a choice between doing something useful (in game terms) and getting rewarded. Which isn&#039;t good. 
<p>
Which brings me to my next point...<h2> Too Grindy </h2>
<p>
It seems to take forever to earn certs. You can get about 40-50 an hour if you&#039;re doing well, but it can easily drop as low as 20 if you&#039;re having a bad time or if you&#039;re just in an area where not a lot is happening or have to spend a lot of time travelling. At this rate it takes a <em>long</em> time to unlock any weapons (500-1000 certs).
<p>
This <strong>will</strong> harm your game, Sony. This isn&#039;t the TF2 F2P model of making people feel casually rewarded just for taking part and having some fun, this is the tried and failed F2P model of turning your game into <em>work</em>. I don&#039;t understand why, after Valve quite blatantly made a simple F2P model work <em>really well</em>, most other developers pursue stupider, more complex and <em>less effective</em> options!
<p>
There is variety in the stock weapons, sure, but there are obvious omissions. Anti air? The only vaguely effective anti air weapon I have is a heavy tank&#039;s cannon. Which is silly. Yes, I know, MAXes have AA weapons. Unfortunately, they are useless. I have downed more planes with lucky unguided rocket shots than I have with a MAX.<h2> The downtime scheduling is <em>really bad</em> </h2>
<p>
Please don&#039;t take Euro servers down for patching for an hour and a half at 18:00 CET. Don&#039;t take the US servers down at the same time then place more importance on getting the US servers up first.
<p>
I don&#039;t object to them only patching in their regular working hours (they&#039;re in Pacific Time), there&#039;s nothing wrong with that, but they could time it better and be more sensitive to other timezones. 15:00PT is 0:00AM CET. ]]></content:encoded>
  </item>
      <item>
    <title>Tribes Ascend Survey</title>
    <link>https://blog.asgaard.co.uk/2012/11/27/tribes-ascend-survey</link>
    <pubDate>Tue, 27 Nov 12 22:37:23 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/27/tribes-ascend-survey</guid>
    <description><![CDATA[
<p>
Hi-Rez sent out a survey for all &#039;VIP&#039; players in Tribes Ascend today.
<p>
They&#039;ve probably realised their player numbers are tanking (hastened, I imagine, by PlanetSide 2&#039;s release last week). It&#039;s a sensible change of tactic; previously they&#039;ve only canvassed feedback from serious competitive players, whereas they&#039;ve sent this one out to everyone who has a VIP (paid) account.
<p>
The survey is a bit strange and apparently proposes very big rule changes without explanation of how they&#039;d be incorporated alongside existing rules. One of Ascend&#039;s big problems is that it incorporates concepts from previous Tribes titles with no apparent understanding of how Ascend is different and why you can&#039;t just bring things in from different games and expect them to work.
<p>
The problem is that Ascend basically needs its rules rewriting from the ground up. Fortunately, someone&#039;s already written those rules. They&#039;re called Tribes 2.
<p>
I kind of hope they do implement massi[...]]]></description>
    <content:encoded><![CDATA[
<p>
Hi-Rez sent out a survey for all &#039;VIP&#039; players in Tribes Ascend today.
<p>
They&#039;ve probably realised their player numbers are tanking (hastened, I imagine, by PlanetSide 2&#039;s release last week). It&#039;s a sensible change of tactic; previously they&#039;ve only canvassed feedback from serious competitive players, whereas they&#039;ve sent this one out to everyone who has a VIP (paid) account.
<p>
The survey is a bit strange and apparently proposes very big rule changes without explanation of how they&#039;d be incorporated alongside existing rules. One of Ascend&#039;s big problems is that it incorporates concepts from previous Tribes titles with no apparent understanding of how Ascend is different and why you can&#039;t just bring things in from different games and expect them to work.
<p>
The problem is that Ascend basically needs its rules rewriting from the ground up. Fortunately, someone&#039;s already written those rules. They&#039;re called Tribes 2.
<p>
I kind of hope they do implement massive changes just to make Ascend&#039;s death a bit less depressing than a gradual fade out over the next 6 months. Despite being better than Vengeance, it seems set for an even shorter lifespan.]]></content:encoded>
  </item>
      <item>
    <title>PlanetSide 2 Base Capturing Explanation</title>
    <link>https://blog.asgaard.co.uk/2012/11/25/planetside-2-base-capturing-explanation</link>
    <pubDate>Sun, 25 Nov 12 22:18:22 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/25/planetside-2-base-capturing-explanation</guid>
    <description><![CDATA[
<p>
I found the base capture mechanics completely impenetrable when I started. Here&#039;s an explanation of how to capture facilities.
<p>
Facilities (biolabs, tech plants, etc) are controlled by one of the three factions. If the facility&#039;s territory borders some of your territory, you can capture it!
<p>
You&#039;re automatically a part of a base-battle if you&#039;re fairly close to it. At this point, the capture HUD pops up on the left of your screen to tell you a few interesting things.
<p>
<img src='/assets/media/25-11-12/planetside2-capture-hud.jpg' class='float-right border' title='NC loses again!' alt='NC loses again!'/><ol><li>The name of the place you&#039;re vying for (Crossroads Watchtower) and the faction who currently owns it (NC).</li><li>The capture points and who owns them currently. A, B, and C. A is green (friendly - NC for me), B is purple (Vanu) and C is red (Terran Republic).</li><li>The presence at the capture points - 2/2, 1/2, 2/2. Basically, having a presence at a capture point will contribute to the capture process, or block other factions&#039; attempts at capturing your facilities. If you&#039;ve got a presence at all points, it&#039;s simple, </li></ol>[...]]]></description>
    <content:encoded><![CDATA[
<p>
I found the base capture mechanics completely impenetrable when I started. Here&#039;s an explanation of how to capture facilities.
<p>
Facilities (biolabs, tech plants, etc) are controlled by one of the three factions. If the facility&#039;s territory borders some of your territory, you can capture it!
<p>
You&#039;re automatically a part of a base-battle if you&#039;re fairly close to it. At this point, the capture HUD pops up on the left of your screen to tell you a few interesting things.
<p>
<img src='/assets/media/25-11-12/planetside2-capture-hud.jpg' class='float-right border' title='NC loses again!' alt='NC loses again!'/><ol><li>The name of the place you&#039;re vying for (Crossroads Watchtower) and the faction who currently owns it (NC).</li><li>The capture points and who owns them currently. A, B, and C. A is green (friendly - NC for me), B is purple (Vanu) and C is red (Terran Republic).</li><li>The presence at the capture points - 2/2, 1/2, 2/2. Basically, having a presence at a capture point will contribute to the capture process, or block other factions&#039; attempts at capturing your facilities. If you&#039;ve got a presence at all points, it&#039;s simple, the capture goes in your favour. If other teams have presences, it gets more complicated. It may be that the defending team successfully holds the facility, or it may be that a third faction manages to overwhelm both of you.</li><li>A pie chart showing influence - this is the surrounding territory owned. The higher a faction&#039;s influence, the more capping power they have. TR have a massive advantage here.</li><li>The progress meter: It&#039;s purple at the moment which means Vanu have the most control at the moment, but according to point #3, they&#039;re losing it. When the bar reaches zero, another faction&#039;s will start to fill up. When it reaches full, that&#039;s when the facility is won or lost (and you get lots of points).</li></ol>
<p>
<img src='/assets/media/25-11-12/planetside2-capture-node.jpg' class='float-right width-40 border' title='A capture node, and HUD notification.' alt='A capture node, and HUD notification.'/>
<p>
You&#039;ll often see during longer fights a lot of your team camped outside the enemy&#039;s spawn, and all of a sudden, the spawn will switch sides. The switch is determined by the capture points mentioned above. Capturing is a slow process and battles can last for hours if one team doesn&#039;t have the advantage. You should be aiming to be at or around one of the capture points, if you want to be of most use to your team, although obviously, disrupting a Sunderer or bringing in armour/air support can be more effective than digging in at a capture point. The capture points are in the form of node structures ad you have to be relatively close to have an effect on it. A display on your HUD will pop up at the top of the screen when you&#039;re close enough.
<p>
The decision to have three factions in the game has some amusing consequences. We were struggling to hold the Crossroads Watchtower against the Vanu and their bar was starting to fill up worryingly fast. Then the Terrans turned up and gave us some free time while they reverted the Vanu cap (we still lost though).
<p>
]]></content:encoded>
  </item>
      <item>
    <title>Undo/Redo in JavaScript</title>
    <link>https://blog.asgaard.co.uk/2012/11/21/undo-redo-in-javascript</link>
    <pubDate>Wed, 21 Nov 12 21:24:01 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/21/undo-redo-in-javascript</guid>
    <description><![CDATA[
<p>
Undo and redo is a fairly interesting and surprisingly difficult concept to implement in an application. Thanks to the way JavaScript treats functions, it isn&#039;t too hard to come up with a general and powerful approach for JavaScript apps. 
<p>
We really just need a command stack and a set of actions we want to perform. We can wrap up the details in closures.
<p>
Here&#039;s a bare bones command stack implementation:
<p>
<pre>/**
  * @constructor
  */
Commands = function() {
    this.undoStack = [];
    this.redoStack = [];
};

/**
  * Executes an action and adds it to the undo stack.
  * @param {function()} action Action function.
  * @param {function()} reverse Reverse function.
  * @param {Object=} ctx The 'this' argument for the action/reverse functions.
  */
Commands.prototype.execute = function(action, reverse, ctx) {
    this.undoStack.push( {action: action, reverse: reverse, ctx: ctx} );
    action.call(ctx);
    this.redoStack.length = 0;
};

Commands.prototype.undo = function() {
    var c = this.undoStack.</pre>[...]]]></description>
    <content:encoded><![CDATA[
<p>
Undo and redo is a fairly interesting and surprisingly difficult concept to implement in an application. Thanks to the way JavaScript treats functions, it isn&#039;t too hard to come up with a general and powerful approach for JavaScript apps. 
<p>
We really just need a command stack and a set of actions we want to perform. We can wrap up the details in closures.
<p>
Here&#039;s a bare bones command stack implementation:
<p>
<pre>/**
  * @constructor
  */
Commands = function() {
    this.undoStack = [];
    this.redoStack = [];
};

/**
  * Executes an action and adds it to the undo stack.
  * @param {function()} action Action function.
  * @param {function()} reverse Reverse function.
  * @param {Object=} ctx The 'this' argument for the action/reverse functions.
  */
Commands.prototype.execute = function(action, reverse, ctx) {
    this.undoStack.push( {action: action, reverse: reverse, ctx: ctx} );
    action.call(ctx);
    this.redoStack.length = 0;
};

Commands.prototype.undo = function() {
    var c = this.undoStack.pop();
    if (c) {
        c.reverse.call(c.ctx);
        this.redoStack.push(c);
    }
};

Commands.prototype.redo = function() {
    var c = this.redoStack.pop();
    if (c) {
        c.action.call(c.ctx);
        this.undoStack.push(c);
    }
};</pre>
<p>
The third argument of execute(), ctx, is just a context for the functions to execute with. If you&#039;re not familiar, that means you can pass in a reference to a class method and then set ctx to an instance of the class, and it will all work fine. It sets the &#039;this&#039; value for the function. It&#039;s optional.
<p>
Now we need some actual action functions. Your functions might be to add an item to a basket, to draw a line between two points, or anything. For ease of demonstration, I&#039;ve chosen add and subtract. The important thing is that for every action you want to perform, you should have an opposite action defined. Add item to basket/remove item from basket. Or at least, a way to roll back the state (perhaps not a direct reverse operation, perhaps clone the state then reapply it).
<p>
<pre>function add(n1, n2) {
    return n1 + n2;
}

function subtract(n1, n2) {
    return n1 - n2;
}</pre>
<p>
And here&#039;s how we start executing, undoing, and redoing actions:
<p>
<pre>var number = 1,
    commands = new Commands();

commands.execute( 
  function() { number = add(number, 5) },
  function() { number = subtract(number, 5) }
);
console.log(number); // 6

commands.execute( 
  function() { number = subtract(number, 2) },
  function() { number = add(number, 2) }
);
console.log(number); // 4

commands.undo();
console.log(number); // 6

commands.undo();
console.log(number); // 1


commands.redo();
console.log(number); // 6

commands.redo();
console.log(number); // 4</pre>
<p>
That&#039;s pretty simple. As a thought exercise, what if addItemToBasket(item) returned an ID which had to be passed to removeItemFromBasketById(id)? Is that hard to handle? Turns out it&#039;s not:
<p>
<pre>var item,
    basketItemId;

commands.execute(
  function() { basketItemId = addItemToBasket(item); },
  function() { removeItemFromBasketById(basketItemId); basketItemId = null; }
);

// NOTE: at this point, basketItemId will have a proper value, supplied 
// by addItemToBasket(). Therefore, you can:

return basketItemId;</pre>
<p>
The closure scope handles it for us, and the stack structure ensures that basketItemId will always be current. So we can use this approach to have our program functions arranged mostly naturally, and then take advantage of closures and scoping to wrap them up for the undo/redo stack.
<br>
]]></content:encoded>
  </item>
      <item>
    <title>JavaScript prototype gotchas</title>
    <link>https://blog.asgaard.co.uk/2012/11/13/javascript-prototype-gotchas</link>
    <pubDate>Tue, 13 Nov 12 22:48:13 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/13/javascript-prototype-gotchas</guid>
    <description><![CDATA[
<p>
JavaScript is a strange language:
<p>
<pre>MyClass = function() {};

MyClass.prototype.myProperty = [];

var a = new MyClass();
var b = new MyClass();

a.myProperty[0] = 'xyz';

console.log(b.myProperty[0]); // prints 'xyz'</pre>
<p>
The issue here is one of prototypes and references. In most OO languages, defining a property on a class is done so in such a way that each instance of that class has a property completely independent of all other instances. Even if it&#039;s a reference, it still gets a reference to its *own* value.
<p>
In JavaScript, things are a bit wacky. Mostly they work as normal (with strange syntax), but occasionally things like this trip you up. It happens because, as you can see, both a and b have a reference to the same object; the one assigned to the prototype. This is only a problem with &#039;rich&#039; types like arrays and objects, immutable types like string and primitives sort themselves out.
<p>
The way to avoid it is to assign &#039;myProperty&#039; within the constructor:
<p>
<pre>MyClass = function() {
</pre>[...]]]></description>
    <content:encoded><![CDATA[
<p>
JavaScript is a strange language:
<p>
<pre>MyClass = function() {};

MyClass.prototype.myProperty = [];

var a = new MyClass();
var b = new MyClass();

a.myProperty[0] = 'xyz';

console.log(b.myProperty[0]); // prints 'xyz'</pre>
<p>
The issue here is one of prototypes and references. In most OO languages, defining a property on a class is done so in such a way that each instance of that class has a property completely independent of all other instances. Even if it&#039;s a reference, it still gets a reference to its *own* value.
<p>
In JavaScript, things are a bit wacky. Mostly they work as normal (with strange syntax), but occasionally things like this trip you up. It happens because, as you can see, both a and b have a reference to the same object; the one assigned to the prototype. This is only a problem with &#039;rich&#039; types like arrays and objects, immutable types like string and primitives sort themselves out.
<p>
The way to avoid it is to assign &#039;myProperty&#039; within the constructor:
<p>
<pre>MyClass = function() {
    this.myProperty = [];
};</pre>
<p>
It&#039;s strange that JSLint doesn&#039;t pick up on this.
<p>
For what it&#039;s worth, gjslint (Google&#039;s closure linter) will emit:<pre>
Line 3, E:0100: Member MyClass.prototype.myProperty cannot have a non-primitive value
</pre>
<p>
but I find Google&#039;s linter is generally not as universally useful as JSLint (it&#039;s better for Closure development though, i.e. if you&#039;re planning to feed your source through the Closure Compiler).]]></content:encoded>
  </item>
      <item>
    <title>PlanetSide 2 beta keys</title>
    <link>https://blog.asgaard.co.uk/2012/11/12/planetside-2-beta-keys</link>
    <pubDate>Mon, 12 Nov 12 08:30:38 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/12/planetside-2-beta-keys</guid>
    <description><![CDATA[
<p>
The next four people to leave their email address in the comments below (I won&#039;t publish the comments, don&#039;t worry, your address is safe) will get a PlanetSide 2 beta key/code.
<p>
You can read some more detailed <a href='http://blog.asgaard.co.uk/2012/11/09/planetside-2-beta-impressions'>PlanetSide 2 beta impressions</a>.[...]]]></description>
    <content:encoded><![CDATA[
<p>
The next four people to leave their email address in the comments below (I won&#039;t publish the comments, don&#039;t worry, your address is safe) will get a PlanetSide 2 beta key/code.
<p>
You can read some more detailed <a href='http://blog.asgaard.co.uk/2012/11/09/planetside-2-beta-impressions'>PlanetSide 2 beta impressions</a>.]]></content:encoded>
  </item>
      <item>
    <title>Planetside 2 Beta Impressions</title>
    <link>https://blog.asgaard.co.uk/2012/11/09/planetside-2-beta-impressions</link>
    <pubDate>Fri, 09 Nov 12 20:42:17 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/09/planetside-2-beta-impressions</guid>
    <description><![CDATA[
<p>
PlanetSide 2 is an MMOFPS (you know what that means). I&#039;m lucky enough to be part of the beta test. It releases in a few weeks (20th November). 
<p>
<img src='/assets/media/09-11/planetside2-liberator.jpg' title='' class='center border' alt=''/>
<p>
I&#039;ve been playing PlanetSide 2 for the last week or so. I&#039;ve never actually played an MMOFPS, and off the top of my head, I couldn&#039;t name any others except for PlanetSide 1. 
<p>
I vaguely remember a fair bit of buzz within the Tribes 2 community for PS1 (because they were both relatively unique in that they implemented big, open rolling terrain in an FPS, but I suspect that&#039;s where the parallels ended), but I never got around to checking it out. History repeats, and there&#039;s a fair bit of buzz in the Tribes: Ascend community for PS2. But my impressions are that it has little in common with Tribes, and is in fact strikingly similar to Operation Flashpoint (the original 2001 version, not the rubbish sequel). Because:
<p>
<img src='/assets/media/09-11/planetside2-night-battle.jpg' title='See what&#039;s going on here? Nor does anyone else. Night time is often a game of shooting at muzzle flashes.' class='float-right border width-40' alt='See what&#039;s going on here? Nor does anyone else. Night time is often a game of shooting at muzzle flashes.'/><ol><li>It&#039;s vast.</li><li>Most of the time you get shot at by people you can&#039;t see.</li><li>Your bullets go just about everywhere except</li></ol>[...]]]></description>
    <content:encoded><![CDATA[
<p>
PlanetSide 2 is an MMOFPS (you know what that means). I&#039;m lucky enough to be part of the beta test. It releases in a few weeks (20th November). 
<p>
<img src='/assets/media/09-11/planetside2-liberator.jpg' title='' class='center border' alt=''/>
<p>
I&#039;ve been playing PlanetSide 2 for the last week or so. I&#039;ve never actually played an MMOFPS, and off the top of my head, I couldn&#039;t name any others except for PlanetSide 1. 
<p>
I vaguely remember a fair bit of buzz within the Tribes 2 community for PS1 (because they were both relatively unique in that they implemented big, open rolling terrain in an FPS, but I suspect that&#039;s where the parallels ended), but I never got around to checking it out. History repeats, and there&#039;s a fair bit of buzz in the Tribes: Ascend community for PS2. But my impressions are that it has little in common with Tribes, and is in fact strikingly similar to Operation Flashpoint (the original 2001 version, not the rubbish sequel). Because:
<p>
<img src='/assets/media/09-11/planetside2-night-battle.jpg' title='See what&#039;s going on here? Nor does anyone else. Night time is often a game of shooting at muzzle flashes.' class='float-right border width-40' alt='See what&#039;s going on here? Nor does anyone else. Night time is often a game of shooting at muzzle flashes.'/><ol><li>It&#039;s vast.</li><li>Most of the time you get shot at by people you can&#039;t see.</li><li>Your bullets go just about everywhere except where you&#039;re aiming.</li><li>It&#039;s really confusing and often frustrating.</li><li>Movement is clunky.</li><li>Vehicles are terrifyingly powerful and indestructable when you&#039;re not in them.</li><li>Vehicles are fragile and giant &quot;I AM HERE&quot; markers when you are in them.</li></ol>
<p>
That about sums up both OpFlash and PlanetSide 2. Sort of. They are both &quot;combat on an epic scale&quot;, and it turns out that &#039;combat&#039; in such context is synonymous with &#039;confusion&#039;. PS2 is bewildering. That&#039;s really the biggest thing you&#039;ll take away from it. OpFlash was bewildering too; it was a realistic portrayal of warfare inasmuch as any game can be a realistic portrayal of warfare. You could easily spend 20 minutes lying on a hill because you were too terrified to do anything else (missions were long and the save feature was stringent). Combat was often a few loud bangs followed by a black screen, as indeed is PS2&#039;s.
<p>
But Flashpoint was single player and back in 2001, the technology for such an environment wasn&#039;t exactly widespread. To a certain extent, the helplessness and the irrelevance it thrust upon you was a very convincing illusion, and given time, you could learn to game its limitations. PS2 appears to be much more genuine in this respect, and I&#039;m not sure that&#039;s necessarily a good thing, as it is basically an exercise in frustration.
<p>
<img src='/assets/media/09-11/planetside2-sunset.jpg' title='The PS2 lighting programmers understand the marketing power of a good screenshot.' class='float-left border width-40' alt='The PS2 lighting programmers understand the marketing power of a good screenshot.'/>
<p>
But it <em>is</em> fun. There are genuinely engaging experiences when at night you&#039;re cowering behind a rock shooting hapless foes who appear on the horizon. You&#039;re positioned well, you&#039;re part of a squad, and your superior tactics win the day. The scale makes it even more exciting. But then there&#039;s the flipside: You travel across the world uneventfully until suddenly you find you&#039;re getting shot by people who are well positioned and well organised, and you&#039;re lucky if you even figure out where they are before you get killed. Then you respawn back somewhere totally undesirable and have to make the trek again before you can again be part of the action. This is a frustrating experience.
<p>
<img src='/assets/media/09-11/planetside2-night-fire.jpg' title='AA fire lights up the night sky electrically.' class='float-left border width-40 clear-left' alt='AA fire lights up the night sky electrically.'/>
<p>
PlanetSide isn&#039;t helped by its complete lack of explanation of virtually <em>everything</em>. You spend a lot of time running around following other people, hoping they have more idea than you. You will likely spend your first half hour in the game wandering around empty terrain wondering where all the excitement is. Perhaps PS1 veterans will understand what&#039;s going on, but most people certainly won&#039;t. Even the mechanics of capturing locations are unclear.
<p>
Luckily, there is in-game voice chat and most of the players using it are quite helpful in directing their team-mates. Players are organised into squads (12 people) and platoons (4 squads) with a leadership hierarchy. If you end up in an organised squad/platoon, the game is *incredible*. You bounce along the terrain in an APC with your squad-mates while your squad leader tells everyone to hold fire to keep your position unknown to the enemy, then a hostile aircraft notices you and your squad leader announces &quot;weapons free&quot;, as just a moment later both turrets spring into anti-aircraft action. It really is an amazing form of gaming. And the beauty is that the voice chat is in-game, so regardless of whether you actively partake (or even have a microphone), you can still benefit from it passively without having to worry about third party software and servers.
<p>
It is beautiful, too. The lighting effects are lovely. The night time battles are wonderful; the skies and hills light up vibrantly with fleeting flashes, explosions, rocket trails, AA fire and muzzle flashes in a way screenshots just can&#039;t capture. This isn&#039;t just cosmetic: muzzle flashes have tactical implications. Some weapons even have add-ons that promise to reduce muzzle flash. And night is <em>very</em> dark. You have to stay alert. You can easily end up a few feet away from an enemy before either of you realises the other is there.
<p>
PlanetSide 2 will be released officially in less than two weeks (20th November), but unfortunately, in its current state, while the game is interesting and has huge potential, the experience is just too hostile to new players. For a game designed for huge numbers of people, launching in such a state as to give a poor first impression will irreversibly harm its lifespan. It *needs* players more than any other FPS. Tens of empty square miles of terrain is of no interest to anyone; you need hundreds of players online at once to populate it. Hi-Rez Studios made the same mistake with Tribes: Ascend in that they pushed it out to the masses before they&#039;d polished the new user experience sufficiently (and then repeated the mistake with the Steam release), and now, 9 months after release, the playerbase is worryingly low because it failed to hold on to players. T:A can just about sustain itself for now, but PS2 is fundamentally reliant on a large, active playerbase.<div class='center clear-fix clear-both'>
<br>
<img src='/assets/media/09-11/planetside2-tanks.jpg' title='They see us rollin&#039;...' class='float-left border width-45' alt='They see us rollin&#039;...'/> <img src='/assets/media/09-11/planetside2-tank-valley.jpg' title='They hat- wait, where are we going.' class='float-right border width-45' alt='They hat- wait, where are we going.'/>
<br>
</div>
<p>
The game is also a bit buggy and not entirely professionally run (it is Sony after all). This close to release, bugs like your tank falling through the terrain shouldn&#039;t really happen. And maintenance shouldn&#039;t take down the game at European prime time two consecutive nights. There seem to have been a lot of failed patches and rollbacks recently, too, which doesn&#039;t inspire confidence.
<p>
It&#039;s ironic that many Tribes: Ascend players were pining for PS2 as a saviour, but PS2 seems to be falling into exactly the same trap of releasing far too early and making the wrong impression.<hr/><h2>Update</h2>
<p>
Here&#039;s a concrete example about how badly Sony is handing the software and support side of the game. This morning (11/11, a Sunday) Sony pushed out a 3GB patch, and took the servers down for a few hours. When the servers came back up, players found that they had lost certs (certifications - things you earn and can spend on upgrades of various kinds). So this afternoon, they took the server down again for almost three hours to fix the missing certs. And they&#039;re talking about patches to fix crashes (which I think were introduced this morning...), which will no doubt mean more downtime. I know it&#039;s a beta, but it&#039;s now very close to release and we are seeing large amounts of downtime because they don&#039;t test their patches before deploying them.
<p>
This is the third day in the last 7 that I&#039;ve attempted to play at a perfectly reasonable time and found the servers have been down.
<p>
Sony Online Entertainment is not a company that is good at this stuff.
<br>
]]></content:encoded>
  </item>
      <item>
    <title>Planetside 2 Beta Issues (Servers full)</title>
    <link>https://blog.asgaard.co.uk/2012/11/04/planetside-2-beta-issues-servers-full</link>
    <pubDate>Sun, 04 Nov 12 22:58:11 +0000</pubDate>
    <guid>https://blog.asgaard.co.uk/2012/11/04/planetside-2-beta-issues-servers-full</guid>
    <description><![CDATA[
<p>
I received my PlanetSide 2 beta invitation today. The EU server seems to be having capacity problems; it often says &quot;Server full&quot; and then seems to suggest it&#039;s put you in a queue. These are lies: the best way to get into the game is to press cancel and then try again. A few times. I hope they sort this out soon.
<p>
I&#039;ll write more about it soon, but so far I am bemused, baffled and indeed bamboozled by the whole game. I wouldn&#039;t know where to start. Initial impressions are mixed; it seems incredible, but it would benefit greatly from having some kind of guide or explanation because I generally have no idea what I&#039;m supposed to be doing.
<p>
I intend to check it out more, anyway.
<p>
Edit (5/11): I&#039;d love to try playing this game but it&#039;s always down. 8PM European time, yep, that&#039;s a great time to do maintenance! Unimpressed.[...]]]></description>
    <content:encoded><![CDATA[
<p>
I received my PlanetSide 2 beta invitation today. The EU server seems to be having capacity problems; it often says &quot;Server full&quot; and then seems to suggest it&#039;s put you in a queue. These are lies: the best way to get into the game is to press cancel and then try again. A few times. I hope they sort this out soon.
<p>
I&#039;ll write more about it soon, but so far I am bemused, baffled and indeed bamboozled by the whole game. I wouldn&#039;t know where to start. Initial impressions are mixed; it seems incredible, but it would benefit greatly from having some kind of guide or explanation because I generally have no idea what I&#039;m supposed to be doing.
<p>
I intend to check it out more, anyway.
<p>
Edit (5/11): I&#039;d love to try playing this game but it&#039;s always down. 8PM European time, yep, that&#039;s a great time to do maintenance! Unimpressed.]]></content:encoded>
  </item>
  </channel>
</rss>