Tremulous, free open-source 3D team FPS

December 13th, 2009

Tremulous is my favourite waste of time. I must have lost months of productivity (if you can call the hours after midnight productive) to this game. It’s an online, 3D team First Person Shooter (FPS). That means when you start up the game program, it shows you a list of games running on the Internet, and you attempt to join one. Once you’re in – it goes like this!

A word of caution if you’re in Malaysia: nearly all the servers are in Europe or the USA, so latency is high. That means almost all your opponents will see the action before you do (which means you’re more likely to die). Also, if you’re using Streamyx (which, if you’re in Malaysia, you almost certainly are – because the government ensures there’s no other choice), you’ll probably be suffering from >50% packet loss. In a nutshell, half your ‘moves’ will go missing – which makes you appear to be standing still to the people trying to kill you – and half your bullets will go missing too – which means you’re firing blanks.

I keep wondering if I should try to set up a local server. I guess I need to find some players first! I’m going to try setting up a little server and wireless access point in my house in the next couple of weeks, maybe I’ll run a Tremulous server and a couple of other game servers, tell the local ‘Internet Cafes’ about it, and see if I get any interest that way.

In the meantime, I saw this ‘Tremulous Musical Art’ video by Asvarox at YouTube:

I liked the soundtrack, so I used mencoder and audacity to create a ringtone for my phone:

Tremulous ringtone

Removing the “powered by WordPress” attribution text

December 11th, 2009

I saw a request for help with English grammar from a member of a forum I often visit, so had a quick peep at his website. It looked great, nice copyright message and all. He seemed to be suggesting that it was all his own work, so I had a quick look at the page source. It was WordPress. I had a look back at his site again, and noticed that the “powered by WordPress” text was missing.

WordPress

WordPress

I had a dim recollection of some free projects back in the day asserting that the “Powered by Whatever” was part of the licence for using the software. WordPress – apparently – makes no such demand. I’m a bit anal about some of these things, so if I passed off someone else’s work as my own, I wouldn’t sleep so well at night. If it’s a moral argument… I’m so disinterested, I can’t finish the sentence.

While I was reading some other points of view on the topic, I came across this thread at Crazy On Tap suggesting that removing attribution is something jerks do. By the time I read the thread, I’d already decided that if WordPress don’t ask people to show the attribution, it really is the jerk’s choice to remove it, and you can’t really blame the jerk. Perhaps even referring to them as a jerk wouldn’t be fair. I know I wouldn’t do that. Hey – jerks have rights and feelings too!

I had nothing more to say about the subject, it was a ‘done deal’ in my head. I’d decided that I was right to keep my attribution, and the … other people … were right to remove it on their WordPress installations. Nothing more needed to be said on the matter. No act of philanthropy needed to the guy asking for English grammar help on the forum, he’d failed my new philanthropy test. I’ve saved a few minutes of my life. And then an argument against attribution on the Crazy On Tap thread caught my eye.

On top of that, the stack of code that WordPress is usually running on dwarfs WordPress in complexity. So really if one wants to talk attribution, there should be WordPress, PHP, MySQL, Apache, Linux, and so on.

I can’t decide whether this is a straw man or a slippery slope argument. Maybe I’m not very smart. Personally, I do try to name-check all the open source software (and even occasionally, hardware that has exceeded my expectations) I use. The thing that tweaked my ‘autistic response nerve’ was the bit about attribution for the software stack. I spend a lot of time looking at HTTP – the messages that are sent between your browser and a website. I guess perhaps there are more people than just me who actually care about the nuts and bolts of websites and how stuff is transferred back and forth that do. For people like us, the attribution is there.

First off, the headers from Crazy On Tap, the site the quote above is taken from:

sean@taiguima:~$ curl --head crazyontap.com
HTTP/1.0 200 OK
Date: Thu, 10 Dec 2009 14:23:24 GMT
Server: Apache/1.3.41 (Unix) PHP/4.4.9 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_ssl/2.8.31 OpenSSL/0.9.8e-fips-rhel5
X-Powered-By: PHP/4.4.9
Set-Cookie: SESSION=f5f822a86438999a7ecc824560481ca1; expires=Fri, 10 Dec 2010 14:23:24 GMT
Expires: Wed, 09 Dec 2009 14:23:24 +0000GMT
Last-Modified: Thu, 10 Dec 2009 14:23:24 +0000
Cache-Control: private
Content-Type: text/html
X-Cache: MISS from box0043.localnet
Via: 1.0 box0043.localnet (squid/3.0.STABLE10)
Proxy-Connection: close

Attributed in the HTTP header, is Apache – the free open-source HTTP server, Unix (African or European, I’m not sure which is faster), PHP – the free open source web page scripting language and OpenSSL – the free open source secure communications protocol. The cache headers were added by the free open source Squid cache running on a server on my desk.

Now take a look at the headers from the website linked to by the author of the quote above:

