Saturday, 4 July 2020

The Ranger's sword hilt

Aragorn of the Dunedain, as
portrayed by Viggo Mortensen
My blog posts are often somewhat geeky, but this one may just be the most bizarrely geeky ever.

Consider the Dungeons and Dragons character class, the Ranger. The class is (in my opinion) essentially based on Aragorn of the Dunedain from the Lord of the Rings. The ranger is an often solitary wanderer of wilderness areas, away from inhabited areas for weeks at a time. Therefore, everything which the Ranger carries must be strictly necessary; they will have to make compromises to keep their entire pack light enough to manage. The ranger is skilled at observation and tracking, but also at concealment and at moving quietly. Consequently, when faced with potential opponents they cannot beat, the ranger will probably remain in concealment and avoid conflict. The potential opponents in the wilderness are likely, in any case, also to be travelling light; the chances of meeting a heavily armoured opponent are slim.

The ranger must carry a bow, since a lot of their subsistence will come from hunting. They must be very skilled with it. When faced with an armed human (or anthropoform) enemy, the bow is likely to be the first and primary weapon, since if you can do  injury to your enemy before they are close enough to do injury to you, your chances in combat are that much better. However, when the distance closes sufficiently that melee weapons can be used, the bow ceases to be very useful, either for attack or defence. So a sword as a secondary weapon makes sense (an axe might make more sense, since it can do dual duty in gathering firewood, but the preponderance of swords over axes in medieval weaponry implies that, in a fight between a sword and an axe, the sword must generally have won; and it's clearly a more nimble weapon, so this is understandable). A quarterstaff - a fairly stout pole of hardwood a little longer than a man is tall - might make sense for reasons I'm going to come to later, but like any pole arm it's an awkward thing to carry (although it could do double duty as a walking stick). In any case, I'm going to assume my ranger carries a sword.

A shield is a large, awkward, clumsy thing, as well as probably quite heavy. It cannot readily do double duty as anything else. I'm going to assume my ranger does not carry a shield. A buckler is possible but in the moment of throwing aside the bow and equipping melee weapons, it's one more thing you would have to be carrying and would have to equip; so I'm going to guess that my ranger doesn't carry a buckler, either. That means that, in melee combat, the ranger has both hands free to handle weapons.

Two styles of fighting are possible. One is sword and dagger, in the renaissance Italian style, where the sword is something probably approaching a rapier. But the rapier is not a versatile sword: it is primarily a thrusting weapon. It could not be used for cutting firewood, or opening a path through a thorn thicket. The other is a cut and thrust sword.

Our ranger is necessarily lightly armoured, since lugging heavy armour through the wilderness for at best very occasional use doesn't make sense, and it's noisy and takes a lot of maintenance, and you almost certainly wouldn't be wearing it on the very rare occasions when you needed it. If you're not armoured, then you don't want your enemy to get close enough to make effective use of their weapons, so you want as much reach as you can achieve (sorry, Arya Stark, that Needle won't help you much - and this is also where the quarter staff might make sense). So a longsword, or at least a 'bastard', hand and a half style sword, is the most appropriate sword. It has greater reach and, wielded with two hands, can land a more powerful blow than a single handed sword. In keeping with this argument, Aragorn's sword, Anduril, is a longsword. However, for the ranger in the wilderness, the slightly shorter bastard sword may be a better compromise, given that it is a (hopefully) infrequently used secondary weapon.

OK, so that solves the problem, nothing more to think about.

No?

Well, no, I don't think so. Because our ranger's primary weapon is the bow, and, when an enemy closes to melee range, the change from bow to melee weapon has to be quite swift. Medieval swords from Christian Europe generally had straight crossguards, which offer little or no protection for the hand against a thrust. I suspect part of the reason was that the sword with the perfectly straight crossguard at right angles to the blade made an extemporary Christian symbol - could be used as a portable temporary altar for a quick pre-combat prayer - was part of the reason for this very simple design, but another reason is that the sword was expected to be used with gauntlets.

The quillons - arms - of the guard are there to prevent your opponent's blade sliding up yours and either cutting into your hand, or, if deflected from the hand, entering another part of your body. Therefore it makes sense in a non-Christian culture to have quillons at least somewhat angled or curved towards the opponent, and, unsurprisingly, the quillons of many Islamic swords of the period are made precisely like this - but that's an aside.

The main point I want to make here is that an archer cannot wear gauntlets - certainly not on the hand used to draw the string, typically the user's dominant hand, which will typically be the hand closest to the enemy on the haft of the sword. So the classic medieval two handed sword with its simple cross guard leaves our ranger's dominant hand unprotected in a vulnerable position. This is precisely why small swords - gentlemens' dress swords, used on social occasions when armour wouldn't normally be worn - have much more elaborate hilts from the late medieval period; and why, by the time firearms had become the primary weapon of most soldiers, all swords had more elaborate hilts. The protection had migrated from the hand to the weapon.

Reproduction Swiss-style
hand-and-a-half sabre with simple
basket hilt.
So the guard needs to be extended at least to some degree. A basket hilted two handed sword is possible - examples (mainly from the sixteenth century) exist in both Switzerland and Germany, both with a basket protecting only the primary hand, and with a basket extending the full length of the hilt; and many of these, also, have finger guards. A basket hilt, of course, offers only limited protection against thrusts towards the hands; examples with shell guards also exist from Holland and Scotland, again around the sixteenth century, with the Dutch example having both a shell and a basket. Another interesting hilt design which might be considered is the 'Sinclair hilt', a (probably) Scottish design comprising a simple basket with a finger bar in the plane of the quillons and blade, with a plate metal loop at right angles to the quillons protecting the back of the hand.

Reproduction Sinclair hilt
More protection on the hilt necessarily makes a sword heavier, all other things being equal. Obviously, it adds the extra weight to the hilt, bringing the point of balance of the sword back towards the hand and reducing its angular inertia in cutting; it tends to orient the blade more towards thrusting than towards cutting. And a symmetrical basket hilt is said to be awkward to wear, because part of it necessarily projects in towards the torso when worn on a belt. However, if the basket is to cover both hands it must be to an extent symmetrical, at least sufficiently to be awkward in this way. So I think what we're looking at something between a Swiss hand-and-a-half sabre hilt, and bastard sword with a Sinclair hilt protecting only the primary hand, but the haft and pommel extending beyond the basket to allow grip by the other hand. Of the two, the Swiss sabre style would be lighter; the Sinclair style would offer more protection. My instinct is that the ranger would prefer the Swiss style, both for lighter weight and for better cutting.

It's worth noting here that once a basket hilt has evolved, one edge is always the primary edge of the blade, and most swords then quite quickly evolve towards single edged and subsequently curved; but straight double edged swords with basket hilts were in use in Scotland for at least three hundred years, and aesthetically (knowing very little about practical sword fighting) I prefer the look of a straight symmetrical blade.

Having said all this: in a fantasy environment we are not limited by what has been used historically. However, one thing we know about historical designs which were in use for a significant period is that they work and are practical.

So my ranger will carry a straight, double edged hand-and-a-half bastard sword, with an asymmetric half-basket hilt derived from the Swiss sabre illustrated above.


Tuesday, 23 June 2020

Pathmaking

NOTE: this essay is called 'pathmaking', not 'pathfinding', because 'pathfinding' has a very specific meaning/usage in game design which is only part of what I want to talk about here.
Visualisation of the port at Tchahua

Stages in creating routes between locations

The 'procedural' phase

see also Baking-the-world.

Towards the end of the procedural phase of the build process, every agent within the game world must move through the complete range of their needs-driven repertoire. Merchants must traverse their trading routes; soldiers must patrol routes within their employers domain; primary producers and craftspeople must visit the craftspeople who supply them; every character must visit their local inn, and must move daily between their dwelling and their workplace if different; and so on. They must do this over a considerable period - say 365 simulated days.

At the start of the procedural phase, routes - roads, tracks and paths - designed by the game designers already exist.

The algorithmic part of choosing a route is the same during this procedural phase as in actual game play except that during the procedural phase the route-map is being dynamically updated, creating a new path or augmenting an existing path wherever any agent goes.

