2012
04.07
Battlefield 3 may be a great looking game, but it’s not without its fair share of bugs and oddities – the clunky Origin->Browser->Origin->Game launch sequence among them. But a far more annoying problem for some players is the inability to connect two or more players on the same LAN to the same internet server. As soon as the second client connects and loads the game, the other player is unceremoniously dumped out of the game to stare at their desktop in blank surprise. What exactly is causing this crash?
Well, it’s a problem that also affected Battlefield: Bad Company 2 and various other games. Two clients, using the same default client port, attempt to connect to a server on the internet. As they both get their internet connection through a router, to the external viewer, i.e. the server, they appear to have the same IP address and port – this is what causes the problems. The first client gets dumped when the second takes over the connection.
In Battlefield: BC2, the problem could be fixed by launching the game with a command line argument to change the client port, but due to the aforementioned odd launch sequence required to play BF3, this is not currently possible. Instead, UPnP must be disabled on the router. This changes the way that the router translates ports, and in most cases fixes this problem. This can be achieved using the router’s control software, which is accessed using a web browser. The default address and required credentials are usually printed on the label of modern routers.
However, if your router doesn’t support UPnP in the first place, or you need other you’ll have to set up a manual forwarding two separate external (router) ports to UDP port 3659 on the respective computers. Details on this are available from portforward.com.
For more information, have a look at this thread on the EA forums.
2012
03.14
I recently switched from mIRC to KVirc for a chat client, because I’ve already installed mIRC on three PCs and I can’t be bothered with getting another license. This prompted me to look for a new script to show what’s playing in my iTunes occasionally. Luckily, KVirc has a lot of media player functionality built in, with support for AMIP – a useful tool to fetch now playing information from a variety of media players. Playing around with this, I discovered there’s an option to write the information to a file in a format of your choosing. This gave me an idea: why not use it to share the song in a game?

So here’s how to do it:
- Download and install AMIP for your player from http://amip.tools-for.net/wiki/amip/download
- Download and install the AMIP Configurator from the same page
- Open the AMIP Configurator and go to the “File/Email” screen under “Other Integrations”
- Set the file path to a new .cfg file in your game’s config directory – I’m using Paintball 2.0, so in my case it’s C:\games\paintball2\pball\configs\song.cfg.
- Set the text in the “Play” etc. windows to some appropriate commands, substituting %name where you want the song title & artist. For example, in Paintball2, the “me” command will broadcast the speaker’s name followed by the text you give it. If your game does not support this, the vast majority of all quake derivatives support the “say” command, so you can use that instead.

- Click apply and then OK. If you get an error about saving the config, you may need to run the configurator again, with admin priviledges (right click->run as administrator)
- Start your media player and select a song.
- Start your game, and bind a key to “exec song.cfg”, or whatever you called your config. I chose the keypad enter button, so I typed: “bind kp_enter exec song.cfg”
- Press the button you chose whenever you want to show the song you’re listening to
This should work with most Quake 1/2/3/4 engine games, and derivatives – e.g. it works with the Source engine too, for any Half-Life 2: DM/Counter-Strike: Source/Day of Defeat: Source players out there

