Friday 19 July 2013

Ultra-low impact housing and public policy

Politicians are once again talking openly about how to reduce the cost of housing. I know how to do this, and have a genuinely modest proposal.

This house, as I've described earlier, is almost entirely bio-degradable. Without maintenance, it would fairly rapidly collapse into a pile of rotted timber and straw on the forest floor, marked only by the stove, the bath, the water pipes and the glass; and, as these things are inherently valuable and recyclable, I would imagine someone else will rob them out long before the house gets to that state. With reasonable maintenance, I believe the house could last - and be comfortable and habitable - in the long term. Sixty years at least, perhaps twice that; as long as a conventional modern house is designed to.

This house would not pass building warrant, and there are some good reasons for that. It has no foundations; it is (intentionally) very close to trees; it has some fire safety deficits. Notably, it would be impossible to get a fire engine to it in the event of a fire, but also there is no fire separation between the walls and the roof structure, and I have not yet fitted the fire ladder which I intend to fit from the rear window. And it seems to me that it would be very hard to draw up building regulations which this house would pass which would not allow very unsatisfactory buildings also to pass.

But those things don't matter to me: I built this house myself to my needs, and I'm comfortable with it. I've chosen the risks and assessed them; I'm happy that it is safe enough for me.

Obviously, if you allow people to build houses without building warrant and then let them to tenants, you will get slums, and grossly unfit and unhealthy housing. And that suggests a compromise.

Suppose you were to legislate that a person did not need building warrant or full planning consent for a low-impact building which they had erected themselves, and in which they lived themselves; but planning consent and building warrant would be required before that building could be sold or let? There would be a couple of problems with a scheme as simple as that. Such a house would have to be built more than a safe margin from the edge of its plot, so that if it caught fire, fire would not spread to other properties. I imagine three metres (i.e. a 6 metre gap between adjacent buildings) should be enough, but there are people better qualified than I to make that judgement. So this sort of development could not provide very high density housing. And while an earth closet has very low environmental impact, for public health reasons, in urban areas, there would have to be some regulations about the disposition of shit, and sewerage.

But if people are responsible for their own houses, they will build houses to meet their needs; and if the houses they build don't meet their needs, that is their problem. And in any case, if a low impact home does prove unsatisfactory, it is cheap enough that the owner would be able to pull it down and start again.

Campaigners for rural amenity will also claim there's a need for planning consent - they don't want to see people building houses in pretty places. But farmers can, within broad limits, erect huge ugly sheds without much in the way of planning regulation, and it seems to me that homes for people are more urgently required than sheds for tractors. So I would like to see no more onerous planning regulation - simple notification - for self build dwellings than for tractor sheds.

There is, of course, another issue: people will fear that urban margins and rural areas will become littered with the wrecks of abandoned self-builds. And that's where 'ultra-low impact' comes in. If these self builds are built mainly of bio-degradable materials - timber, straw, wool - or of materials sourced in the local environment - fieldstone, clay, sand - then the buildings, if abandoned, will not litter the landscape long. They will be transient.

So that's part one of my modest suggestion: building warrant and full planning permission is required to sell or let a low impact dwelling, but not to build one. Now onto part two.

Local government could prepare sites with sewer, drinking water, electricity and telecoms connections, and could lease these on sixty year lets to people. The people could build their own houses on the plots. When the lessor chose to move on then, if the house passed building warrant, the council would buy it at a pre-agreed but fairly nominal price covering the basic cost of construction, and let it or sell it as social housing; if the house did not pass building warrant, the council would demolish it at their cost and relet the site to another self-builder.

Obviously, commercial companies would come into this market with kits or house designs. It seems to me reasonable that there should be some sort of building warrant type-approval for kits and designs - if build correctly as specified, they should pass building warrant. You should not be able to sell a kit which definitely would not pass building warrant.

The cost of building a house is mainly down to two things: planning consent (and therefore scarcity, and windfall profits for landowners), and labour. If you take those elements out of the equation, housing becomes very cheap indeed: the basic materials out of which perfectly good houses can be constructed need not be expensive. As I've argued before, the total cost of building a house can be less than the deposit on a commercially built one. Encouraging and facilitating self build of low impact housing would solve Britain's housing stress problems at a stroke.