Thus the 'weight' of any section of route is a function of the total number of times that route segment has been traversed by an agent during this procedural phase. At the end of the procedural phase, routes travelled more than R times are rendered as roads, T times as tracks, and P times as footpaths, where R, T and P are all chosen by the game designer but generally R > T > P.

Algorithmic rules

  1. No route may pass through any part of a reserved holding, except the holding which is its origin, if any, and the holding which is its destination (and in any case we won't render paths or roads within holdings, although traversal information may be used to determine whether a holding, or part of it, is paved/cobbled;
  2. No route may pass through any building, with the exception of a city gate;
  3. We don't have bicycles: going uphill costs work, and you don't get that cost back on the down hill. Indeed, downhills are at least as expensive to traverse as flat ground;
  4. Any existing route segment costs only a third as much to traverse as open ground having the same gradient;
  5. A more used route costs less to traverse than a less used route.

River crossings

Crossing rivers is expensive - say five times as expensive as level open ground (but this will probably need tuning). Where a river is shallow enough, (i.e. where the amount of water passing is below some threshold) then a path crossing will be rendered as stepping stones and a track crossing as a ford. Where it's deeper than that, a path crossing either isn't rendered at all or is rendered as a light footbridge. A track or road crossing is rendered as a bridge. However, the maximum length of a bridge varies with the amount of traffic on the route segment, and if the crossing exceeds that length then a ferry is used. Road bridges will be more substantial than track bridges, for example in a biome with both timber and stone available road bridges might be rendered as stone bridges while track bridges were rendered as timber. If the watercourse is marked as `navigable`, the bridge must have a lifting section. It is assumed here that bridges are genetic buildings like most other in-game buildings, and so don't need to be individually designed.

Representation

At some stage in the future I'll have actual game models to work with and $DEITY knows what the representation of those will be like, but to get this started I need two inputs: a heightmap, from which gradients can be derived, and a route map. The heightmap can conventionally be a monochrome raster image, and that's easy. The route map needs to be a vector representation, and SVG will be as convenient as any. So from the point of view of routing during the procedural phase, a route map shall be an SVG with the following classes:
  • `exclusion` used on polygons representing e.g. buildings, or impassable terrain which may not be traversed at all;
  • `openwater` used on polygons representing oceans and lakes, which may be traversed only by boat (or possibly swimming, for limited distances);
  • `watercourse` used on paths representing rivers or streams, with some additional attribute giving rate of flow;
  • `navigable` may be an additional class on a path also marked `watercourse` indicating that it is navigable by cargo vessels;
  • `route` used on paths representing a path, track or road whose final representation will be dynamically assigned at the end of the procedural phase, with some additional attribute giving total traversals to date;
  • `path` used on paths representing a path designed by the designers, which will certainly be rendered as a path no matter how frequently it is traversed;
  • `track` used on paths representing a track designed by the designers, which will certainly be rendered as a track no matter how frequently it is traversed;
  • `road` used on paths representing a road designed by the designers, which will certainly be rendered as a road no matter how (in)frequently it is traversed.
At the end of the process the routing engine should be able to write out an updated SVG. New routes should be splined curves, so that they have natural bends not sharp angles.

The 'Walkmap'

Conventional game pathfinding practice is to divide the traversable area into a mesh of 'convex polygons', where a 'convex polygon' in this sense is, essentially, a polygon having no bays. Routes traverse from a starting point to the centre of a polygon ajacent to the polygon in which the starting point is located. I have reservations as to whether this will do what I need since I'm not convinced it will produce naturalistic paths; however, it's worth at least experimenting with.

There are existing utilities (such as hmm) which convert heightmaps into suitable geometry files; however all I've found so far convert to binary STL. This isn't a format I find very useful; I'd prefer an XML dialect, and SVG is good enough for me.

hmm converts the heightmap into a tesselation of triangles, which are necessarily convex in the sense given above. Utilities (such as binary-stl-toASCII) exist to convert binary STL to an ASCII encoded equivalent, which may be easier to parse.

So the pipeline seems to be
  1. heightmap to binary STL
  2. (optional) binary STL to ASCII STL
  3. STL to SVG (where 'SVG' here is shorthand for a convenient vector format)
  4. Exclude holdings, buildings, open water, and other exclusions
  5. Where we have excluded exclusions, ensure that any non-convex polygons we've created are divided into new convex polygons.
I shall have to write custom code for 4 and 5 above, and, looking at what's available, probably 3 as well.

I'm working on a separate library, walkmap, which will attempt to implement this pipeline.

Pathmaking and scale

Dealing with large heightmaps - doing anything at all with them - is extremely compute intensive. We cannot effectively do routing at metre scale - which is what we ultimately need in settlements - across the entire thousand kilometre square map in one pass. But also we don't need to because much of the continent is by design relatively unpeopled and relatively untracked. The basic concept of the Steppe is that there are two north/south routes, the one over the Midnight Pass into the Great Place and the one via Hans'hua down to the Cities of the Coast, and those can be part of the 'designed roads' map. So we can basically exclude most of the Steppe from routing altogether. We can also - for equally obvious reasons exclude the ocean. The ocean makes up roughly half of the 1000x1000 kilometre map, the steppe and plateau take up half of what's left, mountain massifs eat into the remainder and my feeling is that much of the eastern part of the continent is probably too arid to be settled. So we probably end up only having to dynamically route about 20% of the entire map.

However, this doesn't get round the main problem with scale, and pathmaking. If we pathmake at kilometre scale, then curves will be necessarily very long and sweeping - because each path segment will be at least a kilometre long. And, actually, that's fine for very long distance roads in unpopulated fairly flat territory. It's not so good for long distance roads in rugged terrain, but...

Phase one: hand-designed routes

While, given the bottlenecks of the few mountain passes and the one possible pass over the plateau, the caravan routes we want would almost certainly emerge organically out of dynamic routing. But, actually, I know more or less where they need to be and it's probably easiest to hand design them. It will certainly save an enormous amount of brute-force compute time.

I think I have to accept that if I want Alpe d'Huez-style switchbacks up the Sunset and Midnight passes, they're going to have to be hand designed. The same applies to where the Hans'hua caravan road ascends the plateau.

Phase two: route segments 'for free' out of settlement activity

If we start by pathmaking around settlements, we can make a first start by giving the template for a holding a segment of track parallel to and just in front of its frontage, and a segment of path along its left hand and rear edges. That, actually, is going to provide 90% of all routing within a settlement, and it's done for us within the Settling phase.

Phase three: metre scale routing around settlements

So if we then collect groups of contiguous 100x100 metre zones each of which has at least one settled holding, we can route at one metre scale over that and what it will essentially do is join up and augment the route segments generated by settlement. Areas of dense settlement do not make up a great deal of the map. Note that experience may show that the metre scale routing is superflous.

Phases four, five and six: increasing granularity

Taking the augmented route map comprised of

1. The hand-designed, mainly long distance or plot-important routes;
2. The route segments bordering holdings;
3. The metre scale routing

we can then collect contiguous groups of zones each having at least one holding, where in phase four each zone is a kilometre square and divided into 100x100 grid so that we route at ten metre scale; in phase five we use ten kilometre by ten kilometre zones and we route at 100 metre scale; in phase six, 100 km by 100 km zones and we route at kilometre scale. Each of these phases, of course, starts with a routemap augmented by the phase before.

This process should automatically link up all settlements on the south and west coasts, all those on the north coast, and all in the Great Place; and seeing that the posited pre-designed caravan roads already join the south coast to the north, the north to the Great Place and the Great Place to the south coast, we're done.

At least one of phases three, four, five and six is probably redundant; but without trying I'm not sure which.

Tidying up

After the full set of increasing-scale passes is complete, we should automatically cull any route segments generated in the settlement phase which have never actually been traversed.

Following that, there may be scope for some final manual tweaking, if desired; I think this is most likely to happen where roads routed at kilometre scale cross rugged terrain.

Monday, 22 June 2020

The car is dead. Long live the...?

My car
My car is probably - not certainly, there is still one test to do - dead, or at least beyond economic repair. All that is wrong is a mystery fault in the electronic control system - the chassis, engine, transmission and most of the bodywork are all sound - but, even if we had a certain diagnosis, it's likely that the cost of replacement parts would be unaffordable. 

It's a wrench. I really, really like that car. It is undoubtedly the most enjoyable car I've ever owned, and I have hugely enjoyed owning it. But it also leaves me faced with a very difficult decision: whether to aim to replace the car with another car, or with an electic assist cargo bike.

If I was as good a human being as I like to play on Twitter, this would be a no brainer. We cannot afford to be burning fossil fuel for personal transport, but also, equally, we cannot afford to be burning fossil fuel to build new 1.5 ton personal transport vehicles for everyone, whether or not they're electric. In any case, I cannot afford the capital cost of an electric car, and I struggle to afford the running cost of a fossil fuel car - it's more than a third of my total income. So the only car I could conceivably afford would be another elderly fossil fuel car.

The capital cost of an electric assist cargo bike would of course be more than the capital cost of an elderly car, but it would pay that cost back in reduced running costs over at most three years. What it wouldn't have is weather protection, or passenger carrying capacity.

Today, one day after the summer solstice, I had a dental appointment in Castle Douglas, ten miles away. It was raining steadily, and the wind was gusting to 45 mph (72 kmh). Cycling would have been very unpleasant, even with electric assist. High winds and heavy rain are not at all unusual here - not so common at this time of year, but very common in winter.

Fortunately, today, I was able to borrow a friend's car. Friends have also offered to help me buy a car. I have good friends, and I'm grateful to them, but I don't want to be someone who lives off charity.

I suffer from depression, and that isn't going to change. Life, for me, in winter, is quite hard anyway. If I make it too hard, it will not be worth continuing. There are folk - who I care about - who will be hurt when I choose to die, and so, although that is how I hope I'll eventually go, I'd like to put it off as long as reasonably possible. Making my life tolerable is thus a duty which, to some extent, I have to others. Yes, that sounds self-serving - to an extent it feels self-serving - but it's also true.

If there were a car club or similar scheme in the village it would solve my dilemma - I rarely need a car more than one day a week - but there isn't and it would take at least months of work and a lot of effort to set one up, and I don't feel I have that energy.

Altogether this is a problem I really wish I didn't have to face just now.

Sunday, 26 April 2020

The virus, and independence

Nicola Sturgeon, giving a briefing on coronavirus
At least 750 - other people online have estimated more - folk in Scotland have died from COVID19 who would not have died if they had lived in any of our northern European neighbours of the same size.

In Denmark, there have been, as of 20th April, 61 deaths per million people. In Estonia, 30. The Faroe Islands, none at all. Finland, 16. Iceland, 26. Ireland, 123. Latvia, only 2. Lithuania, 13. And Norway, 28.

But Scotland has done worse, far worse. We've lost 166 people for every million.

That's the open and shut case for independence right there, isn't it?

If we had been independent, we could have saved 750 people who are now dead - and remember, we're less than half-way through this crisis. There are at least another 750 people living in Scotland today who will die unnecessarily unless we change course.

This is true.

But the key word in that sentence is 'could': because if we had been independent under this SNP government, we would not have lost any fewer. Every aspect of health policy and transport policy is devolved. The UK government's policy on coronavirus has obviously been slapdash, chaotic, incompetent and irresponsible, and that was already obvious as far back as January. But nothing in law required the Scottish government to follow that policy.

It's possible, as some SNP defenders have suggested, that the UK government have put severe pressure on the Scottish government to follow its lead; but if so the Scottish government needs to say so and to document it. It seems to me far more likely, given what we know of Nicola Sturgeon, that the choice has not been a consequence of pressure but of calculation. Sturgeon is risk averse, and inclined to delay big decisions. She will (rightly) have felt that if Scotland had fared even slightly worse through the crisis, it would be seen as an argument against independence. If this is what she thought, she was right, of course. By closely following UK policy, by making slight tweaks at the margin of it, she ensured that Scotland's outcome was at worst very similar to the UK's. But also, at best very similar.

There's a very strong smell here of "when you go out stay close to nurse, for fear of meeting something worse" - and that isn't a good argument for independence at all.

So what could Scotland have done differently?

We could have implemented track, trace and isolate from day one, and maintained it. Across the world, countries which have implemented track, trace and isolate have done far better than those that haven't. The scandal here is that the UK did track and trace the first few cases, and then abandoned the policy; and Scotland hasn't done it at all.

We could have required face covering in public places. Of course masks don't stop infection, but they do greatly reduce the spread of virus particles. It doesn't have to be a surgical mask. A scarf would do almost as well. And again, countries which have required face coverings have done far better.

We could have quarantined all arrivals for fourteen days. The Public Health etc. (Scotland) Act 2008, section 40, gives us this power. It would be clumsy: if an arriving passenger refused to be quarantined, it would require for a sheriff to make an individual order for that person. There's no provision for a class or general order. Thousands of people arrive in Scotland every day, and if they all refused to be quarantined we would not have enough sheriffs to issue the orders. But, again, we have passed emergency legislation for COVID19; it would have been easy to add a clause temporarily adding a general quarantine order.

We could have quarantined arrivals. There are plenty of hotels standing empty which could have been taken over as temporary quarantine centres. We chose not to.

Much of Scotland's imports, including of crucial things like food, arrive on trucks coming up from England, mainly by the M74. But we could have instituted a system of routing off arriving vehicles at Gretna into the parking area at the 'Outlet Village'. Articulated truck tractor units could be swapped over there, so that some tractor units (and their drivers) remained in Scotland, shuttling trailers to their destinations and back to Gretna, while those drivers arriving from the south remained in accommodation in Gretna until their trailer was returned, or went back to fetch another load from England to swap trailers at the border again.

All this would be complicated, it would be a nuisance, folk would complain; but it could be done.

This is made more complicated by the fact that there isn't, yet, a rapid, reliable test for coronavirus. In fact it's worse than that: the UK test, as OpenDemocracy revealed on Tuesday, is very unreliable indeed: it misses 25% of all cases. Of course, Scotland didn't have to use the UK test. There are commercially available tests from pharmaceutical firms such as Hoffmann-La Roche and Abbott Laboratories which are more reliable. We could - if we had acted early - have bought these. We didn't, and they're now in critically short supply.

Because we don't have effective tests, We would have to quarantine every single arriving person. We would have had to swap tractor units, or at least change drivers, of every single arriving load (and, frankly, since the virus remains viable on surfaces like, for example, steering wheels, for some time, just changing drivers without a pretty effective clean of the cab at the border doesn't seem to me adequate). Folk who commute across the border - there are quite a few - would just have to pick a side for the duration. It would be complicated. It would annoy folk. It would be expensive.

