Blog Archive — Page 20

This is part of my blog, which I have long since stopped maintaining. The page has been preserved in case its content is of any interest. Please go back to the homepage to see the current contents of this site.

  • Daily Promise: Coming Together

    Despite the lack of response to my earlier post, in which I floated my design concepts for “Daily Promise”, boredom won out in the end and I started coding anyway.

    It’s now coming together, and all bar the Twitter-integrated social aspects are largely complete. Here’s how it’s developed:

    Home Page

    Daily Promise: HomeThe social side – top users, etc. – still isn’t implemented, but there’s a reasonable-looking homepage in there. The main body is taken up with a short description and a big graphic explaining how the site works. Side-bar widgets provide the Twitter login and alternative login (bypassing The site now has a proper name, Daily Promise, and with it a logo and style that is reflected throughout.

    Set Up Goals (“Manage”)

    Daily Promise: ManageThe “Manage” page has remained almost exactly faithful to the design. New promises can be created, old ones deactivated and deactivated ones can be activated again. A Tweet box appears for the user to announce their new promise, if desired.

    Daily Performance (“Enter”)

    Daily Promise: EnterAgain, there’s not a lot of difference here between the design and the reality. Each promise has a yes/no choice, and after completing a day’s entries, Tweet boxes appear for the user to let their friends know about their successes and failures. “Winning streaks” aren’t yet implemented.

    Performance Log (“View”)

    Daily Promise: ViewThere’s no ability to scroll through your history yet, but the default display shows 4 weeks (which scroll if necessary). Just as in the design drawings, the history table is followed by a text summary of how the user is doing.

    The “View” page also, with a few additions, becomes a user’s profile page, which is accessible to other users.


    Here you can set your password for the alternative login, and delete your account. It’s exactly as dull as it sounds.


    That’s my big job for the next few days! It doesn’t exist yet, but it’s now my top priority.

  • Stuxnet is in the hands of Bad Guys?!

    Hey! Do you like fear? Do you like bullshit headlines? Well, has Sky got an news for you! “Super virus a target for cyber terrorists”, which bears the even more fascinating <title> tag of “Stuxnet Worm: Virus Targeted At Iran’s Nuclear Plant Is In Hands Of ‘Bad Guys’, Sky News Sources Say”, is their latest fantastical fearmongering piece. Let’s butcher it together.

    (Thanks to Chris of Campaign Reboot for tweeting this story. He beat me to it with his post “Sky News, working hard to prove they’re morons”.)

    So, shall we start from the top?

    A super virus that was used to disrupt Iran’s nuclear programme…

    Potentially – though there has been no admission from the nation that it was successful.

    …has been traded on the black market…

    Got any evidence, Sky? No? Okay then. Granted it’s not infeasible, but it would be nice to know if you just made that up.

    …and could be used by terrorists, according to Sky News sources.


    Senior cyber-security figures have said the Stuxnet worm - the first to have been used to damage targets in the real world…

    Almost certainly not, although the internet is not being helpful with sources of previous real-world virus damage (except to companies’ finances). There’s also no evidence that Stuxnet has caused any meatspace damage.

    …could be used to attack any physical target which relies on computers.

    Any physical target running Windows with attached SCADA controllers from one manufacturer controlling a certain number of frequency converter drives made by one of two companies running at certain frequencies. Unless they’re just referring to the Windows exploits Stuxnet uses rather than its payload, in which case… nope, every other OS is immune. (Source: Symantec)

    The list of vulnerable installations is almost endless – they include power stations, food distribution networks, hospitals, traffic lights and even dams.

    Again, Stuxnet in its known form will cause problems for none of those.

    A senior IT security source said: “We have hard evidence that the virus is in the hands of bad guys – we can’t say any more than that but these people are highly motivated and highly skilled with a lot of money behind them.

    You can’t say more because you’ve received threats from the FBI if you release this super-secret information that would be useful for protecting the world’s networks? Or because you’re making it up? Present evidence or GTFO.

    “And they have realised that this kind of virus could be a devastating tool.”

    Really?! Oh, gosh.

    Will Gilpin, an IT security consultant to the UK Government said: “You could shut down the police 999 system.

    “You could shut down hospital systems and equipment.

    “You could shut down power stations, you could shut down the transport network across the United Kingdom.”

    Again, I guess we’ve moved on to talking about a heavily modified payload rather than Stuxnet as it currently exists. And then, it’s only systems running Windows, and only until Microsoft patch the two (of five) remaining vulnerabilities that Stuxnet is known to exploit. (Source: F-Secure)

    The Stuxnet attack on the Bushehr nuclear installation in Iran is believed to have been orchestrated by a country.

    Believed on the basis of speculation, with no hard evidence.

    Now experts warn that the West is extremely vulnerable to similar attacks by criminal gangs seeking blackmail payouts or more likely by terrorist groups.

    Criminal gangs and terrorists that have extremely detailed inside knowledge of manufacturing systems, which are probably not a common target for either group, and who are dumb enough to rely on a virus that we now have an extensive dossier on, which most virus scanners now detect and neutralise, and for which there are known cleaning methods.

    Stewart Baker, a former assistant secretary with the US Department of Homeland Security, said: “They could shut down power systems, dams, almost any sophisticated industrial process that requires a control software. Which is practically everything.”

    I think we’ve seen this point somewhere before.

    There has been a rise in cyber attacks in recent years.

    On April 8, 15% of all internet traffic was routed through China for 18 minutes in a mysterious incident the Chinese authorities have denied any part in.

    Because it was probably an accident rather than an attack, and it’s not as if routing through China is unusual – the event was merely an unexpected spike. There has been no suggestion that any unencrypted sensitive data was intercepted by China during that time. (Source: BGPmon, plus the more knowledgeable comments on Slashdot and Reddit.)

    The Royal Navy’s website was shut down on November 5, allegedly by a Romanian hacker.

    In October, the UK Government declared cyber warfare to be a “tier 1” threat to national security.

    Are those… could they possibly be… facts?! My god.

    But experts say a more co-ordinated effort is needed to tackle attacks, along the lines of the Cyber Command agency set up in the US this year.

    It’s the most reasonable opinion in the article, and it’s the one you don’t provide a named source for?

    So, er, thanks, Sky News. I feel so enlightened now.

    If you’re looking for some more amusement, the YouTube-calibre comments section is pure Retarded Internet Commenter gold, too.

  • Daily Promise: Design Sketches

    Current flavour of the month of some of the geek crowd, “Health Month”, is a social network of sorts on which users compete to achieve certain health-related goals. Each month, each member sets a number of goals for themselves to achieve. Its core mechanic is health points – you start with 10, lose one every time you fail to meet a goal, and players who perform well can heal you.

    I’m enjoying my use of the site with three goals this month, but I’d like to step it up and set lots. Unfortunately, having more than three goals costs money. (Not that I think the site’s owners don’t have a right to charge, but it can be a deterrent to users such as myself.) It also currently only allows two “custom” rules per month – beyond that, you have to stick with the pre-defined ones.

    Another social health site is Tweet What You Eat, on which users tweet their food intake and have the site, or the community, calculate statistics such as their calorie intake.

    Over my lunch hour, I’ve come up with some sketches for a site that sits somewhere between the two. It takes Health Month’s goals mechanic, opens it up and removes some of the social aspects that in my opinion Health Month doesn’t implement all that well. It also drifts closer to Tweet What You Eat, in that rather than being its own service it piggybacks of Twitter for its social side.

    At the moment this is just a fun concept I’m toying with – I don’t really have the time to make it at the moment, I doubt the space between Health Month and Tweet What You Eat is wide enough to make a new site popular, and I feel a little guilty about thanking Health Month for the enjoyment I’ve had by becoming its competitor.

    In the notes below it’s dubbed, though as that domain is parked, it’s come to be known as “Daily Promise” instead.

    Home Page

    Daily Promise Home PageThe home page would largely be a “log in / register” affair, possibly also showcasing successful and popular users in a side-bar (not shown). Big banner text explains the rough concept, with a “read more” link to a full “About” page. On the registration side, we make it clear exactly what Daily Promise does and doesn’t do with access to your Twitter account.

    Set Up Goals

    Daily Promise Goals PageThe main setup page is where you set your goals. Users can set any (reasonable) number of goals, they can drop and resurrect old ones, and add new ones, at any time. Performance against all the goals is tracked and visible on this page. Adding new goals and dropping old ones can be tweeted, but as with every tweet opportunity, the user is presented with an @Anywhere box that they can freely edit and can choose not to tweet as easily as they can choose to tweet. The tweet links to the list of goals on their profile.

    Daily Performance

    Daily Promise Daily Performance PageOnce goals are set, the user logs in each day (and can fill in past gaps) with whether or not they have met each goal. Each day’s entry presents some brief statistics, and you get more stats on the week after filling in Sunday’s performance. Very good or very bad performance suggests a Tweet that a user might like to make. The tweet links to their performance log on their profile.

    Performance Log

    Daily Promise Performance LogThis is a user’s main screen. It displays a chart of passes and fails for the last month or so as green (pass), red (fail) or grey (goal not active) squares. Below the chart, more detailed stats are presented, as well as an encouraging text summary of how the user is doing.


    Most of the core settings such as username, display name, avatar and bio are handled by Twitter. Daily Promise’s settings probably boil down to privacy (stop me being searchable, delete my account, etc.) and removing annoyances (always tweet on condition x, never tweet on condition y, etc. – all of which have an “ask me” setting by default).


    Daily Promise Friends PageThe user’s “following” list from Twitter is used to generate their list of Daily Promise friends. Avatars, usernames and Daily Promise performance summaries are displayed here. Clicking through to a user’s profile shows the “performance log” page, topped with name / avatar / bio / etc.

    So, and interesting idea, or an appalling one? Would you use this? Should I get off my arse and code? Should I have finished the last six things I started before prototyping something new? Your thoughts are, as always, appreciated.

  • Sea Battle: Of Ships and Submarines

    The distinction between surface ships and submarines in Sea Battle has turned out to be a more thorny issue than I originally imagined.

    The original plan was to have two classes of vessel, based on their hull types - ship or submarine - and weapons that could hit ships, submarines, or both. A future update could also have included aircraft “hulls”. However, the more I think about the game balance issues, the less I’m convinced that this is a good decision with the tech tree and playing field size that Sea Battle currently has.

    Sea Battle’s tech tree, as it currently exists, has four straight “trees” with 10 items in each. By and large, each component that you research is better than its predecessor. (Later hulls are heavier and take longer to build, so small hulls are still useful. However, you would rarely want to choose anything other than the best weapon, engine and radar that is available to you.) Combined with the small playing field, this makes for a fast-paced game of a few minutes, with each player researching and churning out ships constantly to gain the upper hand.

    There are a number of reasons why the current tech tree is inappropriate for submarines. Firstly, the weapons that a submarine could have: there’s only two. The Sting Ray torpedo (weapon 8) and Tomahawk missile (weapon 9) are the only weapons appropriate to be fired from a submarine. This would make rushing down the hull tree to submarines pointless unless you’d already reached near the end of the weapons tree – and in most games, you don’t even get that far.

    It also creates a UI complication, in that currently, any combination of hull and weapon is permissible. Submarine-appropriate weapons would break that behaviour.

    There’s an issue with anti-submarine weapons too. Again, only two (Depth Charge (6) and Sting Ray (8)) are appropriate for use against submarines. But since a viable submarine build wouldn’t exist until Hull 6 + Weapon 8, they would only exist in the late game, at which point Depth Charges just can’t hold their own against other weapons – so why have them at all?

    To abuse game theory, the logical choice is for players to build Depth Charge ships when they become available, then hold them in reserve as insurance against their opponent building submarines. But if you see your opponent stocking up on Depth Charge ships, you might as well not bother building subs and just go for better weapons and radar instead. Whoever commits to a strategy first ends up on the losing end.

    To cure these problems, perhaps we need to take another lesson from Warzone 2100’s book and have separate tech trees for different weapon types. So rather than one tree of 10 weapons, we have two trees for anti-ship and anti-sub. (And potentially anti-air later.) If we’re going down this route we ought to have different hull trees for ships and subs too. But at this point it’s turning into a rather different game – a slower, more traditional rock-paper-scissors RTS. But these games benefit from larger playing fields, varied terrain and squad-based combat – none of which Sea Battle is particularly well suited to in its current form.

    So the question stands: Do I expand Sea Battle significantly to include this extra complexity, on the understanding that I would probably need to rewrite it in something other than Processing and that may consign it to the pile of “projects I lost interest in”, or do I just ignore the issue and for the sake of simplicity not treat submarine hulls as any different from ships?

  • The Sticker Economy

    I find it remarkable how much my 3-year-old son – and presumably by extension most kids his age – go crazy for stickers. They don’t do anything, besides stick to a wall-chart. They don’t even necessarily have to lead to any better reward (10 stickers and we buy you a toy, etc.). It’s a completely false economy, and yet kids will modify their behaviour just to obtain stickers from their parents.

    I started to wonder what age we grow out of that, and start to realise that the reward is so near zero that we’re effectively being tricked by our parents into behaving well for no reward.

    My conclusion is “never”.

    Here is the sticker chart on my wall. Players of Foursquare and its rivals modify their behaviour – to give a company a complete list of their location history so that they can use it for marketing purposes. In return, for each ever more excessive level of location-sharing, you get a sticker on your wall-chart. And not even a real sticker, just a 100x100 JPEG representing your achievement.

    The only reason Foursquare badges appeal to grown-ups and wall-charts in our bedrooms don’t is that Foursquare is public and social – we can compare our badges with others’, and strive to have the most.

    We never grow out of wanting a sticker. We just compound it with pride, greed, and the desire to be better than everyone else. Isn’t that worse?

  • Sea Battle: Here Comes the Science Bit

    Another day down, and somehow Sea Battle is remarkably close to the finish line. (No idea what I’m talking about? See previous blog entries 1, 2 & 3.)

    First things first, my failings: CPU use and mouse sensitivity are still not fixed. I’m now having to re-render more of the window on each refresh than before, so if anything they might be slightly worse.

    On the Facebook thread, Scott and Mark mentioned an AI issue in that a suitably scary player ship, when parked close to but slightly off to one side of the enemy base, will be ignored by enemy ships in favour of attacking the player base instead – even when they have no hope of destroying the player’s base before their own is destroyed. As far as I know that issue is still there, though improved enemy research and build AI should mean the enemy is pumping out ships just as scary as yours.

    On to the new features:

    • All 10 hulls, weapons, engines and radars are now implemented

    • You can now choose between them when setting build orders, so you can build in whatever configuration you like

    • Research is now implemented – click on an unresearched component to start researching it

    • You start the game with only basic components, and must research more to survive

    • Colours: Grey - not researched yet, Green - researching now, White - available, Yellow - selected (clicking Build will build this)

    • Enemy AI now handles its own research

    • Enemy AI now builds intelligently rather than randomly

    • You can now drag a box to select multiple ships

    And bug fixes / tweaks:

    • Base health significantly increased

    • Building a second ship without moving the first no longer places them on top of one another

    • Pathfinding code tweaked to cope with much faster/slower ships now all the hulls and engines are available

    • Fixed an issue whereby the blue radar circles were drawn at half the ships’ actual radar range

    Still to come:

    • Ship / submarine hull and vs ship / submarine weapon distinction

    • Tweaks to enemy AI

    • CPU use / mouse responsiveness fixes

    • Menu system and difficulty picker

    If you’d like a good strategy for beating the game at this point, I recommend you begin by keeping your build queue about 3-4 ships full, building the best thing you can at any point. Research-wise, rush down the weapons tree as far as Harpoon missiles, throwing in a couple of hulls and radars. Avoid engines for now. As soon as you have Frigates with Harpoons and Radar Mk 4, keep building them until you’ve fended off all the enemies near your base and you have a fleet of 15-20 of them, then move them all right up to the enemy base. With that fleet you should be able to destroy the base before the ships they build wear yours down too much.

  • Sea Battle: That's what Guns are for!

    Another day – or three, in this case – brings another ton of functionality for Sea Battle. (Previous posts: 1, 2)

    Today’s release reduces the target frame rate from 60 to 30 frames per second, in an attempt to alleviate the CPU hogging reported by aefaradien in the previous post’s comments section. As I said in the comments, it’s not an issue I see on every machine, so I’d be grateful if any testers could tell me what PC setup they have, and how much CPU power the game takes up.

    Today’s version also fixes the spinning ships bug that just about everyone reported. What it doesn’t do is make mouse clicks any more responsive, which is annoying me too. Please bear with it for today, I’ll see if I can work out how to deal with that soon.

    Mostly this release is about new features. Sea Battle now has:

    • Ships are now implemented as having separate Hulls, Weapons, Engines and Radars

    • Ships can shoot at each other (finally!)

    • Ships have health (and health bars), and can be destroyed

    • Bases have health (and health bars), and can be destroyed

    • That means there’s now a win and a lose condition

    • Enemy ship AI now considers your ships’ scariness – a factor of firepower and remaining health – to pick targets it thinks it can defeat

    • You can now build, with appropriate build delays and an 11-slot build queue

    • The enemy can now build too

    • Colours have been tweaked to make ships’ allegiances more obvious

    The only real bit of functionality that’s still missing is the research / build options. Currently, clicking the Build button produces a ship of a predefined configuration – you can’t change that config or research better ones. The AI builds random ships up to and including as powerful as your default one, and has a reasonable amount of ‘thought delay’ to its actions, meaning that you can achieve victory fairly easily. (Just fill up the build queue and send every ship North as soon as it’s built – you’ll lose a few, but enough should survive to destroy the enemy base.)

    Note: this blog post is old, and the game now has more functionality than is described here. The next blog post in the sequence is here.

  • Sea Battle, now with more Processing

    Nearly a month ago now, I blogged some sketches and ideas for a game I felt like writing. masterofwalri made a passing reference to Processing in his comment, and having heard people mention it in the past, I figured I should check it out.

    I’m very, very glad I did.

    It neatly deals with the issue of what I should develop for. The comments were leading me down the Java path anyway, but Processing’s two-click export to Applet and bundles for Windows, Linux and Mac OS sealed the deal. And it’s easy to program in too – it’s clear that it’s beginner-oriented, but it’s also ideal for simple games like this as it simply removes all the starting faff, like sorting out JPanels and TimerTasks and all the rest. Time will tell if Processing over-simplifies things and stops me doing something I want to do, but for now it is excelling at the main task of high-level programming languages – reducing the amount of brain overhead I need to allocate in order to talk to the computer.

    One lunchtime has produced 270 lines of code – which already includes the game area of the GUI, controllable player ships, and the beginnings of AI for the enemy ships.

    Note: this blog post is old, and the game now has more functionality than is described here. The next blog post in the sequence is here.

    Currently there’s no real gameplay – you can’t build, and ships can’t shoot or be damaged. You can move your ships (starting at the bottom of the screen) around, and the AI ship will hunt yours. Click on a ship to select it (blue circle), then click elsewhere to set its destination. Red lines, when they appear, show when ships would be shooting.

    The next block of code will give the ships customised gear, health points, and the ability to attack and sink others. With that will probably come attack animations, which with my lack of skill in that department, will take a while. After that, damageable bases and win/lose conditions, then the build/research system. Finally, graphics tweaks, AI improvements and game balancing will finish it off.

    More bloggery will appear once more coding occurs!

  • Windy Morning Mechanics: How Big a Sail do I Need to Fly Away?

    I recall walking to school in a hurricane in what must have been 1989 or 1990, grabbing onto a nearby fence to hold myself steady, wondering how strong the wind would have to be to pick me up off the ground. In the intervening 20 years I never did work it out. It’s a windy day today, so, to the Classical-mechanics-mobile!

    It seems intuitive to me that the answer to the exact question posed by my five-year-old self is “really bloody strong”, and that a better question might be “how much surface area would I need, positioned at the optimum angle and given a certain wind speed, to counteract my weight?”. Or alternatively, “I’m off down to the workshops, how big a sail do I need to make myself?”.

    Let’s start with the pressure on a surface due to the wind, ignoring any issues of aerodynamic flow. Bernoulli’s equation gives us a pressure differential dp, by:

    dp = (v2/2) ρ

    Where v is the velocity of the air, and ρ its density.

    The force, F, exerted by the wind on a solid of area Ap perpendicular to it would then be:

    F = dp Ap
       = (v2/2) ρ Ap

    Assuming the wind is blowing horizontally, in order to generate the maximum amount of lift, the sail should be at 45° to the wind. In this configuration, half the force exerted on the sail will push it in the direction of the wind, and half will push it up.

    However, tilting the sail by 45° (π/4 radians) reduces the area which it presents to the oncoming wind. The area presented to the wind, Ap, as a factor of its true area, A, is given by:

    Ap = A sin(π/4)
         = (√2/2) A

    Substituting this into our force equation, we get that:

    F = (√2/2) (v2/2) ρ A

    Or to simplify,

    F = (A v2 ρ) / (2 √2)

    As mentioned earlier, only half that force is upwards, the other half being in the direction of the wind. So the vertical component of the force, Fv, is:

    Fv = (A v2 ρ) / (4 √2)

    This force is being employed to lift a mass m in Earth’s gravity g, so we have that:

    m g = (A v2 ρ) / (4 √2)

    Rearranging this for the sail area required gives us:

    A = (4 √2 m g) / (v2 ρ)

    Numbers time! If we assume a bored software engineer of mass (m) 80 kg, Earth’s gravity (g) of 9.8 m/s2, air density (ρ) of 1.2 kg/m3, and the Met Office’s current estimate of wind speed (v), 54 miles per hour or 24.14 m/s, our answer is:

    A = (4 √2 × 80 × 9.8) / (24.142 × 1.2)
       = 6.3 m2

    That’s quite a bit bigger than what I could achieve with bat-style wings between my arms and body, but not totally unachievable.

    For my 20 kg five-year-old self, that area would be four times less, at 1.6 m2.

    Part 2

    Since we’ve got this far, we might as well check out my “really bloody strong” hypothesis for how strongly the wind would need to be blowing to enable our engineer to take off unaided.

    Rearranging the equation for wind speed gives us:

    v = √((4 √2 m g) / (A ρ))

    Our engineer has a surface area (from behind) of approximately 1.5 m2, so all other things being equal, the wind speed, v, required is:

    v = √((4 √2 × 80 × 9.8) / (1.5 × 1.2))
      = 49.6 m/s
      = 110 mph

    This is well into hurricane territory on the Beaufort scale, although still a way short of the fastest wind speed ever recorded.

    As for my five-year-old past self, if I had quarter the mass and the same density, I also had around (1/4)2/3 = 0.4 times the surface area. The air speed required to lift me off the ground at that age would have been:

    v = √((4 √2 × 80 × 9.8) / (0.4 × 1.5 × 1.2))
      = 39.2 m/s
      = 87.7 mph

    Also comfortably in hurricane territory, though not quite as outrageous as 110 mph. Maybe if, back then in 1989, I’d stretched my coat out and angled back at 45°…

    Thanks to Tam Coton for correcting my original error in the final section.

  • Waning Technological Desire

    What seems like a long time ago, I blogged about the unrelenting pace of technology and Internet-borne social interaction, and how much I loved it. But that was a February day with the promise of Spring in the near future. Now it is Autumn, and I am not altogether sure I feel the same way.

    I’ve thought long and hard about my options now that my phone contract is up for renewal, and the more I consider, the less sure I am - not just of what I want, but of my innate gadget-fetishism as a whole.

    My first choice was going to be a Galaxy Tab, but having seen the prices, I’m not sure if it remains a sensible idea. For that money I could have an iPad - I’m typing this post from one and it sure is nice to type on, but everything else Appley would get on my nerves soon enough. Should I just go for an upgrade of my current hardware - the latest and greatest Android phone, rather than trying to split my usage into a separate tablet and dumbphone? Maybe just jack the whole business in and keep internet browsing to my laptop?

    My previous post, in which I spent too much of everyone’s time reminiscing about my horrific late-90s website, reminded me of simpler days. Windows 98, Yahoo dialup, AOL Instant Messenger, Netscape Navigator. A big beige box with 32MB of RAM and 1 hour-a-day usage limit imposed by my parents.

    Pretty grim by today’s standards. But yet I used AIM to talk to my friends every night, even though I’d seen them at school that day. And now we have Twitter and Facebook and all the rest, and I’ve IMed my own Best Man, someone I lived with for two years, maybe once a year - and most of my other friends less than that.

    I looked at only a few websites a day, in part because they took so long to load, but I was pretty happy with that. These were days a long time before RSS and clearing hundreds of items a day through Google Reader.

    For all the grey clicky buttons and emoticons and sneaky IRC sessions behind my parents’ backs, was it maybe just more fun when that’s what the Internet was like? Should I save my money for something other than gadgetry, and hark back to some more innocent age? Or have I got my rose-tinted mirror shades set to maximum, yearning to revive a fake past that I would get bored of within days, separated as I would be from the lightning-fast pulse of technology?