Wednesday 17 July 2013

Modelling the change from rural to urban

This essay is about software, not the real world! If you're interested in my thoughts on real world rural policy issues, check the Rural Policy category on the right.

In the real world - in Northern Britain particularly, but I think this holds for many other places - there are three essential layouts of rural communities:

  • Non-nucleated settlements, where dwellings are scattered at least tens of metres apart over quite a wide area; highland crofting settlements are typically of this form.
  • Nucleated settlements, where dwellings are grouped closely around a central feature such as a village green or a pond; villages of this form are typically older villages, especially in areas of Anglian settlement. Rhonehouse is a good example locally.
  • Linear settlements, which are a special case of nucleated settlements, where dwellings line the sides of an (often broad) street. These settlements typically are medieval in origin and reflect the runrig agricultural pattern - each house had inbye land stretching back from the street. Moffat, Lochmaben and Thornhill are local examples.

Stamfordham, Northumberland: a typical nucleated settlement centred around a village green. Field boundaries to the north give clear evidence of runrig agriculture, while the south side shows the growth of closes and alleys.
In nucleated settlements generally, as the settlement grows, alleys and lanes form stretching out from the original grouping. Edinburgh's old town is an example of a linear settlement which grew in this way. Older, unplanned rural settlements do not have a regular street plan - that's a feature of quite advanced urban societies.

In creating a mechanism for settling a convincing, naturalistic virtual world, these patterns need to be born in mind. This is complicated by a number of issues which are driven by technology (and perhaps by my lack of skill and imagination); I want to avoid as far as possible technological issues introducing visible artefacts into the virtual world.

Currently I'm working on a grid of 100 metre square cells. This isn't ideal at all, but it's simple and at the stage I'm at in developing algorithms that simplicity helps. But naturally, things people build are not always square and certainly not always aligned to a north/south grid.

Dunvegan, Skye, a non-nucleated settlement. Dwellings are set on their individual crofts, scattered across the landscape.
From the point of view of settling farmers, a 100 metre square grid - one hectare to a cell - is adequate; I'm working on the principle that my sort of roughly bronze-age to late medieval farmers can manage between four and six hectares per household. As farmers will naturally cluster together in areas with better soil fertility and shallower gradients, and so that 'naturally' models the non-nucleated settlement. Within any non-urban holding, the dwelling house should gravitate to the edge of the holding nearest other dwelling houses - a gravitational algorithm is precisely right to do this. This will provide the beginnings of clustering.

As you'll see in my note on Populating a game world, when a non-nucleated settlement of farmers reaches a certain size, it begins to attract craftsmen. Among the first of these is an innkeeper; to support an innkeeper requires ten other actors dwelling within walking distance (say a ten cell - one kilometre - radius). When an innkeeper settles, he reserves a set of four to six cells, close to sufficient potential customers, and ideally adjacent to a cell already designated as road.

One of these cells becomes the inn yard, where the inn and its outbuildings are sited. One adjoining the inn yard becomes 'urban open space', which can't be built on - it's rendered as a village green until the village reaches a certain size, then paved square. If possible the 'urban open space' cell will be placed to border both the inn yard cell and a cell designated as 'road'. Other cells from the farm are designated as 'urban'.

Similarly, when an aristocrat settles, he will reserve one cell for his castle, one for a 'market place', and four more as urban; a market place will subclass an urban open space and so will prefer to be located adjacent to an existing road. The castle will normally be on a hilltop, except where there is a river crossing, which would be a preferred site.

There's probably some algorithm I could find which would lay out wee twisty streets and arterial roads in a naturalistic fashion... If cells which are designated 'road' adjoining 'urban' cells get redesignated as 'arterial', that's probably a good first step. Arterial cells have dwelling plots lined either side of a broad street, and one lane off either side. An arterial cell alongside an 'urban open space' may have no dwellings on the side towards the 'urban open space', giving in effect of a larger urban open space. Land use types 'urban open space', 'arterial' and possibly others will subclass 'urban', or share a common interface.

Kirkinner, Wigtownshire: a linear settlement.
A settlement with mainly arterial cells should give a fairly good model of a linear settlement.

As a tweak, it's possible that urban cells adjacent to water cells could become dock cells.