Well, yes it would. But what we're doing is expensive. Emergency medicine is expensive. The Louisa Jordan hospital is expensive. If we had far fewer cases, we wouldn't need the Louisa Jordan. We wouldn't be overburdening our hospitals. Spending money at the border and at airports, on quarantine, on changeover of tractor units; spending money on track, trace and isolate; spending money on better testing facilities - all these things would save money in hospitals. More importantly, it would save lives.

What's your old dad's life worth? Is it worth a thousand pounds? If it is, a politician could say, oh, well, we're only going to lose a few thousand people, that's a few million pounds, let it rip. That's what Boris Johnson and Dominic Cummings wanted to say. If you see people's lives as fungible, as of essentially monetary value, then even if you priced lives at a million pounds each, there would be an economic case for letting the disease rip. But is that how we want our governments to value our lives? Is that something we want to see the government of Scotland do?

I'd argue that it is not.

Folk are saying that we don't have our own currency, we can't print money, we can't even borrow. All that is true. But what the UK is doing is also enormously expensive. Under the Barnett Formula, we're entitled to a pro-rata share of everything they spend. Taking a different tack on coronavirus would not make Kate Forbes already demanding job any easier, but it's the job of politicians to make tough decisions, to rise to the occasion in a crisis.

The Scottish government just isn't doing this. It has all the powers, and has choesn not to use them. It is true that the UK strategy has been complacent and irresponsible, and that the UK's delivery of that policy has been chaotic and incompetent. But what we have in Scotland is a competent, orderly implementation of Boris Johnson and Dominic Cummings complacent, irresponsible policy, and there is no-one outside Scotland who can be blamed for that.