2011
10.21
I was bored again, and thought I might create a PHP script to encrypt some text or a file with ARC4 and then steganographically hide it within the least significant bits of an image or something. Haven’t done that yet, but here’s the first part – ARC4 in PHP, basically just a translation of my javascript version from the previous post.
class arc4Bitstream
{
private $i;
private $j;
private $s;
function __construct($key, $drop = 0)
{
// initialise s array to identity
for($i = 0; $i < 256; $i++)
{
$this->s[] = $i;
}
// key scheduling algorithm
$j = 0;
for($i = 0; $i < 256; $i++)
{
$j = ($j + $this->s[$i] + ord($key[$i%strlen($key)])) & 255;
// swap s[i] and s[j]
$k = $this->s[$i];
$this->s[$i] = $this->s[$j];
$this->s[$j] = $k;
}
$this->i = 0;
$this->j = 0;
// ARC4-drop[n] support - recommended: 3072, compat: 768
$this->getStream($drop);
}
public function getStream($size)
{
$data;
for($c = 0; $c < $size; $c++)
{
$this->i = ($this->i + 1) & 255;
$this->j = ($this->j + $this->s[$this->i]) & 255;
// swap s[i] and s[j]
$k = $this->s[$this->i];
$this->s[$this->i] = $this->s[$this->j];
$this->s[$this->j] = $k;
$data .= chr($this->s[($this->s[$this->i] + $this->s[$this->j]) & 255]);
}
return $data;
}
public function transformText($input)
{
$bitstream = $this->getStream(strlen($input));
$output = "";
for($i = 0; $i < strlen($input); $i++)
$output .= $input[$i]^$bitstream[$i];
return $output;
}
}
2011
10.03
Yup. Sunday afternoon is always the slowest time of the week, and as I don’t actually have any work to do yet, I decided to waste my time on this: a simple and hopefully easy-to-follow implementation of the ARC4 stream cipher in JavaScript.
function arc4Bitstream(key, drop)
{
// initialise s array to identity
this.s = [];
for(var i = 0; i < 256; i++)
{
this.s[i] = i;
}
// key scheduling algorithm
var j = 0;
for(var i = 0; i < 256; i++)
{
j = (j + this.s[i] + key.charCodeAt(i%key.length)) & 255;
// swap s[i] and s[j]
var k = this.s[i];
this.s[i] = this.s[j];
this.s[j] = k;
}
this.i = 0;
this.j = 0;
// ARC4-drop[n] support - recommended: 3072, compat: 768
if(drop)
this.getStream(drop);
}
arc4Bitstream.prototype.getStream = function(size)
{
var data = [];
for(var c = 0; c < size; c++)
{
this.i = (this.i + 1) & 255;
this.j = (this.j + this.s[this.i]) & 255;
// swap s[i] and s[j]
var k = this.s[this.i];
this.s[this.i] = this.s[this.j];
this.s[this.j] = k;
data[c] = this.s[(this.s[this.i] + this.s[this.j]) & 255];
}
return data;
}
arc4Bitstream.prototype.transformText = function(input)
{
var bitstream = this.getStream(input.length);
var output = "";
for(var i = 0; i < input.length; i++)
output = output + String.fromCharCode(input.charCodeAt(i)^bitstream[i]);
return output;
}
I recommend any of the other well recognised and more importantly well tested javascript implementations out there if you are intending to put this into production use, as I only tried it with a couple of the wikipedia examples to check it worked. It also supports ARC4-drop[n] by use of the drop parameter when initialising a new arc4Bitstream. This helps to defend against analysis attacks which take advantage of strong indications to the key which are especially prevalent in the first bytes of the generated keystream. Also, there is no key management, that is left up to anybody who is using the code to implement, so using the same key twice will destroy your security. I don’t really know why I really wrote all this out anyway, it’s not like anybody will read it, even less likely they’d try and use it ;D
Edited 21/10/2011 when I finally realised I’d bothered doing a pair of encrypt/decrypt functions that did the exact same thing with different variable names… transformText now does both.
2011
10.01
Category:
News /
Tags: no tag /
So, no updates for, what, 6 months? Half a year of inactivity. It kinda makes sense: exams, more exams, waiting for results, getting results, procrastinating, organising, moving and partying for a week. And then today. So: just to shed some light on the situation, I’m now at the University of Southampton doing a 3-year course in Computer Science. Which means I’ll both learn more skills I can use in hobby projects, and have less time to actually apply those skills. Also, probably more blog updates – with even less actual value in them (i.e. map previews, little programs, tutorials) than before, and that’s saying something considering how little of worth appears here anyway.
Still working on my not-so-secret project though. Hint: it contains JavaScript, WebGL and deformable, muddy terrain
2011
04.03
Category:
Gaming, Mapping, News, Paintball 2.0, PHP, Programming, Trench Breakthrough: Ypres /
Tag:
banterous, cold war city, mapping, paintball, update /
It’s been a long time.
I pretty much ran out of posts when the local shop ran out of energy drinks. Now, the last exams of my school career and exodus to university lay on the horizon. In the next couple of weeks though, I’ll hopefully have enough time to get back into a routine of posting stuff. I’ve been working on a load of things recently.
First of all: new programming project. Trench Breakthrough: Ypres is coming back once again, and I’m rolling my own engine in Javascript, using the new features which HTML5 and related specs (basically WebGL) have made possible. I’ve been working on this for a few months now – hopefully this’ll be big enough to have some posts of its own soon
Secondly, banterous.co.uk expansion, including the new domain “bantero.us“, thanks to webhead. So far it’s been a site for sharing demos, but soon it will be a general DP:PB2 utility site, hosting demos in addition to a map database and other tools which were once provided by sk89q’s Digital Paint Resource site. The reference sections of that site will be replaced by the wiki which webhead is currently developing on the banterous hosting. f3l1x, the author of some awesome server tools is also helping out. And another developer called Payl has developed a banterous demo downloader
I’ve also been trying to finish Cold War City for release, having done another 3 betas or so.
Hell, maybe I’ll even put some content up here that is actually useful for once instead of just a brain dump. You never know
2010
09.25
The third of the four new Rockstar varieties I’m current going through, and the last of them to feature the £1.19 price point. Oh well. All good things come to an end. Here’s the can:

