21 Feb

Awesome games that are also free

Here is yet another list of free games considered awesome by the majority of this blog’s writers (me). As you can see, my taste in games is quite retro.

Cave Story (D?kutsu monogatari, ????)

Note: The author of Cave Story has requested people to stop distributing the game, this is because is is to be expected to be available on WiiWare (I hope the game will not be exclusive to Wii gamers). Here’s one such rumor.

Try if you like: Megaman 2, Metroid – any good NES game that defined your childhood

Here is a game that is on every free games list and for a reason. Cave Story feels and looks like a NES game that was updated for a SNES release. The graphics are simple and sometimes blocky – but intentionally so. Similarly, the music is something you would hear in a NES game. In a good NES game. I still find myself humming the catchy tunes even though I finished the game a while ago.

The basic game is about making a little guy run, jump and shoot. There are a variety of weapons, some weapon choices even alter the game story. There even is simple leveling up, some enemies drop crystals that make your current weapon more powerful.

Best of all, there clearly has been huge effort in making the game more than a retro run-and-gun game. There actually is a good, long story about cute creatures that need your help. The levels are huge and varied: there even is a side-scrolling level. Another level twists the standard game mechanics as you need to negotiate a flooded area with vortices that usually pull you into unsurprisingly lethal spikes.

There also are memorable boss fights including one with a boss larger than the screen. Now that I mentioned it, the game is simply memorable. There are too many things to tell about this game. Too bad the game is free because it clearly is worth money.

The game is available at least for PC, Mac and GP2X.

Rated: Awesome+


Try if you like: SimCity and other building games, trains in general

Transport Tycoon probably is the game that I have spent the most time with, ever. It’s basically about tiny trains hauling things from A to B, then hauling things from B to C.

Sounds boring. Why is it so awesome?

Because there is a ton of things to try to make your transport empire make more money. You could build a simple track from place A to B and then another track from C to D. But if you’re smart, you’ll build a whole railway system and connect satellite stations to it – just like it is done in the real world. Then, to make trains smarter, you’ll add signals, build more efficient stations and update your old routes to monorails and so on.

I think the defining factor that makes OpenTTD so fun is that it is actually you who builds all these things. For example, in some other simple game you could select between a few station types – each with their own cost and efficiency. In OpenTTD, you have exactly one station type. What makes a station efficient is how you connect the rails to it, how many platforms it has and do slower trains clog up the whole system. To give some perspective, here is the game manual on stations.

There also are airplanes, ships and trucks but they’re rubbish.

OpenTTD is ported on many systems as it is open source. There even is a Nintendo DS port.


The Ur-Quan Masters (aka. Star Control 2)

Try if you like: Any scifi game

Star Control 2 is probably one of the most loved games from the early 1990s. It combines exactly right amounts of adventure, action, exploration and humor. The game is about you, the spaceship captain, trying to free Earth and the known universe from the Ur-Quan (tentacled slavemasters).

The gameplay consists of a top-down view of your ship. The ship is controlled by rotating and thrusting – nothing new since Spacewar or Asteroids. The controls remain the same whether the ship was in hyperspace, traveling for hundreds of light years, and during close encounters with enemies, i.e. dogfighting to death while orbiting a planet.

When your ship is in hyperspace, you can travel between stars. Every star has planets orbiting it, most of the game features you launching an exploratory ship down on the planets and collecting minerals and biological samples. The things you find act as money: at Earth you can trade minerals and other stuff to fuel, technology, crew and fighters. The biological samples can be traded for new technology when you come across a certain alien race.

Some stars are the homeworlds of alien races – some friendly, some less friendly. When meeting an alien, you will converse with them using different bits of dialogue, similarly to most adventure games in general. You will often get information where to find more alien races and sometimes you’ll get a quest to complete. Sometimes, you’ll be able to avoid battles if you are smart when conversing with the aliens. It is during these encounters you will get the most laughs.

The presentation is nothing short of awesome. Every race you meet has its own theme music, animated graphics, voice acting and even font for the captions.

Rated: AWESOME-666

18 Feb

A simple statistics plugin for WordPress