Growing up as a nation is about owning up when you get it wrong. Growing up as a nation is about not blaming others for your failings. Growing up as a nation is about learning to take your own risks, your own hard choices, your own responsibility for your own actions; and right at this moment, Scotland is failing to do any of this.

Over the course of this crisis, at least 1500 Scots will die in Scotland who would not have died if we had followed the policies of any of our similar-sized northern European neighbours. Is that an argument for independence? You bet it is. But they will have died not because of the UK government's failings, not because of its complacency and irresponsibility, but because of our own.

We need to own this. And, we need to lay the blame squarely on the government and on the ministers who made these choices. Is that an argument for voting for the SNP in its current form next year? Not without a dramatic change of direction.


Saturday, 28 March 2020

QGIS on Ubuntu 18.04

QGIS didn't work for me out of the box. Here's notes on what I had to do to get it going. Brief summary, out of the box the Open Street Map URL is missing. See 'Breakthrough' below for how to fix this. However, also, the version of qgis available from the Ubuntu package repository is at present quite out of date; alternative repositories are available but as yet I haven't tried them.

Firstly, if it isn't working and you've been tinkering to try to get it working, start by purging it completely:

sudo dpkg --purge qgis qgis-provider-grass qgis-plugin-grass
rm -rf ~/.qgis2/

Then reinstall it with all the extra bits that it actually needs - when I originally installed it, it did not automatically install saga, and I'm not sure whether it automatically installed the grass plugin.

sudo apt install python-qgis qgis-plugin-grass saga

This at the time of writing installs QGIS version 2.18.17.




Then start QGIS

qgis

QGIS, immediately on starting.
At this point the application window renders. I get one python warning in the 'Log Messages Panel':
2020-03-28T08:08:03 1 warning:/usr/lib/python2.7/dist-packages/qgis/utils.py:258: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
cp.readfp(f)

Because it's only a deprecation warning, I'm inclined to think this is not a significant issue.

I also get the following warnings in the console. Once again, they're only warnings:

Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_GB]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_GB]
Warning: Object::connect: No such signal QgsMergedBookmarksTableModel::&QgsMergedBookmarksTableModel::selectItem( const QModelIndex &index )
Warning: Object::connect: (receiver name: 'QgsBookmarksBase')
Warning: QCss::Parser - Failed to load file "/style.qss"
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
Warning: QFileSystemWatcher: failed to add paths: /home/simon/.qgis2//project_templates
Warning: QLayout: Attempting to add QLayout "" to QgsPanelWidgetStack "mWidgetStack", which already has a layout

I select, from the menus, Project -> New; the 'Recent Projects' heading disappears from the main pane, and it appears to be a map pane - but there's no map.

I type 'world' into the 'Coordinate' input and hit return, as directed by this tutorial, and still, no map. Comparing my screen to the screen shown in the tutorial, they are identical except that 
  1. No map is displayed, and
  2. Some icons in the second toolbar from the top which are coloured in the tutorial are greyed on my screen.
I take this to mean that not only can I not see the map, QGIS doesn't think there is a map from which I can make selections.

If I try to drag the 'osmraster' item from the 'Browser Panel' into the map area, I get a series of errors in the 'Log Messages Panel' of the general form:
2020-03-28T08:37:53 1 Tile request max retry error. Failed 3 requests for tile 11 of tileRequest 2 (url: https:/2/2/2.png)

Clearly, the URL is malformed. Clearly, there is something wrong with the template string from which the URL is being formed.

At this point I tried using the 'Getting Started' instructions from the manual. Once I had downloaded the sample data, I was able, following instructions, to get raster data to show on the map pane. Vector data, however, for example from the 'lakes.gml' file in the sample data, still did not render at all.

This made me suspicious of the error seen earlier in the console,

Warning: QCss::Parser - Failed to load file "/style.qss"

If the default style is white on white, then perhaps QGIS has been rendering a map, but rendering it invisibly. I find that there are indeed two files with this name in my file system:

simon@mason:~/qgis$ locate style.qss
/home/simon/.qgis2/themes/Night Mapping/style.qss
/home/simon/simon/.qgis2/themes/Night Mapping/style.qss
/usr/share/qgis/resources/themes/Night Mapping/style.qss

However, I can't find any way of selecting a stylesheet in any of the menus (there's a 'Style Manager' dialogue, available from the 'Project Properties' dialogue and from the 'Settings' menu, but it does not mention stylesheets and does not appear to allow you to set one. There's no reference to 'style.qss' in any file in my .qgis2 directory; nor is there any reference to it, or to a stylesheet at all, in a saved project file.

I experimentally copied one of these style.qss files into the root directory of my filesystem, and restarted QGIS. This time, the file was found, but its only effect was to render many dialogues unreadable; it did not change the blankness of the default map panel. Further browsing showed that a QSS stylesheet is a stylesheet used by the Qt tookit (which QGIS is built on), not used by QGIS itself, and, as the default styles render QGIS perfectly acceptably, this file is not needed and is not the problem.

At this point I noticed what looked like specks of dirt on the screen. I zoomed in and found a group of vector shapes which could well be lakes - but they didn't AT ALL align with the sample raster data. I checked the coordinate systems used and found that they were different. I changed the coordinate system for the lakes data to that used for the raster data, and they overlaid precisely. Progress!

The breakthrough

So I went back to trying to find why the Open Street Map data was not loading. I right clicked on 'Tile Server (XYZ)' in the 'Browser Panel' and got a dialogue asking for a URL. I entered 'https://c.tile.openstreetmap.org/{z}/{x}/{y}.png', chosen from an existing leaflet project, and was shown another dialogue asking for a name for the layer. I entered 'TestOSM'.

A 'TestOSM' entry appeared in the 'Browser Panel', and when I dragged this to the map pane, suddenly I had a map.

Epilogue

 
My takeaway from this catalogue of problems is that the QGIS package offered by Ubuntu is 
  1. Misconfigured, and
  2. Obsolete
I did get it working, and I've documented what I needed to do above; but it's clearly some way behind the current 'stable release', which is 3.10.4.

So I've spent a whole morning trying to install a more up-to-date version of QGIS. There are many repositories for more recent versions of QGIS out there on the Web, and many 'howto' articles explaining how to set them up and use them. I've tried many this morning, and my conclusion is that they're all, without exception, broken in one way or another. Some people do seem to have succeeded in getting a working install, but even their notes don't work. 
Furthermore, after doing that, it took an awful lot of work to sort out the mess and get back to a working 2.18.7. In summary, I believe it can be done, but it's not for the faint hearted.

Thursday, 27 February 2020

Putting data on the map

A couple of weeks ago, someone came to me with a problem. She had data in a spreadsheet. She wanted to display it as a map, on a website. And she wanted to be able to do that dynamically - that is to say, she wanted the map on the website to update as the spreadsheet changed.

So there were clear routes to several of the parts of this problem:

1. If you need maps on a web page, you need Leaflet - it's a simply wonderful library;
2. If you want a spreadsheet that is live on the Internet, Google Sheets are a very good way to go;
3. Google Sheets allows export as Comma-Separated Values, and CSV is a very easy format to parse.

I needed to do this quickly, so I started in my comfort zone, using Dmitri Sotnikov's Luminus framework and mixing in the Day8 re-frame framework, in order to have a lot of built-in functionality client side. The joy of the Clojure development tools is that getting a working system is as easy as typing

    lein new luminus geocsv +re-frame

And from that point on you can do your development with your system live, and can see the effects of every change you make immediately.