sean@taiguima:~$ curl --head http://www.yafla.com/dforbes
HTTP/1.0 200 OK
Date: Thu, 10 Dec 2009 14:28:47 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 69522
X-Cache: MISS from box0043.localnet
Via: 1.0 box0043.localnet (squid/3.0.STABLE10)
Proxy-Connection: close

For someone who seems so keen to stand up for his right to remove the attribution for free open source software, his headers provide 3 separate mentions for restrictively-licensed software he has paid for. I don’t get it. But maybe I’m just not very smart.

Just to finish off, I looked at those headers using cURL, a free open-source utility that does so many things it’s almost possible to explain simply. I use it for viewing and testing HTTP ‘conversations’. You can see HTTP headers sent by a webserver using this page at spider.my.

One last thing before I post this, I bothered to check the foot of the page at Crazy On Tap, and saw the attribution for FruitShow, a minimalistic forum project. That looks really interesting, I must try to think of a use for it!

Is the new DAP rocket the wrong colour?

December 5th, 2009
DAP rocket with Inkscape guidelines - everything is wonky!

Old DAP rocket with Inkscape guidelines – everything is wonky!

I was thinking of writing an article about the Jalur Gemilang – the Malaysian national flag – and the importance of very carefully specifying your ‘brand’, and remembered I’d written about Malayisia’s Democratic Action Party (DAP) logo before. Last time I wrote about DAP’s logo, I mentioned that the version on their official website seems to have been badly drawn. You can see in the screenshot that I took of the original logo that the Inkscape guidelines show the logo elements don’t line up at all! DAP seem to have updated the logo on their website, so it isn’t wonky any more. Now the colour is wrong! You can see they still have some old branding at top left showing the old ‘wonky’ rocket with a dark blue circle. Now the new symmetrical DAP rocket has a light-blue circle!

DAP symbol - 1 Party, 2 Logos

DAP symbol – 1 Party, 2 Logos. Dark blue top-left, mid-blue centre

I’m hoping  I will be able to find a specification for the Jalur Gemilang somewhere, but  I hope the DAP – or one of the other Pakatan Rakyat (Opposition Pact) parties – will be first to the Internet with a demonstration of how an open, transparent political organisation would competently specify its most famous brand. How else can we promote these things properly, unless they’re unambiguously defined?

Old 'wonky' DAP rocket logo

Old ‘wonky’ DAP rocket logo

In my previous article, I pointed out some things about DAP’s symbolism that I thought were counter-productive to their cause – as well as objectionable to any reasonable person. While I was tracking down old versions of the wonky DAP rocket (included here just for ‘completeness’), I saw very many Malaysian political blogs. The mainstream media in Malaysia is terrible for political comment. Owned by powerful businesses closely tied to the current government, it’s practically pure propaganda – it’s simply awful to read.

The online scene is much livelier – I particularly liked the summary posted at “Malaysians Unplugged Uncensored“, where I found the old version of the wonky rocket. It’s originally from “Politics 101 Malaysia”, which I used to read a couple of years ago, but seems to have disappeared. See Point 7 of The REAL meaning of DAP’s “The Rocket” on their blog round-up article of 10th February, 2007. It made me smile, anyway.

In my previous article, I produced an SVG (Scalable Vector Graphics) file using Inkscape. SVG artwork can be scaled to any size without the ‘jagged edges’ on curves that result when you scale bitmapped files. DAP could produce official artwork in such a format, with perhaps a few representative bitmapped files exported from it in various sizes. End-users of the DAP brand would then have identical artwork on their own publications.

Another alternative – which would be slightly more work to do properly – would be to produce unambiguous plain-language specifications that would allow a graphic artist or draughtsman to re-create the brand. Then again, if a political party can’t ‘do’ it’s own brand properly, on what basis do we support them in their bid to run the country?

Just for the sake of enormous rockets, here’s my version of the DAP logo once more, as a 932×2000 PNG exported from the SVG file. There is a shortcoming in my version of the file – there’s no background specified, only a white circle overlaid on the blue circle to make the roundel. If you wanted to go one better than me, you could address that issue in your own SVG file, and then write a blog article criticising my attempt. You can download my SVG file by clicking on the rocket:

DAP rocket 932x2000 pixels 57KB - click on image to download scalable SVG file

DAP rocket 932×2000 pixels 57KB – click on image to download scalable SVG file

HTTP Ping – roundtrip times using redirect

December 3rd, 2009

I’ve been moving some of the stuff I wrote on poditronic.com over to spider.my recently. I can tell the Spinneret API is starting to settle down, because there’s less pain every time I update my existing applications to match the new API. It also shows up some lingering bugs too!

HTTP Ping redirect round-trip timer

HTTP Ping redirect round-trip timer

The latest thing added to spider.my is a completely new page that offers an ‘HTTP Ping‘. ‘Ping’ on the Internet usually describes a utility that tells you how long it takes for data to go from your computer to another computer and back again. Ping is a very accurate measurement of the time between two pieces of hardware on the Internet, because almost no processing is performed at all at either end – not in the creation of the tiny packet of data, nor in its echo.