Here’s a very simple plugin for WordPress that keeps track of view counts of individual pages. It is not intended to be a complete statistics solution. Rather, the main purpose is to provide something for those empty spots in your site layout.

Here is a sample graph (page views for this site):

For a better example, see the site stats page.


  • Keeps day-by-day based page view stats using the database
  • Outputs a clean histogram
  • Includes easy functions for those who are better at blogging than programming


Copy viewcount.php in /wp-content/plugins and enable it in WordPress options. Enter the path of the directory you want to the graph cache to be located in the options page (Options > Viewcount). The plugin will then start counting page views.

Note: the plugin taps into the_content(). Pages that do not use it will not update the stats! See below for a workaround.


To display statistics, there are a few functions.


get_view_histogram() returns a URL to a PNG image.

If $page is unset or is -1, the data will be the combined page views for all pages. $web20 specifies the height of a “Web 2.0” style reflection under the bars. The rest of the parameters should be easy enough to figure out.

You can use the function like this to display the statistics for the current post (or page):

<img src="<?php echo get_view_histogram($post->ID); ?>" />

You can also display a top list of page views with get_view_count_list().


$excludeid is a comma-separated list of post IDs (note:the list is not escaped so do not use any values in there that come straight off $_GET or so!). $type is either “post” or “page”, empty string returns both.

You can exclude the page that is currently viewed like this (shows the top five pages from the last 30 days excluding post ID $post->ID):


To display a Popularity Contest style percentage (the percentage of traffic a post has compared to other posts), use get_popularity($page=-1,$days=30,$format=’percent’). if $page equals to -1, the current page ID will be used automatically. $format can be either ‘percent‘ or ‘float‘ — ‘percent‘ returns a string with the percent sign, ‘float‘ returns a floating point number between 0.0 and 1.0. The following will display a percentage of page views for the current page during the last 30 days.

<?php echo get_popularity(); ?>

To display all time statistics, you can simply do this:

<?php echo get_popularity(-1,99999); ?>

This will display all time statistics, unless your blog has been online for more than 274 years.

To get the list of most viewed pages, use the function get_top_pages($days=30,$limit=10,$type=’views’). $type is either ‘views’ or ‘popularity’.

You can request more functions!




You need the GD library installed for PHP.

I created the plugin to see how that is done. Therefore, crap code ensues (see the warning about excluding posts above).

The plugin will count views for pages and single posts only. Page views from users who are logged in (e.g. you) will not be logged.

The plugin taps into the_content() to count views. You can use vc_update_counter($id) to manually update the page views (or, you can be creative and count very different stuff with it – just make sure the ID is not in use by real pages).

In case you think the graph is wrong: the bar height is normalized. This is just so there is interesting variation in the height.

11 Nov

Compare text files in SQL

Here’s a quick hack that allows loading text files as tables in a sqlite database. Why? It’s pretty nice to compare files in SQL.

txtsql can be run as follows: txtsql.exe file.txt file2.txt ...

Every text file is loaded as a table with two columns: row (line number) and data (the actual text). When saved with save and the first column is named row, it will be skipped. Thus, every loaded table and ever table created with new will be saved as a normal text file. Any other table will be saved with tab characters separating the cells.

The program is just a test to see if this is a viable concept (post a comment if you think it is). If it seems to be something to develop further, I’ll add something like transparent loading and saving of text files as tables when they are invoked (now you have to load them with the load command), common text operations (fuzzy searching etc.) and such.


Count lines:

load `file.txt`
select count(*) from `file.txt`

Save unique lines in a new file:

load `file.txt`
new `uniq.txt`
insert into `uniq.txt` (data) select distinct data from `file.txt`
save `uniq.txt`

Find similar lines:

load `1.txt`
load `2.txt`
select data from `1.txt` where data in (select data from `2.txt`)

txtsql.zip – Binaries (Win32) and source code

17 Oct

Viewer2 Build 3664

  • PNG support (i.e. I rewrote the loader code so it’s easier to add more formats – contact me if you are willing to write a plug-in)
  • Image details when hovering over a thumbnail
  • Progress dialogs for various actions
  • Added a white border around thumbnails, seems to be in the vogue (you can disable it in the config)
  • When viewing images full-screen, the background will fade into black