So within a couple of days I had a polished wee system which looked good and pulled live data from a Google Sheets spreadsheet to populate a map, with different graphical pins for her different classes of records. It was highly reusable, since you can specify the document id of any public Google sheet in the query part of the URL, and that sheet will be rendered. The map automatically pans and zooms to focus on the data provided. Was I pleased? Well, sort of.

Why was I not pleased? The deliverable component is an executable jar file, and it's 58 megabytes; in the browser, client-side, a page consumes 10 megabytes of memory. That seems huge for such a simple piece of functionality. I'd satisfied the requirement, but I hadn't satisfied myself. Also, of course, it needed you to be able to run a component on your web server, and many organisations with simple web hosting can't do that.

Doing it again, better

So I started again. This time I did it entirely client-side, just ClojureScript, with no heavyweight libraries. Having solved the problem once, it was pretty easy to do it again, and within a day I had a system working. Furthermore, I added flexibility: you can supply a URL, as before; or as the text of the document element that the map overlays; or passed as a string to the function. You can see it here.

Was I pleased?

No.

Three things about this solution don't satisfy me.

Firstly, the deliverable (jar archive, for direct comparison with the original) is still 2.9 megabytes. That's only 5% of the size of the original, and includes the whole of Leaflet, the whole of [Papaparse](https://www.papaparse.com/) - a client side CSV parser, and 398 different map pin images, but it still seems big. Page load - with the three maps on the demo page - costs around 5 megabytes in the browser.

Secondly, because it's client-side only, it cannot know what pin images are available on the server; so if there is a category value in the data for which no pin image is available on the server, you will get a 'broken image' appearing on the map, which is ugly.

Thirdly and most significantly, again because it's client side only, modern cross-site scripting protections mean that it cannot pull data from a spreadsheet hosted on another site - so it doesn't strictly meet the original requirement.

Iterating again

I decided to look at whether I could make it smaller by abandoning the comfort of the Clojure environment and writing pure JavaScript. This led to a third iteration, geocsv-js, which you can see in action here. The amount of 'my code' in this version is far lighter - the output of the ClojureScript compiler for geocsv-lite comes to 6.6 megabytes uncompressed, whereas the pure JavaScript version is one file of just 8.8 kilobytes in 296 source lines of code (for comparison, the ClojureScript solution, geocsv-lite, comes to 372 source lines of code). One reason for the slightly larger size of the ClojureScript solution is that it has a better algorithm for panning and zooming the map to display the data actually entered, which I didn't port to JavaScript.

But what is bizarre and I do not yet understand is that the deliverable is not smaller but bigger than the geocsv-lite deliverable, by almost twice - 4.7 megabytes - despite using identically the same libraries. Still more surprising, the memory consumption in the browser is also higher, at around 6 megabytes.

What are the lessons learned? Well, the overhead of using ClojureScript is not nearly as much as I thought it was. There is something clearly wrong about the discrepancy between the size of the packaged deliverables - the pure JavaScript variant must be including third party data which the ClojureScript variant doesn't, although I haven't yet tracked down what this is - but the in-browser memory footprint is actually smaller, and the page load time is, as best as I can measure, identical at about five seconds.

Was I satisfied now? Well, sort of.

Merits and demerits

All three variants have merits. The first pulls the data directly from Google Sheets, which was the original requirement, and served a default pin image for any record category for which it didn't have a matching image. That made it a lot slicker to use, and more forgiving of user error. The two client-side-only variants cannot do those things, for reasons which I have not found ways to solve. But they don't need any server-side functionality beyond the dumb serving of files, so they're much easier to deploy; they are also less greedy of client side resources.

One more time with feeling

One of the reasons why I kept on hammering at this problem was that I felt it would make a really useful extension for my wiki engine, Smeagol. I've integrated the JavaScript version, geocsv-js, and in doing that I've solved a number of problems. Firstly, the look and feel and content of Smeagol pages is flexible and easily configurable by the user, so it doesn't take a geek to set up a page with the content you want and a map of the data you want to show. Secondly, the Smeagol engine, because it sits server side, can pull data from remote sites, and because it doesn't interpret that data, there's no significant risk in doing that. Thirdly, again because it sits server side, it can deal with the issue of unknown images - and, because it's a wiki engine targeting less technical users, I've deliberately made it very graceful about how it does this.

So now, instead of just a map on a web page, you get a whole, richly editable website, with existing extensions to integrate sophisticated data visualisation and photograph galleries as well as maps. And the cost of this? Surprisingly little more. A Smeagol page with one map uses exactly the same memory on the client as a geocsv-js page with one map, because Smeagol now only loads JavaScript for extensions actually being used in the page, and almost all of its own functionality runs server side. But even server side, the cost is not very much greater than for the full fat geocsv implementation - the deliverable jar file, which offers far more functionality than geocsv, is only 88 megabytes. Considering how much more usability and flexibility this offers, this is the version of geocsv I'd now offer, if someone came to me with the same problem.

Wednesday, 25 December 2019

World enough, and Time

Orrery of the Long Now clock
Last night I listened to an episode of the Politics Galore podcast which utterly depressed me: not because the content was depressing (although it was), but because the analysis was so shallow. It analysed Scotland's current dilemma solely in terms of the Westminster political game played by Westminster's first past the post rules. It suggested that the next independence referendum could be, and tactically should be, delayed until the late 2020s, as though nothing in the world would change in the meantime.

Human beings are programmed to believe that nothing much in the world, on a macro scale, will change very much from one year to the next. We call this inductive reasoning, and over the past million years it's served us pretty well. On the whole, tomorrow has been more or less like yesterday; on the whole, next year has been more or less like last. And for most of that time, what lay over the horizon was literally unknowable: oncoming crises, no matter how inevitable, could not be predicted or prepared for.

This is no longer the case. Multiple interlocking crises — the changing climate, the mass extinction of species, the concentration of wealth and power — are changing the world rapidly. We can now see over the horizon; we do now have the tools.

Consequently, you can't now discuss Scotland's politics in isolation from our geopolitical context. I'd identify several key factors:
  1. There is a strong risk that the UK will diverge sharply from EU over the few months after December 2020;
  2. There is a strong risk that climate change is running substantially faster than IPCC have allowed for, and that action to mitigate is lagging far behind;
  3. The new digital propaganda tools by which well-funded actors can manipulate elections are rapidly maturing; and consequently
  4. There is a strong risk that the English-speaking world is sliding towards something resembling real fascism or at least oligarchy.
Both Scotland and the UK are bit-players in all this; we don't move the tides of history, we have to ride them. The attack by Russia on electoral processes in the UK is not primarily aimed at the UK so much as at creating chaos and turmoil across the West. In that sense the UK's only geopolitical significance is as a keystone in the defences of the European area of stable peace against chaos, and it's a keystone which no longer has any structural integrity.

For clarity, in saying 'the attack by Russia' I'm not saying that the attack is made solely by Russia, nor that the attack is in the long term interests of the Russian people or state. Rather, it's an attack by an emerging oligarchy, which currently controls Russia. Nor is this oligarchy monolithic; rather, it's made up of a class of ultra-rich individuals who very largely do not see themselves as a collectivity and who very largely do not coordinate their actions, but nevertheless each act 'rationally' to protect and enhance their accummulated wealth and influence.

They include, but are not limited to, those who profited from the ill-managed privatisations in the collapse of the Soviet Union; absolute rulers of oil states in the Arabian peninsula and elsewhere; the hereditary aristocracy of Great Britain, including the House of Windsor; 'tech entrepreneurs' including Gates, Ellison, Zuckerberg, Brin, Page; the financial services elite; and the controllers of major organised crime cartels. These groups, of course, socialise, intermarry, interpenetrate, overlap; that is the nature of a collectivity.

Surrounding the oligarchs themselves — who may or may not be consciously malign — there's a penumbra or Oort cloud of actors who clearly are malign: people like Murdoch, Bannon, Yiannopoulos, Rees Mogg. They are, in a sense, the intellectuals or ideologues of the oligarchy, forging an ideology which allows the oligarchs themselves to 'rationally protect and enhance their wealth and influence', by undermining and destroying the democratic institutions which would otherwise allow mass action to erode those accummulations. But they're not oligarchs themselves, although they may aspire to be; they're hangers on.