A number of pre-planned (that is, designed) ground plans will be created for 'urban' cells, such that they will tessellate together to give an impression of irregularity. Urban cells have up to twelve dwellings per cell. Dwellings in urban (and arterial and 'city wall' cells, see below) are erected in preplanned locations within the ground plan - generally, facing the most significant street which abuts the plot.

Although urban cells have plots for twelve dwellings, they won't automatically be occupied. Rather, a new craftsman setting up shop will occupy a free plot in an existing urban cell, and will only create a new urban cell if there are no free plots available. In selecting a plot, the available plot with most occupied neighbours will be chosen.

Where more than a critical number - say 15 - urban cells are clustered together, the outermost will become 'town wall' cells. An outermost arterial cell will become a 'town gate' cell. Again, preplanned ground plans for 'city wall' cells will be created, with wall models. These will be designed to fit together in ways which are not obviously square and grid-aligned.

There is a slight problem with this which is that to get to town wall status would take at least 180 households, which is quite a lot for my game economy; this implies walled towns will be relatively uncommon, which is fair enough. However if, as a slight fudge, journeymen and soldiers each have their own dwelling instead of living in their employers' dwelling, the number of households will grow faster.

Buildings in urban cells will just be genetic buildings like anywhere else, except that the fact of being in an urban cell should give an emphasis to building upward. Arterial cells will promote taller buildings even more strongly than other urban cells.

Saturday 6 July 2013

Populating a game world

(You might want to read this essay in conjunction with my older essay, Settling a game world, which covers similar ground but which this hopefully advances on)

For an economy to work people have to be able to move between occupations to fill economic niches. In steady state, non player character (NPC) males become adult as 'vagrants', and then move through the state transitions described in this document. The pattern for females is different.

Basic occupations

The following are 'unskilled' occupations which form the base of the occupation system. Generally a male character at maturity becomes a 'Vagrant' and wanders though the world until he encounters a condition which allows him to advance up the occupation graph. If an occupation wholly fails, the character can revert to being a 'Vagrant' and start again.

