Saturday, 27 December 2014

The year that was

I often kick myself for not indulging my creative side enough, so in the interests of being positive once in a while and reminding myself that I do write more than I think I'm compiling a (likely incomplete) list of creative "things" done this year.


2015 is on the horizon. More next year.

Ubuntu 14.10, finally

I seem to have gotten into the habit of writing a post each time I do an upgrade, so here is the one for Ubuntu 14.10. It's really easy - by far the simplest upgrade I can remember. This, I'm sure, is partly because the changes behind the scenes this time are more about stability than new features but it's a welcome change. Nothing, and I mean nothing has broken for me either on my desktop install or this laptop.

I can't say I'm immediately noticing many improvements either, other than the latest packages. Not that I'm complaining - mostly, an obvious improvement means a change and frankly I like Ubuntu 14.04 enough as it was that it didn't need another overhaul to make me happy. Some minor bugs have been ironed out - the big one is that it no longer randomly forgets my keyboard language preferences.

So, don't fear this one. For me, this is the perfect upgrade - nothing broken and no major changes to learn.

Wednesday, 23 July 2014

Ubuntu 14.04 - here we go

Quick post about the upgrade from Ubuntu 13.10 to 14.04. It went ahead without any real problems. For the first time my decision to disable the utterly horrible "shopping" lens in Unity was honoured over an upgrade (well done - finally).