One very worrying thought made powerfully by Umair Haque, when he says "climate change accords perfectly with the foundational fascist belief that only the strong should survive, and the weak — the dirty, the impure, the foul — should perish", is that the oligarchs (or their ideologues), rather than putting their shoulders to the wheel to resist climate change, may consciously be seeking to accelerate it.

To say 'but we can't resist these forces' is probably true, but that way leads simply to despair. If human life on earth is to continue, people (including Scotland as a bit-player) must resist these forces, now. It isn't sufficient to go on playing the Westminster game, and, in particular, there isn't time to think about the long game. As John Maynard Keynes said, but with particular force now, in the long run we're all dead.

Pulling focus back to Scotland, what worries me is that the SNP's analysis is as shallow as Politics Galore's. Like the podcast, they believe that the future will be much like the past; like the podcast, they ignore the turbulent geopolitical forces which mean it won't be.

Salmond was a risk-taker; Sturgeon is not. She will play it safe. As the tides of history tear our society and our economy apart, she will wait irresolute for a 'perfect moment' which will never come. The merit of Angus MacNeil's 'Plan B' was not primarily that it actually was a strategy (Sturgeon's wistful hope that she can somehow extract a Section 30 order from a triumphant English Tory government is not), but that it gave us a fresh bite at the cherry with each successive Westminster election.

But there (probably) isn't time. Measurements in Greenland and the Antarctic show that the Climate Emergency is moving much faster than predicted, and meantime the oligarchy and its ideologues are honing its anti-democratic toolkit.

Scotland alone cannot swing the UK back to a path of sanity. We're structurally weak, and, as Johnson gerrymanders the electoral system to lock in Tory majorities, we'll remain structurally weak. Our escape route is to bind ourselves to the European bloc (EFTA or EU), and then to work to strengthen — and radicalise — that bloc; but we cannot do that without independence.

We don't have, for reasons I've given above, much time. You would not have been wise, in 1935, to make any political plan for three electoral cycles hence: the tides of history would have washed it away. 2020 will be 1935 on steroids.

I still believe — and believe strongly — that an independent Scotland could be a positive actor on the world stage, both in seeking to build peace, justice and stability, and in seeking to resist climate change and slow the rate of extinctions. But time is short; the crises are urgent and rapidly becoming more so. If we cannot achieve independence within a very short time frame, it will be time to abandon indulgences like constitutional tinkering and seek to build alliances to defend our planet. Indeed, it may well be that time already.

An independent Scotland on a dead planet would be a very hollow victory.

Friday, 25 October 2019

Party Party

Let's start this essay with a confession that I may have been badly wrong. I have been saying for some time that I did not believe that Nicola Sturgeon would actually call a second independence referendum; rather, that she'd use Westminster's expected rejection of an Article 30 order to indefinitely postpone one. Well, possibly, I was wrong. I hope I was wrong. Both The National and the SNP now say that Sturgeon will announce a concrete date for IndyRef 2, in 2020, at a rally in Glasgow on Saturday 2nd November.

So, good. Sometimes, it's nice to be wrong.

However, then we move onto the campaign. I expect the Scottish Government to produce a white paper, as they did in 2014, setting out a prospectus for independence. And I expect that prospectus to be, as it was in 2014, broadly a steady as she goes, don't rock the boat prospectus: a prospectus for a broadly technocratic, social democratic Scotland, more closely aligned to the interests of Andrew Wilson's clients than to those of the broad majority of Scots.

I do not believe the white paper was the critical vote winner in 2014. I think the broad vibrancy of the Yes campaign, the thousand flowers that bloomed, and in particular (for me, anyway; but I think for many others) the Radical Independence Campaign's slogan 'Britain is for the rich; Scotland can be ours' were more influential. Be that as it may...

Supposing there is a referendum, supposing Yes wins, supposing the UK government honours the result. There's a Holyrood election on 6 May 2021, which will undoubtedly happen before negotiations - with the UK, with the EU, with EFTA - are completed, and whose results will strongly influence the outcome of those elections. 

If, as the SNP assumes - the SNP is elected to govern, especially if it is elected to govern with a majority - we will see an independent Scotland built in the image of that white paper: which is to say, not very different from the United Kingdom we are leaving.

The Queen will, almost certainly, be the head of state. Lords will still lord it over us. The land will still belong to the rich. Our system of democratic governance will remain highly centralised, with enormous, profesionalised 'local government' units administering territories each larger than one sixth of all independent countries in the world. The capitalist system will remain entrenched, owning most of the nation's industry and infrastructure. We'll even keep the pound - for the time being, at any rate - and that will prevent us rejoining the EU.

I don't believe that's the Scotland Scotland wants to be. I don't believe it's even the Scotland most members of the SNP want to see. Independence which changes nothing is worth nothing.

So what do we do about it?

Lesley Riddoch, at a fringe event of the SNP conference, suggested she'd start a new party to challenge the SNP from the decentralist left. She slightly rowed back from that in her column later that week, but the idea is a sound one. In order to challenge the SNP's corporatist, technocratic vision at the 2021 election, we will need a new party. 

If it's a brand new party, of course, it's ridiculous to suppose that it can sweep to power in one bound. But that is not the point, as Lesley has said: the point is that the SNP is vulnerable from the left, and it knows it. The party has triangulated right so far and so fast in the past six years that it's left most of its members, let alone its supporters, behind.

A clear challenge from the left will push the SNP leftward. A strong challenge from localism should cause the SNP to at least reconsider its centralist bias.

The Holyrood electoral system - which I'm assuming we'll still use in 2021, since there is no current strong pressure to change it, and there isn't much time - gives space for small with broad support across Scotland. That 2021 government will be critical to the shape of Scotland for a generation at least, since it will supervise the process of agreeing a constitution. It is critically important to have influence in it.

A government of all the talents in which Lesley joined Andy Wightman, John Finnie, Maggie Chapman from the Greens, Tommy Sheppard, Alison Thewlis, Mhari Black, Mairi Gougeon, Jeanne Freeman and Mike Russell from the SNP would build a far more interesting Scotland than our current SNP cabinet.

And if we're to have such a party in place - if a new party is, indeed, needed, because it may be that what we should do is join the Greens - we can't wait, as Lesley suggested, until after independence. We need to start putting a platform together now. Yes, we can lift a great deal from work already done by Lesley herself, by Common Weal, Radical Independence and others, but we would need a clear, coherent platform, and that would need to be constructed.

I think it's time to party.

Wednesday, 14 August 2019

Eagles, and governance

Young eagle flying with trap clamped to its leg
Here is the text of my letter to the First Minister regarding the wildlife persecution on grouse moors crisis. I strongly suggest you write to her too, but please write your own letter - copy/pasted letters tend to get ignored.
Dear First Minister

The SNP's craven inability to face down landed interests has always disappointed and puzzled me, but the developing crisis over the behaviour of grouse moor managers and the failure of your government to intervene in it is reaching the stage where it risks undermining the whole independence project.

You will (I hope) be aware of the illegal slaughter of Scotland's iconic wildlife on the grouse moors, from eagles to wildcats. You will (I hope) be aware that there is today a young eagle flying in Aberdeenshire with an illegal trap clamped to its leg.

Now, we have a petition, addressed to the Westminster parliament, asking it to intervene in a devolved matter. which in less than one day has gathered more than 16,000 signatures, and which is highly likely to gather several hundred thousand. You will see from the map that a very large proportion of these signatures have come from remote rural Scotland - where you cannot afford to lose votes.

In these febrile times, do you really want Westminster holding a debate on the failure of your goverment? Do you want grandstanding Tory ministers - the fragrant Alister Jack - having a popular excuse to take powers back from Holyrood because of Holyrood's failure to legislate effectively?

We have left an open goal, and in the run up to the next trial of strength on independence we do not want the Unionists to be able to say, "well, we trusted them to care for their own woldlife but they wouldn't do it; why should they be trusted with independence?"