The ping test is not an entirely accurate test of a user’s “Internet experience”, since we tend to send and receive much larger pieces of information, and – unlike ping, which is a utility that operates at very low levels – we tend to use web browsers and interact with web servers. With that in mind, I’ve made a page for spider.my that will repeatedly (for small numbers of repeats) test the time it takes for a browser to request a page, receive and ‘understand’ a response, and send another response.

An HTTP Redirect is a response from a webserver to your browser that tells your browser the page it is looking for has a different URL to the one you typed in (or clicked on another site). There are lots of goods uses for HTTP redirect, but you only really need to know that lots of sites use them, and you usually know nothing about it. Your browser requests one URL, the web browser says “that page has moved to X” and your browser loads the new URL instead. Spider.my uses a redirect when you browse the ‘root’ URL – http://spider/my/ – to redirect your browser to a page with a name – http://spider.my/homepage.html – because I think pages with proper names are a good idea!

The redirect round-trip timer at spider.my allows you to select a number of redirects, and start the timing process. Your browser will send a request to spider.my, which will send a ‘redirect’ reply. Actually, the redirect is to the same page, but with an argument that counts the number of remaining requests before a page with the results are shown. It’s that simple. Most browsers will allow more than ten redirects, but ten is the highest number of redirects the page at spider.my will send.

Spider.my is hosted in the USA, so timings should be greater the further away you are from the USA. If there’s a very large difference from one timing to the next, your Internet connection may be suffering from packet loss. The ping utility only tries once (unless it’s magic, as pings on TM’s network seem to have been for some months) – if a ping packet goes missing it is reported as missing and another one is tried. HTTP connections are made over a reliable transport, so the redirects are guaranteed to arrive. If something bad happens to an HTTP transfer, parts may be re-sent after a time-out elapses.

While I was writing the page, my Streamyx connection was abysmal. Web pages were taking sometimes minutes to load, and typing commands over an SSH session was unbearable. With delays between typing a key and seeing the character appear of anything up to 20 seconds, a typo was heartbreaking! Streamyx has been much better today, but there were still some poor timings in the afternoon.

What use is this page?

Good question! At the moment, you can only get timings between your PC and spider.my’s server in the USA. If you suspect your Internet connection has ‘issues’ you can use the page at different times of day to see if delays are different at different times of day, or you can use it to compare with a friend. You might also get some idea of the relative performance of different Internet Service Providers in your country.

On my local network, the redirect round-trip takes a very small time, and which browser I use seems to make a much greater difference! Perhaps I’ll write that one up for a blog article one day.

Damerau-Levenshtein Java methods updated

November 30th, 2009

I had a long-overdue review of the Damerau-Levenshtein Java methods I wrote, extended the regression tests that are included in the class, and discovered a few bugs still hiding in the code. I’ve pretty much re-written the methods so that they’re much easier to read, are much closer in structure to the pseudo-code posted at wikipedia, and also perform slightly better.

Damerau Levenshtein demo at Spider.my (now at this blog using JSONP)

Damerau Levenshtein demo at Spider.my (now at this blog using JSONP)

The function specifications have changed slightly, with an overloaded version that provides exactly the same interface and behaviour as before, at a slight performance penalty owing to two extra method invocations. The methods previously allocated their own workspace (an int array) for tracking the cost of edits, but now expect a pre-allocated workspace to be passed to them as a parameter. Overloaded methods having the old style of parameters now invoke a class method to allocate a new workspace, and pass the int array along with the supplied parameters to the new methods.

For one-off invocation of the methods, the change  introduces a small performance hit. For repeated invocations, I suggest your calling code allocate the workspace, and reuse it in each call to the edit-distance methods:

int[] aResult = new int[candidateArray.length];
int[] workspace
  = Levenshtein.getWorkspace(matchString.length()
  , longestCandidate.length());
int i  = 0;
for (String candidate : candidateArray)
    candidateArray[i++]
      = damlev(matchString, candidate, workspace);

From tests here, you should expect a 6-10% performance boost – using a pre-allocated workspace – on unlimited (whole strings are tested) invocations of the functions. If you’re using the limited (levlim, damlevlim) versions, the speedup can be enormous, depending on how poorly matched your candidate strings are. I haven’t tested with a ‘real-world’ data-set yet, but a worst-case ‘dumb test’ of two totally different strings gives average timings of down to 16 nanoseconds for the pre-allocated workspace, 4,500 for the locally allocated workspace. If your workload consists of very-closely matched strings, you’ll get a performance boost closer to the 6-10% above.

You can try out the methods at spider.my’s Damerau Levenshtein demo page, and download the code from there too.

The MySQL UDFs are probably badly in need of a code review, and I never did write a proper set of test cases for them, so they’re next. I’m not actually using them in any projects at the moment, so they’re not next in terms of priority. The first person to state a preference for recently-maintained MySQL UDFs get’s a free code review and regression tests.