Occupation Dwelling condition New trade Notes
Vagrant None land available and animals available Herdsman
Vagrant None arable land available Farmer See crops
Vagrant None has weapons Outlaw
Herdsman None Insufficient food Vagrant
Farmer Farm Insufficient food Vagrant
Outlaw None loses weapons Vagrant
Vagrant None craftsman willing to take on apprentice Apprentice
Herdsman None arable land available Farmer
Outlaw None Battle hardened OutlawLeader
Apprentice (craftsman's) Qualified Journeyman
Journeyman None Unserviced customers available Craftsman See crafts
Craftsman See crafts Too few customers Journeyman
Journeyman None arable land available Farmer
Vagrant None Lord with vacancies available Soldier See military
OutlawLeader None Unprotected farms available Laird See nobility

Gender dimorphism

In the paragraph above I said 'a male character'. It may seem unfair to create a game world in which the sexual inequality of the real world is carried over, and for that reason it seems sensible that female children should have the same opportunities as male children. But games work on conflicts and injustices, and so it seems reasonable to me to have a completely different occupation graph for women. I haven't yet drawn that up.


Vagrants wander in a fairly random way. While vagrants are wandering they are assumed to live off the land and require no resources. Solitary outlaws similarly wander until they find a leader, although they will avoid the areas protected by nobles. Herdsmen also wander but only over unenclosed pasture. They visit markets, if available, periodically; otherwise, they live off their herds. Journeymen wander from market to market, but are assumed to trade skills with farmers along the way.


Crafts are occupations which require acquired skills. In the initial seeding of the game world there are probably 'pioneers', who are special vagrants who, on encountering the conditions for a particular craft to thrive, instantly become masters of that craft.

Craft Dwelling Supplies Perishable? Customer types Needs market? Customers Supplier Suppliers Recruits
Solo Per journeyman Per apprentice

Min Max Min Max Min Max
Smith Forge Metal Items no Farmer, Soldier No 6 10 4 6 1 3 Miner 1 Vagrant
Baker Bakery Bread yes All NPCs No 20 30 12 18 6 10 Miller 1 Vagrant
Miller Mill Flour, meal no Baker, Innkeeper No 2 3 1 2 1 1 Farmer 6 Vagrant
Weaver Weaver's house Cloth no All NPCs Yes 6 10 4 6 1 3 Herdsman 2 Vagrant
Innkeeper Inn Food, hospitality yes Merhant, Soldier, Farmer, Lord No 10 20 5 10 2 4 Farmer,Herdsman 2 Vagrant
Miner Mine Ores no Smith Yes 2 3 1 2 1 1 Farmer 1 Vagrant
Butcher Butchery Meat yes All NPCs No 10 20 4 8 2 4 Farmer, Herdsman 2 Vagrant
Merchant Townhouse Transport, logistics n/a Craftsmen, nobility Yes 10 20 4 8 2 4 n/a n/a Vagrant
Banker Bank Financial services yes Merchant Yes 10 20 4 8 2 4 n/a n/a Merchant
Scholar Academy Knowledge n/a Ariston, Tyrranos, General, Banker No 1 4 1 2 0.25 0.5 n/a n/a Vagrant
Priest Temple Religion n/a All NPCs No 50 100

Chancellor Chancellory Administration n/a Ariston, Tyrranos No 1 1 0 0 0 0

Lawyer Townhouse Legal services n/a Ariston, Merchant, Banker No 4 6 2 3 1 2

Magus Townhouse Magic n/a Tyrranos, General No 3 4 1 2 0.25 0.5


A craftsman starts as an apprentice to a master of the chosen crafts. Most crafts recruit from vagrants, A character must be a journeyman merchant before becoming an apprentice banker, while various intellectual crafts recruit from journeyman scholars.

It's assumed that a journeyman scholar, presented with the opportunity, would prefer to become an apprentice magus than a master scholar.

A journeyman settles and becomes a master when he finds a location with at least the solo/min number of appropriate customer type who are not serviced by another master craftsman of the same craft; he also (obviously) needs to find enough free land to set up his dwelling. The radius within which his serviced customers must live may be a fixed 10Km or it may be variable dependent on craft. If there are unserviced customers within his service radius, the master craftsman may take on apprentices and journeymen to service the additional customers up to a fixed limit – perhaps a maximum of four of each, perhaps variable by craft. If the number of customers falls, the master craftsman will first dismiss journeymen, and only in desperate circumstances dismiss apprentices. Every apprentice becomes a journeyman after three years service.

The list of crafts given here is illustrative, not necessarily exhaustive.


As in the real world, aristocracy is essentially a protection racket, and all nobles are originally outlaw leaders who found an area with rich pickings and settled down.

Rank Follower rank Client type Clients protected Trade in market Followers per client

Min Max Min Max Min Max
Bonnet Laird Private Farmer 6 20 0 100 0.25 0.5
Ariston Captain Bonnet Laird 10 30 25 1000 0.5 1
Tyrranos General Ariston 10 unlimited 250 unlimited 0.1 0.5

Every noble establishes a market and, if he employs a chancellor, taxes trade in it. Crafts which 'need a market' can only be established in the vicinity of a market, irrespective of whether there are sufficient customers elsewhere. All non-perishable goods are traded through the markets, and merchants will transfer surpluses between markets if they can make a profit from it.

My world has essentially three ranks of nobility. The title of the lowest rank will probably change to something vaguely italianate. An aristocrat advances to the next rank when either the requisite number of clients become available in the locality to support the next rank, or the trade in his market becomes sufficient to support the next rank.

Obviously when a province has eleven unprotected bonnet lairds, under the rules given above any of them may become the ariston, and essentially it will be the next one to move after the condition becomes true. If the number of available clients drops below the minimum and the market trade also drops below the minimum, the noble sinks to a lower level – in the case of the bonnet laird, to outlaw leader.


The aristocracy is supported by the military. An outlaw becomes a soldier when his leader becomes a noble. Otherwise, vagrants are recruited as soldiers by bonnet lairds or sergeants who have vacancies. Captains are recruited similarly by aristons or generals, and generals are recruited by tyrranos. If the conditions for employment no longer exist, a soldier is allowed a period of unemployment while he lives off savings and finds another employer, but if no employer is found he will eventually become an outlaw (or, if an officer, an outlaw leader). A private is employed by his sergeant or bonnet laird, a sergeant by his captain, a captain by his arison or general, a general by his tyrranos.

Rank Follower rank Followers
Condition New rank

Min Max

Private None 0 0 Battle hardened, unled privates Sergeant
Sergeant Private 5 15 More battle hardened, unled sergeantts Captain
Captain Sergeant 5 15 More battle hardened, unled captains General
General Captain 5 unlimited

Soldiers have no loyalty to their employer's employer.

Thursday 4 July 2013

Genetic buildings

Building selection based on location

The objective of this note is to create a landscape with varied and believable buildings, with the minimum possible data storage per instance.

Like plants, buildings will 'grow' from a seed which has northing and easting attributes. These locate a position on the map. Again, like trees, some aspects of the building type selector are location based. Aspects of the location which are relevant to building type are

  • elevation - derived from the map location by interpolation from grid. The actual interpolation algorithm is probably some form of spline, but in any case it's the same one as for everything else.
  • orientation of slope - derived by taking altitude at four corners of a 100 metre square centred on the seed point, and then taking the highest and lowest of these. If highest is northwest, lowest is southeast, the slope is considered to be oriented southeast; if highest is northwest and lowest southwest, the orientation is considered to be south, and so on. Eight orientation values are sufficient.
  • gradient of slope - derived from the difference in altitude across the same 100 metre square
  • neighbours - number of other buildings in 500 metre square centred on seed point.

The reason orientation is relevant is exactly the same as the reason it's relevant to trees. West facing slopes are assumed wetter (coriolis winds), so grow trees better, so better availability of better quality timber, so a higher probability of timber as a primary building material. But also, in areas of higher rainfall, rain shedding is an important consideration, so a higher value is placed on pitched roofs.

So you have the following general relationships

  • west (or southwest or northwest) facing, moderate gradient, moderate altitude: high probability of timber construction; construction techniques involving large timbers (e.g. cruck frame); greater probability of shingled roofs;
  • west (or southwest or northwest) facing, moderate gradient, higher altitude or northern latitude: high probability of building styles adapted to straight-trunk conifers, e.g. log cabins, stave buildings; greater probability of shingled roofs;
  • east facing, generally: greater probability of flat roofs;
  • steeper gradients: greater probability of stone buildings (steeper gradients = shallower topsoil and greater ease of quarrying = access to stone); greater probability of slate roofs;
  • shallower gradients: greater probability of mud, cobb, brick or wattle-and-daub as building materials; greater probability of thatch or turf roofs;
  • Higher number of neighbours: higher probability of two or more stories;

These factors allow classes of building to be selected. Having got past that point, we need to consider how classes of genetic building can work.

Rectangular genetic buildings

Some genetic buildings will have cells with rectangular plan. This doesn't mean that genetic buildings are required to have rectangular cells, but they provide a starting point for discussion. For a given class of building (for example, timber frame), a number of prototype models of cells exist. These models are fully realised three dimensional models. Possibly all cells belonging to the building class have two open ends, and end walls exist as separate models; equally possibly, some cells have only one extensible end. In any case, a building will not normally comprise a single cell. Normally it will comprise multiple cells. So the cells belonging to a particular building class will be designed to 'plug together'. Multi story building classes will have some cells which are specifically ground floor only (flat ceiling, no roof), and such cells will always have an upper floor cell added above them. Where an upper floor cell has an outside door, an outside stair will automatically be added.

Cell mutability

Although cell models are repeatedly reused they don't have to look the same every time they are reused. Within limits, every cell can be stretched along any of its three axes. Obviously, the degree of stretch on a given axis for every cell in a given building must be the same, otherwise they won't line up. Another mutable area is skinning - it may be possible to have alternate skins for cells, and even if there are not alternate skins, it will be possible to mutably darken, lighten or otherwise tint the skins used, within ranges which are appropriate to the materials represented. Obviously there are limits to stretching - timber comes in only such a length, stone lintels will only support such a span.

Functional cells

Some trade functions require cells of particular kinds. Thus a smith needs a working building with one cell which is explicitly a forge. A water mill must have one cell which explicitly houses the mill gear. A forge cell or a waterwheel cell should never appear in weavers workshop. But most cells are not dedicated in this way. A bedroom cell is a bedroom cell, more or less; wealth may alter how it is furnished, but it may appear in any dwelling. Similarly, except for the very wealthy, a living cell is pretty much a living cell. And any building may incorporate a storage cell. If a given building class has twelve distinct 'generic' cells' and half a dozen distinct functional cells, and if buildings in the class average four cells each, then ignoring variance caused by skin mutability, a street of fifty buildings could have every one different.


It's critical that if a player visits a location, leaves it, and then returns, the buildings should not all have changed. So it must be possible to repeatedly reproduce the building at the location (this, of course, applies to other procedural scene dressing, such as trees, roads, boundaries, bridges and so on). This is possible if a deterministic random number generator is used which is seeded from the latitude and longitude attributes of the seed. Other attributes which should be cached on the seed even though they are determined procedurally when the building is first instantiated include building class, purpose, and wealth. Using these attributes and the deterministic random number generator, the same building can be reproduced on the same site each time it is visited, with a very small amount of data stored.

Buildings will normally be built at the edge of the associated land holding. If an edge of the land holding adjoins a road, then the building will be built with one long side aligned to the road. Otherwise, the building will be built at right angles to the orientation of the slope. The orientation will be 'frozen' once the building has been instantiated and will be cached on the seed.

So, to build a building, use the following algorithm:

Seed the random number generator with latitude and longitude

while ( building value is less than wealth) {
select a cell selected from the building class using the next number from the
random number generator modulo the number of generic cells in the class
if the selected cell is not inappropriate to the building's function {
fit the cell to the building at the point determined by a deterministic algorithm
furnish cell using the random number generator to determine
furnishing types and locations from a selection appropriate to the cell
if the selected cell was not a top story cell {
         add a requirement that the next cell selected must be an upper story cell

Tessellated multi-layer height map

This post describes a method for storing a very large landscape for a game world.
A height map is the conventional method for representing topography in game environments. A height map is essentially a monochrome bitmap in which darker colours represent greater heights. This means the landscape architect can draw it easily in conventional bitmap editing tools, and it’s easy to convert into a three dimensional map which can be rendered, just by drawing vertices between adjacent points in the grid. However, if you use a height map for a game territory, then either you have a fairly constrained territory or else you don’t have much complex topology. I want a territory of at least a million square kilometres - that’s four times the area of Great Britain or three times the area of Germany.

Having topographical features only at the kilometer scale - a one thousand by one thousand array of heights - would produce a wholly unnatural landscape. Having topographical features on the metre scale would produce a much more natural landscape, but at the cost of a million by a million array, which pushes the storage capacity of current generation machines and thus leaves much less storage for the many other things I want to model.

One solution, if a height map is chosen as the preferred representation of topology, is to tessellate the height map. The problem with that is that sooner or later the player is going to think ‘I’ve seen this same landform before somewhere else’.

However, it isn’t necessary to generate the whole map at once, and it isn’t necessary to generate the whole of the visible part of the map at the same resolution. Landscape close to the player’s viewpoint needs to be rendered at full resolution, of course. Landscape further away can be generated at progressively lower resolution: the far blue distance can afford to be generated at a very low resolution.

Stacking tessellations

Suppose one has a height map at the kilometer scale and tessellates onto it, additively, further heightmaps at the hundred metre, ten metre and one metre scales. Suppose each of these heightmaps is one thousand by one thousand. Then the same landform will never repeat, exactly, anywhere on the map, and the perturbations at different scales will make it extremely difficult for the user to recognise the repeating features. The actual height map used at each scale could even be the same height map, meaning that only one thousand-by-thousand array need be stored. 

But equally, not all the maps used even at a given scale need be the same map; provided that the north and south, and east and west, edges match you could use several different maps at each scale, repeating them according to some seeded pseudo-random algorithm, so that each time a user visited the same location he would see the same topography, in exactly the same way as he would see the same buildings and the same vegetation without our needing to store the exact building models or vegetation models between visits.

Drainage and erosion

Additive heightmaps mean that water courses won’t naturally always take the same path across each repetition of the same heightmap at any scale. But watercourses naturally change the landscape; they cut into landforms, eroding their banks. The greater the volume of water and the faster it flows (gradient), the greater the erosion. Furthermore, erosion is modulated by the hardness of the underlying rock. So either a complete watercourse map needs to be computed and stored, obviating the storage benefits of the tessellated height map, or else a water course map must be recomputed at run time for areas in the view of the user. In principle this is possible; in practice it would be necessary to experiment with how compute-intensive this proved to be.


Rain falls primarily on the windward side of high ground. Areas to leeward of high ground see less rainfall, and, broadly, the more high ground there is between the ocean and a given location in the direction of the prevailing wind, the dryer it’s going to be. Large areas of forest perturb this somewhat, but not to a degree I feel I need to worry about.

Either a rainfall map at a kilometre resolution can be hand drawn, or else automatically derived from the kilometre-resolution height map either at compile time or at run time. There’s no point in worrying about rainfall at less than the kilometre scale. Supposing we store eight bits of rainfall information. Then on each ten metre square we drop an amount of rain between 0 and 255 units. These units run downhill from square to square across the one-metre grid, creating a path. as streams converge, nodes on the path will be decorated with a traffic score - the number of units of rain that have passed through that node. That score gives the size of the watercourse at that point. Finally, a set or rules determine how the adjacent height map should be modulated to represent erosion. 

Deriving topography from tessellated height maps

Suppose one said, for simplicity, that each unit on the height map at the one kilometre scale represented ten metres, each unit at the hundred metre scale represented one metre, each unit at the ten metre scale represented ten centimetres and each unit at the metre scale represented  a centimetre; and further suppose we stored our heightmaps at one byte per cell resolution. Then we would have a vertical resolution of 2560 metres + 256 metres + 25.6 metres + 2.56 metres = 2844.16 metres, which is slightly more than three times the height of Mount Everest, which means we certainly have enough vertical resolution. However, it also means that high altitude landscapes would be no more rugged than low altitude landscapes, and, frankly, natural landscapes aren’t like that.

So, suppose instead we convert our values into a 32 bit unsigned integer height value as follows: the byte from the kilometre scale map forms the most significant byte, followed by the byte from the 100 metre scale map, followed by the byte from the ten metre scale map, and last the byte from the metre scale map. That gives us a value between zero and four and a third billion We’d have to divide that number by five thousand to bring it down to a metre scale which gave us the height of Mount Everest, and still we’d have the issue high altitudes would be no more rugged than low altitudes. 

However, if we raise the number we first thought of by a power - say, for convenience, we squared it, although I think it would take some experimentation to discover the exact power which gave the most satisfying landforms, and I’d further hazard a guess that it would be between 1.5 and 1.7 - and then divided the result by a constant to bring it back to plausible values to render, we’d get landscapes that were increasingly rugged with altitude, which is what I want.

Thus to be able to render the topography of a landscape from the viewpoint of the user, you’d compute vertices at metre scale for the cell the user is in and the adjacent cells on each side (so that you don’t need to compute new vertices in a panic when the user crosses a cell boundary). As a background task, you compute at metre scale vertices for cells which the user might visit soon. A ring of cells greater than one cell from the user, but less than about four cells from the user, you compute vertices at ten metre scale only. Beyond about four cells you compute vertices at one hundred metre scale only, and beyond about ten cells you either compute vertices at kilometre scale only, or else you compute flats. Obviously the exact numbers depend a little on the size of the cells, and whether (for rendering purposes) the cells are rectangular or (as I still rather prefer) hexagonal.

Monday 1 July 2013

Turbine economics

Last week I had one of those experiences which felt at the time like small defeats but which actually are steps forward - although not necessarily in the direction I really want to go. Call it a tactical withdrawal. I moved my computer from the Winter Palace up to the Void. In the Void - the huge old cattle shed which forms the hub of our community-that-is-not-a-community - it can use mains power, rather than depending on my wind turbine. Also, it can use the landline broadband, rather than using my satellite connection. The truth is that at this time of year my wind turbine is not generating enough power for my day to day use, and as I am now running low on the money I earned last year and need to start looking for employment again, I need to use my computer (and the Internet) more.

So this is a post about the energy economics of living off grid.

Let's start by saying that electricity isn't necessary for life. It isn't even necessary for a good, comfortable life. Candles, oil lamps and gas lamps all work perfectly well for lighting, although candles aren't particularly bright, and to get a bright light from oil you need some sort of pressure system. All the other things we use electricity for are nice to have, but not necessary. When I lived in the Summer Palace I had none, and when I built the Winter Palace I thought that it would be a long time before I could afford electricity.

But electricity - particularly electric light - is very nice to have. Electric light comes on at the flick of a switch and is a much less significant fire risk than any kind of flame. I greatly enjoy Radio Scotland and Radio 4; my life would be impoverished without them. The condition of my teeth has improved significantly since I started using an electric toothbrush. And so on. Finally, I am something of an Internet junkie - a great deal of my life, particularly of my intellectual life, is lived online. Electricity is very nice to have.

But, here's the rub. All my lights together consume nineteen watts, and they are very rarely all on together. Charging my phone, my my toothbrush, my radio are each small loads - twenty-five watts at the very outside, but probably more like five (yes, I should check this). All these things I can afford.

My wind turbine is rated at 750 watts but only generates this amount in absolutely ideal conditions, which means a steady force four wind. Also, it depends on the wind direction. Here, the prevailing wind is from the southwest, so I have sited my turbine to be in clean wind from the southwest. But because the turbine needs to be reasonably close to the house and the house is in the wood, the turbine is close to the wood; when the wind blows from the north west, the turbine is in turbulent air off the wood and does not run efficiently. Finally, in winds stronger than force six, the turbine automatically shuts down to avoid damage. As the energy of the wind varies with the square of the wind speed, the amount of electricity generated falls off very sharply as the wind drops. My estimate is that the long term average is that my turbine generates less than 10% of its rated output, which is to say I get between 1 and 2 KWh per day.

But my internet connection comes via a satellite, which is about forty thousand kilometres away. To communicate via that satellite I need to shine a light (OK, it's radio frequency not light frequency, but it's effectively the same thing) that's bright enough not only to illuminate it but to be visible to it against all the background clutter of all the other radio emissions from Earth. That costs me 43 watts, and it seems to me that's remarkably efficient. My laptop consumes 45 watts, but currently it's away being repaired. My desktop computer - the one I've moved to the Void - consumes about 250 watts peak and about 180 watts average during normal working. So to do serious work and use the Internet I currently need about 300 watts.

In theory five hours charging at average of 60 watts should give me one hour of use, so in theory you'd think that I'd get about four hours use a day. But it isn't like that. Lead-acid batteries - which is what I use for my power storage - are fairly inefficient, and get more inefficient as they are depleted. Also, in summer, there are many days on which there isn't a great deal of wind and charging is negligeable. Once the big storage battery has been depleted, it takes a very long time to bring it back.

Wind is great in winter to provide power when there isn't much sun, but as soon as I have some spare cash I shall invest in solar panels. For a given rated output solar is now substantially cheaper than wind, and I believe that on long term average solar panels will produce a higher proportion of their rated output.

Finally, because wind turbines have moving parts they require maintenance. My guess (but it is just a guess) is that for similar investment, solar panels have a longer working life expectancy than wind turbines.

In brief, if I was starting again now I would install solar first and wind later. I didn't, because when I first built my house I was very concerned to keep it hidden, and consequently I built it where the sun don't shine; I've now built a wood shed out in my orchard, where it will catch the sun, precisely so I can install solar panels. But even if I had chosen solar panels first, I would still install both, because I believe that they are complimentary: when you have no wind you tend to have more sunlight, when you have less sunlight you tend to have more wind.

Oh, and, if I had a stream of any consequence running through my land, I think I'd prefer a water turbine to either wind or solar - it's more predictable, more continuous, and easier to get at for maintenance.

Having said that, none of these solutions are cheap electricity. To the cost of the turbine or panels must be added the cost of the tower, of the cabling, of the controller, of the battery, of the inverter. The total cost of my installation so far is £4,000. At 1.5KW/h a day and an expected lifetime of ten years, that's around 5.5GWh total, or at least 70 pence per kilowatt hour (more, if I need to do significant maintenance). If you're on grid, you're probably paying about 16 pence per kilowatt hour, or a quarter of what I'm paying. However, going off grid may well be a cheap lifestyle choice over the longer term because it does make you think seriously about the energy you use, and consequently you use less. It's also, arguably, on balance, better for the planet.

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