It's a good question, and one which will be hard to deal with on the doorsteps.

Please act now, by enacting a bill which places a duty of care on estate owners to prevent wildlife crime on their land, with penal sentences on the beneficial owner if they fail to do so.

Yours sincerely

Saturday, 8 June 2019

The quest for Zireael

Ciri draws her sword Zireael for the first time
Over the past six weeks I've completed my second full run through of the The Witcher 3: Wild Hunt, and I want to record my thoughts about it.

I set out with three main goals: to follow the 'Triss' path rather than the 'Yennefer' path; to rescue the Bloody Baron's wife, and generally explore that story more fully; and to win as many allies as possible for the battle at Kaer Morhen.

Regarding Triss versus Yennefer: these are the only two major love interests for Geralt in Witcher 3. In many ways they're similar: both sorceresses, both ambitious, both powerful politically, both manipulative, both prepared to use intimacy - and sex, although I'd like to draw a distinction here between the two - transactionally to achieve their objectives. And they're friends. In the previous Witcher games, Yennefer has not been present as a character, but in the novels, she is clearly Geralt's primary (but not exclusive) sexual partner, and it was mainly for that reason that I followed her path on my first run through. By the end of it I was pretty confident that this was a mistake, and, having now played through the Triss path, I more than ever satisfied that she is the better of the two choices.

Yennefer is more powerful and more glamorous, but has much more ambiguous morality. She willingly uses necromancy, and is unashamed at destroying treasured and ancient religious sites to draw power for her magical workings. I can think of no occasions either in the novels or in the books where Yennefer behaves in a way that is unambiguously generous. Even her care for Geralt's stepdaughter Ciri is at least plausibly an attempt to gain influence over Ciri's very substantial power.  By contrast, Triss refuses to use necromancy, and doesn't destroy other people's artifacts in the use of her power (that I can remember); she behaves with genuine generosity at least some of the time, including towards people there's no reasonable reason to expect will ever be able to repay it.

But both in the novels and in the games, there's a third choice of someone who seems better (and a better fit for Geralt's character, at least as I interpret it) than either, and that's Shani. Shani is not a sorceress, and not powerful. Instead she's a doctor of medicine, highly altruistic, extremely brave, tolerant of and generous to everyone. But in the Witcher 3 she appears only as a bit part - a potential casual shag - in the Hearts of Stone extension. That seems to me a waste of a good character, frankly, who could have made the main plot much more interesting and thus thrown light on the characters of the other two.

Whatever: when your choice is Yennefer or Triss, Triss is the warmer, the more supportive, the more caring, possibly the more sensual; although arguably Yennefer is the more glamourous, more challenging, the more exciting, the more acerbic, possibly the more sexual. My choice is Triss. I think it's the better choice.

The Bloody Baron is probably the most developed and the most narratively interesting side-quest in The Witcher 3. In my previous play through I had left his wife living with the witches in the bog, clearly mad, but caring for the children and having, it seemed to me, some quality of life. I took the view that while it wasn't a good situation, it was better than the other available alternatives. This run through, I decided to try to see whether I could reconcile the Baron with his wife, and I sort-of succeeded. The Baron and his wife (and to my great surprise, also his daughter) were reconciled after the crones were defeated; however, it didn't end well. Because I had released the spirit of the forest, Anna was cursed, and died. The Baron later killed himself. There is apparently at least one more, and significantly better, ending to this story, but I haven't found it yet.

As I said above, I set out to recruit as many allies as possible for the fight at Kaer Morhen. The Nilfgardian cavalry didn't actually appear, but had been despatched; otherwise, I had Keira Metz, Hjalmar an Craite, Ermion the druid, Letho the Kingslayer, both Triss and Yennefer, Zoltan Chivay (of course), and Vernon Roche and Ves. What I hadn't thought through was that there were bound to be very considerable tensions in that group, notably between the Kingslayer and the Temerian resistance - that was an interesting touch, and shows how carefully thought through the whole game is!

A pleasing moment was that, after the battle, Keira (who in my previous run through had been burned at the stake in Novigrad as a heretic), went off with the witcher Lambert on a quest, and we later hear that they'd married. While I hadn't previously felt particularly responsible for Keira's death, this definitely seems a better ending (for both characters).

However, related to that was one of my unexpected failures in this run: I didn't get into the narrative sequence in which Radovid is killed, and I didn't succeed in suppressing the religious intolerance in Novigrad; consequently, when Nilfgard was essentially defeated (which I had been intending), the Redanian army swept into Velen with their witch hunters and wreaked even worse desolation than I remember from before.

Whether there's any relatively 'good' geopolitical ending to the story I doubt: Nilfgard winning (as in my first run through) and Redania winning (as in this one) are both pretty appalling, but if there's a way - I don't know whether there is, and I don't want to be told because I shall make another attempt some day - of defeating both Redania and Nilgard, then I suspect that Velen, Temeria and probably Redania as well would become a seething mass of competing robber barons and warlords, with conditions for the peasantry as bad as ever.

It occurs to me that I have not explored what would happen if one encouraged Ciri to reconcile with her father, and thus possibly become empress; this might make for a better ending, geopolitically, for the world as a whole, perhaps; but it doesn't seem to me that it would be a better ending for Ciri.