Same as the other 2 £1.19 Rockstar spinoffs, there’s the usual 32mg/100ml caffeine and so the same “value” figure of 1.34mg/p. How boring. The only thing differentiating this from the others is, of course, the taste.
And what a taste it is. This drink does “tropical” well. It tastes very fruity, without being artificial. It also contains 10% apple juice (from concentrate), which you can’t immediately taste, but definitely adds to the flavour. It’s not so fizzy, which means it feels nice and juicy. It’s not over-sweet or very syrupy either. I haven’t tried this drink warm so I can’t be sure how that would compare, but what I know is that this drink is VERY refreshing chilled. For £1.19, definitely a good deal, especially on a hot day.
Taste: 9/10
Value: 5/10
Experience: 8/10
Overall: 8/10
2010
09.23
Another Rockstar spin-off, and unlike the last one, it actually knows who it is trying to appeal to. The can makes it fairly clear that Rockstar Cola is a cola-flavoured drink packing the caffeine and energy of a normal can of Rockstar. This seemed like a good idea to me, as I love cola, and sometimes the range of energy drinks available is not quite to my taste.
As you can see from the can, it has the same price as Rockstar Recover. And the same concentration too. So it’s also got the same value rating, 1.34mg/p.
So, the drink itself. It looks like cola. It tastes a bit like cola. Not coke or pepsi quality cola, but more like supermarket diet cola. A slightly fruity aftertaste too. Sadly it also leaves your mouth feeling dry, but if you like cola and the alternative has an unappealing-sounding “mixed-fruit” flavour, you know you could do worse.
Taste: 6/10
Value: 5/10
Experience: 6/10
Overall: 6/10
2010
09.16
There are several variants of Rockstar energy drink – so far I’ve only covered the original, but right now I’ve got 3 more in my cupboard. So here we go – I’ve chosen Rockstar Recover cause it sounded intriguing – described on the can as a “non-carbonated lemonade… with added juice” – which certainly sounded unique. It also seemed to target the exercise market – or partygoers, I can’t work out which – with the promise of rehydration and electolytes in addition to their caffeine boost. Anyway, here’s the can, nice and plain and yellow – it stood out on the shelf pretty well among the Relentless and Monster drinks with their dark designs.
It’s £1.19 per can, which was the same price as two of the other Rockstar varieties I bought, which seemed nice given its extra claims. Now – to the interesting bit: the taste test! Well, they were definitely right about it not being carbonated. Sadly, they failed to mention that while it is fairly easy on the tongue to begin with and leaves no aftertaste, helpful if your throat is still “recovering” from whatever, it has a horrible too-much-lemon-squash taste in the middle of your drink. Nasty. As far as the refreshment goes, I didn’t really feel anything noticably different from the effects of any other caffeine drink, although once down, my throat felt a bit better I guess. It packs 32mg/100ml into the £1.19 500ml can, resulting in a mid-range caffeine-by-price of 1.34mg/p. A mixed drink.
Taste: 4/10
Value: 5/10
Experience: 7/10
Overall: 5/10
2010
09.15
I haven’t done a review for a while, but recently came across a number of energy drinks that I hadn’t seen before, so I bought some and brought them home. First up is inVigoration, or just “V” as the can design emphasises. A 250ml drink for mental stimulation costing 99p per can for 31mg/100ml of caffeine – that’s 77.5mg overall – each penny buys you 0.78mg of caffeine. This is a bad deal compared to pretty much any drink except Red Bull. But do the other features of the drink balance it out? Here’s the nice green can:

Looks nice and refreshing, doesn’t it? Well surprisingly enough, it is – at least a refreshing break from the “mixed fruit” flavours of other drinks. I’m not quite sure what it tastes of, but it has a sort of citrus tang to it, instead of a sickly sugar-overload taste. Peculiar. It tastes like a slightly medicinal fruit punch.
Taste: 7/10
Value: 2/10
Experience: 5/10
Overall: 5/10