Bad things: the window close buttons have wandered over to the left AGAIN. This time apparently Canonical have removed the all of the options to move them back (well, someone is recommending recompiling the window manager but there is no way I'm doing that). Thanks guys, that's really helpful.

Further bad things: synaptiks is currently missing from the Ubuntu repositories so if you want a middle mouse click on your touchpad you're out of luck. Fortunately there is a way around that - you can install it from the debian repository:

sudo apt-get update
sudo apt-get install wget gdebi
wget http://http.us.debian.org/debian/pool/main/s/synaptiks/kde-config-touchpad_0.8.1-2_all.deb
sudo gdebi kde-config-touchpad_0.8.1-2_all.deb

That solution pulled from here.

Now to man up and do this on my work machine...

Friday, 25 April 2014

Tagging a music library for use with a Sonos system

I migrated my iTunes music library to a NAS built with a Raspberry Pi so it could be shared with my Sonos system. Before this the only thing reading any metadata on the files was iTunes which can sometimes do weird things. Coupled with that, I've previously used TuneUp to fix broken metadata within iTunes. It works very well in that context but it seems that the metadata it writes is non-standard in some way and other programs will not read it. All this manifests in some of my music only appearing in the track listing part of the Sonos interface, being listed by filename rather than track name and not being listed by album or artist at all.

What do I need?

Sonos reads standard id3 tags - apparently v1 or any of the v2 options. The files need to be tagged in one of these formats.

Fixing things up

My files are kept in a consistent directory structure looking like this:

blah/Music/Gun/Swagger/01 Stand in line.mp3

My first plan was to use a Linux command line utility for reading and writing id3 tags and pull the required information from the directory path using some clever scripting. I've been away from work for over a week so my brain isn't really up to the required "clever" scripting at the moment. Fortunately, when building the NAS as per my last post I made all my music available over a samba share so it was easy to mount that on my desktop machine and get access to the files that way.

There are dozens of GUI id3 editors. I chose to use mp3tag (my desktop is a Windows machine) and hoped I could somehow convert the tags produced by TuneUp and used in iTunes to something more standard. Unfortunely mp3tag lists the TuneUp tags as "Bad Tags". Drat. Well, at least that explains the problem.

So, armed with my new clicky it's back to plan 1. Having found the files which needed attention I used the "filename-tag" converter with this pattern:

%artist%\%album%\%track% %title%

Slashes reversed because we're in a Windows environment now.

This solved the vast majority of the problems. There were still a few albums tagged in a bizarre way - with no track numbers and a title of something like "01 Intro". I didn't want to completely nuke the existing tags for these as they included Album Art so it was time to break out the "tag-tag" converter which lets you use existing information in the tag to populate other fields.

We need two different filters here, applied in this order because the second removes information needed for the first.

Field: TRACK
Pattern: $left(%TITLE%,2)

then

Field: TITLE
Pattern: $cutLeft(%TITLE%,3)

These methods came from the scripting section of the mp3tag documentation. It turns out it's quite powerful, even if the methods don't always do exactly what the docs suggest they will do.

Job done.

Next steps

My album art is all extremely patchy. Sonos is now my primary playout system at home and it takes an age to load album art so I'm not too bothered about fixing it, however if I change my mind there are a couple of options. Firstly, mp3tag lets you paste album art into the box rather than having to use a presaved photo. I can look up album art in iTunes and copy from there for the occasional simple fix.

If I want to do a proper, automatic job I'll probably take a look at Album Art Downloader which is apparently very good and can be run as a tool within mp3tag. That's fun for another day though.

Monday, 21 April 2014

Using a Raspberry Pi as a headless media store on a Sonos network

This is to build a headless media centre and is also being built that way - that is, I'm not going to plug a screen or keyboard/mouse directly into the Pi. This means that I can install the version of Debian without the window manager which makes it far lighter on the processor.

It's not difficult, but I've compiled my notes and written some English to link them together as someone may find them useful. I'm going to assume some basic Linux and home networking knowledge.

You will need

Sourced from Amazon, total cost (at time of writing, without hunting around) is: £47.60

You'll also need some USB hard drives. The Pi (model B here) only has USB 2.0 ports so you can use older drives if you're not planning on plugging them in anywhere else. Also, the Pi runs on very low power so you really want powered drives or a powered USB hub to sit between them. If you want to back up your data, you're going to need two drives. If you don't, you can ignore all the stuff about rsync that comes up later.

Let's go

Up and running

  1. download Raspbian
    Sadly, the NOOBS install method requires the use of a screen so wont work for us.
  2. install Raspbian onto the SD card
    These are the instructions for prepping the card on a Windows machine.
  3. put the Pi in the case, plug in the ethernet cable and put in the SD card
  4. finally plug in the power cable and we're off

Connect and update

Find the IP address of your Pi, shell to it and log in (default username / password is pi / raspberry). You need to run:
sudo raspi-config
and select the option to expand the root filesystem to fill the SD card. It's important you do this before any of the other steps or you will be starting again.

Next update the operating system via:
sudo apt-get update
sudo apt-get upgrade
This will likely take a while.

Connect the drives

Plugging the drives in will auto-mount them, however if we are using one drive as a backup to the other we need to ensure they are always mounting the same way round on restart. To do this we will identify the drives via their UUID in /etc/fstab:
UUID=0AC4D607C4D5F543 /mount/location ntfs rw,defaults 0 0
To find the UUID of the drives:
blkid /dev/sda1
blkid /dev/sdb1
Remember that if you format a drive, the UUID will change.

Install the software

Time to install some useful software.

Samba shares specified parts of your filesystem on the network. It will allow you to mount the drive on another computer which will let you put files on your media server when it's ready. It is also the shared area that Sonos will be able to search for music files.

Minidlna shares an area of your filesystem via DLNA. This means a DLNA-ready device can locate the share and request any files in it. I use this for watching video on my iPad (my viewing program of choice being 8player).
# install samba
sudo apt-get install samba samba-common-bin

# install minidlna
sudo apt-get install minidlna
I also installed some extra tools to make other tasks easier. You don't need them for this build.
sudo apt-get install tree locate chkconfig

Configure samba

To configure samba you need to edit /etc/samba/smb.conf. You'll want something like this:
[global]
    netbios name = NETBIOS_NAME
    workgroup = WORKGROUP
    security = user
    encrypt passwords = yes
    smb passwd file = /etc/samba/smbpasswd

[media]
    comment = My media
    path = /PATH/TO/SHARE
    writeable = yes
    create mask = 0770
    force create mode = 0770
    locking = yes
Mixed to taste, of course.

Then add the user to the samba password file:
sudo smbpasswd -L -a USERNAME
Restart samba and you should then be able to mount the drive on other machines on the network.

Configure minidlna

The minidlna config file is found at /etc/minidlna.conf

Docs on configuring minidlna are available on the minidlna site. The important bits are:
media_dir=A,/home/user/Music      # Music directory
media_dir=P,/home/user/Pictures   # Pictures directory
media_dir=V,/home/user/Videos     # Video directory
friendly_name=Laptop              # Name of the share
db_dir=/var/cache/minidlna        # Index files (make sure location is writeable)
log_dir=/var/log                  # Log files (make sure location is writeable)
inotify=yes                       # Index new files as they are added
It's important to make sure the minidlna user can read and write to the index and log directories and read the media files. Alternately, if you're lazy like me you can make minidlna run as the main user by editing /etc/init.d/minidlna (around line 68). Obviously this is not recommended for any significant install of anything, but I'm assuming we're at home on a very limited access network.

When starting minidlna you may get an error message claiming to be exceeding the watch limit. To increase this limit, add to /etc/sysctl.d/90-inotify.conf
fs.inotify.max_user_watches = 100000
and restart.

Note that there is a new version of minidlna on the way called ReadyMedia possibly rendering this completely obsolete.

Back up the drives

I wanted to keep a backup of my media on the second drive. I could have used RAID 1 but reading around suggested that the amount of read/write information going across the USB bus would cause a bottleneck and therefore problems serving the files. To get around this, I use rsync to copy everything across on a nightly basis.

Something like this in the crontab will sync the drives each night at 3am:
0 3 * * * rsync /mountpoint/maindrive /mountpoint/backupdrive >> ~/rsync_log.txt 2>&1
And with this, the setup is complete.

Getting the media files in order

Sonos will read the ID3 tags on the music files so they need to correct. Due to the fun of an iTunes crash some time in the past mine are a mess so it's time for some scripting. More on this in a future post.

Saturday, 19 April 2014

On a list

Recent statistics from Steam say that approximately a third of owned games remain unplayed. I'm as bad as anyone with this - between sales, Humble Bundles and people sending me keys from THEIR bundles I've got a long list of the things I'm sure I'll get around to playing one day. Obviously, when someone says "Hey, Splinter Cell: Blacklist is on sale - why don't we pick it up?" there is only one response: why not?

I've got a splinter

I'm not a long-term fan of the Splinter Cell series. Slightly odd national-paranoia storyline and slow slide into mediocre FPS territory aside, I've never really gotten into the gameplay. This is probably my own fault as typically I've played the games around five years after release and they really haven't stood up to the ravages of time. It's not that I dislike the games - it's more that each time I've sat down to play one I've found better things to do with my time. This time, though, there was something different. Blacklist has co-op.

Just the two of us

Things are better with a friend and gaming is (usually) no exception. Assuming you have a friend to play with, co-op can be seen as a magic bullet that can improve any game. Of course if you have to find someone via a matchmaking system it can be the most irritating thing in the world.

Personally, I like to be able to play whatever the game has as a single player campaign in co-op mode. Blacklist goes down the cheap and annoying route of having a single player campaign with some bonus missions in which you can bring a friend. Normally this leaves co-op as a bolt-on to be enjoyed for half an hour before you move on to the inevitable multiplayer. Blacklist manages to avoid short-changing you by making the bonus missions roughly 75% of the game content and this means many happy hours yelling at your buddy for tripping alarms and forcing a restart of the entire mission. It really is a lot of fun and substantial - which is good, because it was the main reason I bought the game in the first place.

I'm told the side missions are divided into four types which will be recognisable to fans of the older games. I can't comment on how good these missions are at evoking the spirit of the older games, but I can say that they all play differently and are a good way of keeping the game fresh and interesting. There are the "normal" missions, with normal defined as being similar in playstyle to the single player game. Then there are the full-stealth missions where the whole thing is failed if anyone catches sight of you. These are great as the tension ramps up towards the end and you risk losing the last hour of game time to a mistimed run from cover to cover. Next up there are the violent missions in which your job is to murder everyone in an area - ideally without being seen - which are a pleasant change in pace to the uber-stealth missions. Finally there are the survival missions, in which you need to hold an area using guns and gadgets until you've worked through the waves of attackers then either bail or stick around for more mayhem.

I've not seen co-op implemented quite like this before. It's a fantastic idea, giving me the co-op experience I like while leaving the main campaign alone so the writers can tell the story they want to tell without being hamstrung by the constant requirement of a second protagonist.

All by myself

So yes, there's also a solo campaign. It seems to do a good job of continuing the existing story while not alienating newcomers to the series like me. I found it easy enough to get a feel for the established characters - not the most challenging thing, but they are more rounded than most of hardened military or espionage types you typically find in settings like this.

The plot deals with a massive terrorist operation on US soil. It's heavy on the argh-foreigners paranoia, but interestingly you'll spend much of your time crossing swords with other US intelligence agencies and doing some pretty dubious stuff to get around them. It's a little odd to see a turf war breaking out while tens of thousands of civilians are at risk but it's credible and it makes for some interesting caveats on some of the missions. Nothing says "be careful" like the game failing you the moment you cut down an unsuspecting friendly trooper with a hail of silenced machine gun fire because you were too ham-fisted to sneak across a compound without them seeing you.

I also appreciate the game letting me do these things myself. It's depressingly common that a game's story is told through non-interactive cutscenes or via quick time events (note - a non-interactive cutscene does not become gameplay just because I have to lunge for a random button on my keyboard 3 minutes in) but in Blacklist the game does not feel in the way of the film the writers want you to watch. You get short cutscenes before and after missions and everything else is told in-mission. Like the extra work which has gone into making the co-op mission structure, this makes a big difference to the game.

Except...

Oh yes, except the end (bit of a spoiler warning for some of the game's ending here).

I assume there must be a QTE guy somewhere involved in this project. Maybe they sent him out for coffee every day so he couldn't interfere. Maybe he was on holiday. Either way, they managed to distract him for most of the game's production. Then at the last minute he was allowed back in and the FINALLY BOSS is defeated by a series of bloody quick time events - and not just ordinary events either. They are obnoxiously difficult and cause you to restart the entire boss fight (the rest of which is oddly mechanical and doesn't really flow properly but at least is gameplay) when you inevitably mess them up because after 20-odd hours of a proper game you really aren't expecting them.

ARGH.

I don't normally have a problem with QTEs (passing them, that is, not appreciating them) but the only way I could get through these was to learn the sequence and anticipate which button to hit. Thanks guys. It certainly doesn't ruin the game, but it does have a good go at ruining the ending.

Always a system

Back to something positive. The upgrade system is extensive but because of the variance in the game types in the extra content most of what is on offer is actually useful. The problem I had with something like Dishonored is that it gave you a big pile of toys with which you could cause mayhem then slapped your hands if you actually used them. In this you get everything from knockout gas to land mines and then the game lets you get on with it. Obviously you can't use hand grenades in the stealth-only missions, but you can go nuts in the survival modes. The guns aren't quite as generous as the gadgets - the silenced weapons are definitely more useful in all modes - but you can still find a use for the assault rifles if you try.

The only exceptions are the breaching charges (I carried these through SO MANY MISSIONS because they sound cool and didn't manage to use one once) and the final goggles (which appear to be the same as the second to last goggle but with a stylish chinstrap). Bonus points are awarded for not ruining the upgrade system with the DLC kit. Although it is very good there are still normal unlocks which are better so there is still something to work towards.

All the people

There's also a competitive multiplayer mode. It's another interesting Ubisoft game, with unbalanced teams fighting very different battles, and works very well. I haven't found it compelling enough to play for hours but what I did play was a lot of fun.

And so

I like Blacklist. I'm genuinely surprised to be writing that. In fact, I like it a lot and I'm sad that I've now played through all the content. I'd like a little more co-op, but frankly I'm always going to say that and despite completing it I can see myself going back to play more of the survival games. I hope the sequel is structured in the same way - if I can get another fix of sneaky co-op fun then you can finally me to the list of people who are excited by this series.

Saturday, 12 April 2014

When drives don't mount nicely

While rebuilding my media sharing Raspberry Pi I've come across a small problem with usb drives. If you don't unmount a drive from a Windows machine properly, the Pi will mount it read-only. A simple solution for this is:
  1. install the ntfs-3g package:
    sudo apt-get install ntfs-3g
  2. mount the drive using this utility:
    sudo ntfs-3g /dev/sda1 media
    (to mount drive at sda1 to directory media) which clears up all the locks for you
  3. then simply umount and mount and things are back to normal

Saturday, 1 February 2014

A city in Crysis

Oh look – I’ve got a blog. Seems I managed to forget that for most of last year. New Year’s resolution: write more. Let’s see how that turns out.

Games!

Back in the old days this was a blog about video games. I played through and wrote about Crysis and Crysis: Warhead and made certain criticisms of the design decisions. In my post about Crysis I praised the game but said the narrative was a bit wonky, lurching from shooting Koreans to shooting aliens and in the process utterly changing the way the game played – and not for the better. They fixed that in Crysis: Warhead. I also said that the nanosuit, while being interesting was overly complicated and that they’d be better off losing some of the power modes and having them always-on.

Which brings us nicely to Crysis 2.

Suit me up

We’re back in the nanosuit – now apparently only being worn by one person in the entire gameworld – but with some of the power modes removed and those functions always-on. Sounds familiar. The new interface is far slicker than the old one which makes the gameplay faster and more fluid. The missing modes (Speed and Strength) are still around, but accessed via context-sensitive prompts (Strength) and just running quickly (Speed) which makes a lot more sense, even if you’re sometimes killed by enemies because being shot has drained your energy leaving you unable to run away properly. Still – it’s your fault. Plan properly next time.

Me suit up 

But you can’t just remove the useless element from an interface - you have to add new and exciting buttons to push to justify the “2”ness of the experience. So we have nightvision, which I don’t remember in the original games and not really worth the bother now. It is only of any use in one (very brief) section where the lights fail and a couple of occasions when the playing area is randomly filled with smoke. It just feels tacked on, which is a shame.

Then there is TacVisorThing. I struggle with TacVisorThing. I like game worlds and generally I feel it helps immersion to build logical gadgets then incorporate them into the gameplay rather than adding something cool and hoping the setting can swallow it. In the gameworld, the TacVisor makes sense. Basically, you bring down the “spotter” sights and the nanosuit analyses the battlefield and overlays tactical options to help you out. Generally they are quite obvious (marking high ground as suitable for "sniping" or the bit at the side suitable for "flanking") but it can point out weapon and ammo caches which would otherwise be easily missed. The problem is that all this really does is put a series of button presses between you and continuing the action when you enter one of the more open areas. It’s just busywork and I can’t help feeling that an automatic overlay would have been a nicer solution (prediction for Crysis 3! Which has been out for nearly a year!).

Oh, and there is an upgrade system too. More on that later.

Up me suit

So, we’re suited up. Time to get going. The gameplay drops Crysis’s vaguely open world for a series of corridors spilling out into arenas. It keeps things focused, but does lose any real sense of planning. You’re going in at A and coming out at B. All you can really decide is how to progress between those points. Oh – you’ve chosen stealth. Well, that means you can just walk from A to B and ignore the guys hanging around waiting to kill you.

Damn.

Yes, the Stealth option basically lets you bypass most of the enemies and without ever engaging them. And there really isn’t much encouraging you to fight – sure the human opposition are portrayed as a bunch of thuggish tools, but you’ve got places to be and pretty soon they are all busy being eaten by aliens anyway. The aliens on the other hand are big walking robot things with tentacles coming out of their heads (gone are the flying squid-things from the first game) who … you can also walk straight past. Sigh.

Actually, this feels like a step backwards from Crysis 1 where the enemies would hunt you down once you’d shown yourself. Now re-cloaking utterly confuses them. They don’t try shooting where you might be, or throw things to make you appear. You can just scurry off and murder anew from a new angle. The AI in general seems universally dense – they follow very obvious paths and just don’t seem to react to what you’re doing beyond “turn and shoot” instincts.

In an effort to stop you bypassing all the enemies in stealth mode there is an upgrade system which is powered from the corpses of the alien troops. There is some pseudo-science explaining this, but suffice to say that it means you’ll 1. spend a lot of time running like an idiot through the middle of firefights because you don’t want to lose the XP, rather ruining game flow (why can’t the pick-ups drift to you?) and 2. become next to invulnerable horribly quickly. Pro tip when upgrading – get level 1 of all 4 sections, then save for level 3 stealth and armour in that order. Everything else is largely worthless.

There are also token collectables which do little other than say YOU’RE PLAYING A COMPUTER GAME (why am I picking up tourist models of famous buildings, exactly?). It’s important to not forget those.

Tell me a tale

The plot? Yeah, there's one of those too.

Come on

Eugh. Well, there is some evil-PMC nonsense, an alien invasion, a sinister businessman pulling the strings behind the scenes and some of the noblest marines you’ll ever meet. The characters are largely uninteresting and to a man unlikable and most of the time you’re glad you’re on your own. The marines do provide a particularly hilarious sequence though – you’re told that the normal humans basically have no chance against the aliens and you need to escort them back to base. However, these normal humans turn out to be invulnerable (presumably to stop the escort quest making you hate all of humanity which is what normally happens – definitely a good decision) which means you can cheerfully use them as shields or just cower in a corner while they PUNCH THE ALIEN MECHA-SUITS TO DEATH. Do NOT mess with the US Marine Corps.

You’re still typing

That’s about it. It all functions, but it feels rather uninspired. It’s as if Crytek have built a great engine, hired the best artists on the planet (even seven years on it looks amazing, but then you already knew that), thought about the nanosuit and basically free-styled the actual game part. Not to say that it isn’t fun – I had an enjoyable 10 or so hours blasting through it, aside from a horrible end of game fight against cloaked aliens who had to die to unlock a door for … reasons – but it feels like a missed opportunity. There was the potential to do an open-world game in a semi-ruined cityscape here which changed as the war evolved. Who knows – maybe some of your actions could have helped that evolution along different paths. In that world the nanosuit could have come into its own, allowing you to customise the game to your preferred play-style via your use of powers and upgrades. Instead, we have a corridor shooter with some knobs on. A good corridor shooter, with some very pretty knobs but still – corridors and knobs.