I have to say here that from the point of the Battle of Kaer Morhen on, the whole story was radically different from what I remember from my previous playthrough - and I saw the beginnings of (but didn't complete) still further loops in the plot which it would be really interesting to explore some day. There is quite extraordinary richness in this storytelling.

I don't know whether there's any narrative link between the choice between Triss and Yennefer (of course you don't have to choose; you could play as a chaste witcher and bed neither) and the choice between Redania and Nilfgard. And, as I say, in this run through I didn't in any sense side with Redania - I didn't avoid the quests which would lead into the area of the story where that choice would be made, but that wasn't because I was consciously avoiding it.

On Skellige, I sided with Cerys an Craite, as I had before. To my mind, she is just a much better candidate for the throne than her brother. Consequently, I still haven't seen how, if at all, choosing Hjalmar would alter the story.

At each point where I had an opportunity to influence Ciri's choices, I chose to support her in making her own choice. That, I think, is similar to what I did before; it feels natural to me, and it also feels to me to be what Geralt would naturally do. But in the ending, Ciri went into the locked tower to bring an end to the white frost, something I don't remember from my previous run through, and in that scene I saw her recall all the times in the story when I'd taken her side and backed her up. That seemed to me extraordinarily poignant and positive, and very sensitively done. Bravo! Afterwards, when I told her father that she was dead, I genuinely believed it was so, genuinely mourned it, and genuinely wondered what misstep I'd taken; so the very end, where I was reunited with her and gave her her witcher's sword (something which definitely didn't happen on the last run) was a wonderful surprise.

To criticise - for no work of art is perfect - as I've written before many times before, the poverty of repertoire of the characters is, to me, very disappointing, and it does not seem impossible given the current state of the art that they could be given far greater depth of narrative. Whether that would take you into an uncanny valley I don't know, but I would like to see it tried.

The other major criticism I have is that - given that I play for story, not 'to win' - the big set piece fights really don't work for me. They are, for me, just boring. I'd much rather see the climax of the story through interaction with characters than just by great slash fests.

However, these are details; and they're details from the point of view of my personal taste.

So, once again: The Witcher games collectively, but especially The Witcher 3, are quite extraordinary works of cultural achievement, story tale on an epic scale which I don't believe is surpassed anywhere in any medium. If you have not experienced it, you have missed yourself.

Friday, 31 May 2019

No-one here gets out alive

Avis (left) and Zoe (right) taken on Christmas Eve 2017.
My mental health, which had already been poor before my lover Avis died of cancer in July last year, has collapsed utterly since the suicide of my niece Zoe in November. Somehow I have to find my way back (or die, which would be easier). This essay is an attempt to plot a plan for the first option.

Partly as a consequence of my mental health collapse, my last remaining work contract is looking very shaky, and may not continue. I don't even really want it to continue, even though without it I have no income at all. And I don't believe I am now well enough to seek new paying work; I don't believe it's reasonable to expect that I will be well enough in the even moderately near future. But when I do seek new paying work, I need to have some story about what I was doing this year.

Finally, I'm not currently receiving any benefits, and I'm not well enough to apply for benefits. Zoe (before she died) started an application on my behalf, and my community psychiatric nurse has continued that application, but I have no faith in anything actually being paid. Fortunately, I shall inherit what little Zoe had, and I may be able to sell about £1,000 worth of cattle this autumn (if I'm well enough) but that isn't enough to keep me alive for a year.

What I need to recover health is a series of successful challenges, gradually increasing in difficulty. If I overface myself and fail, I end up further down the slope; things get worse. So it's important to pick challenges I can succeed at. So far so good.

Survey of the battlefield

Cattle

I have cattle. As I've had three calves born in the past fortnight, I now have ten cattle. Of these, one is ready for slaughter but because his paperwork is not in order cannot be sold. Three are last year's calves, and their paperwork is in order, so potentially they can be sold, but they're hybrids and not worth much except as meat, and they won't be ready for slaughter until this autumn at earliest. One of them, Draeg, is male and has not been castrated, so I urgently need to separate him from my cows (and, ideally, get him castrated). I do not want any of my three cows to get pregnant this year - lovely as calves are, I have too many cattle and could do with a year without them.
So the overall plan is
  1. to slaughter Beelzebub this winter (or when I have sufficient freezer space, whichever is the earlier) - this I'm fairly confident I can do;
  2. sell the three yearlings this autumn, either for slaughter or for fattening; they'll be worth at best a very few hundred each (and could fetch much less);
  3. keep the three cows and their calves-at-heel.
Selling cattle is something I have not yet done, and I am not at all confident I can do it.

The Cattle Shed

For the past four years at least, I've been planning to build a cattle shed, and the plan has always been to get it finished before mid July of each of those years, so that I can put the year's hay harvest into its hay loft. The current state of play is that most of the materials are bought and paid for, the foundations and floor are in place, and most of the blocks for the lower walls are on site. Getting the blockwork up is probably about a fortnight's work, and it's something I can now definitely do: the last things blocking it were resolved yesterday.

But sawing the timber for the superstructure is not done, and building the frame can't happen until the timber is sawn. I cannot saw the timber alone, and the sawmill I'd assumed I'd be able to borrow I now probably can't borrow. So there are two options: one, abandon the timber I've already bought and buy new, sawn timber; or two, hire someone to mill the timber. I definitely cannot afford either of these. Even if I can get timber really soon, building the frame is at least a month's work, and completing the build at least another's. It's now the very end of May. So there's no way I can now get the shed finished in time for hay harvest this year. It isn't impossible that I could have it finished for winter, and having it finished for winter actually would make life easier even if the hayloft were empty (or even unfinished).

Hay

I've currently got my cattle in my bottom park; this leaves the middle and upper parks clear to grow hay. However, I'm not confident they've really got enough grass, and in any case I need to get Draeg away from the cows (or castrated) before they come into season again, which is pretty damn soon. So either I need to move my male cattle into the upper park, or else onto my neighbour Alice's land, with her permission - she has the grass. If I move the male cattle into my upper park, it makes work on the cattle shed building site vastly more difficult.

If all I am keeping over next winter is the three cows and their calves at heel, then the middle park should produce enough hay for that, assuming the winter is not too bad. But I'd really like to be able to mow the upper park as well, just as insurance.

All my hay making equipment needs quite a lot of maintenance, which I had planned to do over the winter and just have not been well enough to. If it is to be used there is at least a fortnight's work on that. However, the baler is almost ready to go, and if I can bale for James, I can get him to mow for me as a trade.

If I don't have the cattle shed up in time (and that is now virtually impossible), I can store hay in the old byre, although that's increasingly decrepit and in any case a hassle. So hay actually can be done. But also, in the last analysis, enough hay for three cows for the winter would not be enormously expensive to buy. Hay is not a major problem.

Software

Being someone who is reasonably good at writing complex software is an important part of my identity. At present I am not that person, because my attention span and concentration are mince. I feel that I need to gradually build back to the point where I am that person. One of the problems are that I have too many projects on the go, and am much better at starting new projects than at working steadily and consistently on existing ones. The current projects are:
  1. Outlook add-in for SalesAgility's SuiteCRM product; this is the only paying work I currently have (and it doesn't pay much);
  2. Project Hope, a voter intention/canvassing system for Indyref2, which is more than half finished;
  3. The Great Game, a very large open world game project;
  4. Post Scarcity, a software environment for the massively parallel computers which must, I believe, be the future of computing.
Taking these one by one:

The SuiteCRM Outlook add-in is not something I enjoy working on or would choose to work on, although I do appreciate working with the folk at SalesAgility I work with on it. However, I am increasingly not well enough to do it, and the strains of the project are not contributing to my mental health. Also, there are quite considerable costs in terms of software subscriptions involved in working on it; it is the only paid work I have, but even so it barely washes its face. If SalesAgility do not decide to drop the project, I probably ought to withdraw from it.

I have no confidence a second independence referendum will ever be held; it seems to me unlikely. The SNP will not go ahead without a Section 30 order from Westminster, and I can see no prospect at all of Westminster ever granting such an order. So Project Hope is probably useless. Even if it were useful, it is no use having such a system if the only person who can support it is an unreliable madman. So if the project is to continue, it needs help which in my present state I can't recruit: it needs a project manager, at least one additional developer, at least one evangelist, and, ultimately, a group of people to train canvassers and analysts to use it.

Nevertheless, if Project Hope could be finished, it would have real benefits:
  1. It would help win a second independence referendum, if one were held;
  2. Even if another independence referendum is never held, it would help with canvassing in other referenda and elections for any organisation which chose to use it;
  3. It would be a solid and impressive piece of work which would form a key part of my CV when next I am well enough to seek paid work.
This is work in my core competences, in a software environment in which I am extremely comfortable, which could be genuinely useful in the real world. Rationally, it is probably the best candidate. But, without help, I cannot do it.

The Great Game is a fairly sketchy plan to build a game which would address what I perceive as many of the failings in modern computer games. It is vast and far beyond the capability of any one person to build. However, potentially, subsystems of it, especially the merchant subsystem and the gossip subsystem, could become libraries which could be sold to other game developers for use in their games; in other words, despite the overall project being ludicrous in scope, there is a potential here for a commercial business.

However, for that to be the case these modules would have to be broken out into libraries which could be called efficiently from C++ or similar code, and ideally integrated with one or more of the more common game engines.

The work which I've done on it so far is prototype work on algorithms for merchants and gossip.

Post Scarcity is even more ludicrously ambitious: to design a software environment - an operating system, if you like - which would make as yet undeveloped computers of unprecedented power tractable and useful. It's necessarily being done in very low level languages which are not my forte, and its present state is bogged down in hard-to-trace bugs. It would make a great PhD project for someone, but possibly not me. However, if I could focus on it, it would be very good mental exercise, and like eating an elephant, it can be done in teaspoonfuls.

In summary I need to focus on one project and largely abandon the others. Project Hope is rationally probably the best choice, but I can't make progress on my own and don't know how to recruit help. The Great Game (or, more specifically, its marketable subsystems) has the benefit of being something I can make progress on without outside help.

Plan for the campaign?

So it looks to me as though my best plan is
  1. To erect the blockwork for the cattle shed as soon as possible, without worrying about when the superstructure can be completed: feasible, needs no outside support, can be achieved, will have some value as shelter and as a hard feeding pen even if the shed is never finished;
  2. To separate the male cattle and move them at least to the upper park (but to ask Alice if I can move them into hers);
  3. To procede with maintenance on the baler as soon as possible, with the rake and mower as stretch goals - if working in the Void is too stressful, fetch them down here to be worked on;
  4. To ask friends for support on Project Hope, but, if I don't get that soon, to abandon it and focus software on The Great Game;
  5. To not worry about anything else for the time being.
Comments?

Creative Commons Licence
The fool on the hill by Simon Brooke is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License