Software internals: floating-point

Integers are the basis for all computer calculation, but they’re not the only kind of numbers out there. Floating-point numbers are just as important when interfacing with the real world. They represent decimals, fractional quantities, anything other than simple whole numbers. But too many programmers use them without understanding them, and that tends to go horribly wrong.

First off, let’s get one link out of the way. What Every Computer Scientist Should Know About Floating-Point Arithmetic describes everything you need in more technical and precise terms than I ever could. It’s a good read, and it’s important stuff, so check it out if you want the gritty details.

Now, we’re fortunate to live in today’s world, because floating-point numbers are essentially standardized. IEEE 754 (along with some later revisions) defines a common floating-point format that’s used pretty much everywhere in modern tech. If it isn’t, then it’s still assumed to be. So we’ll base our discussion on that.

The theory

Floating-point numbers work a bit like scientific notation. In decimal, you can write something like 1.42 × 10^4^, and that’s understood to be the same as 14,200. But computers work in binary, so we need a binary form of scientific notation. In this case, for example, we can write 14,200 in binary as 11011101111000, or 1.1011101111 × 2^13^.

From there, we can create a way of packing this notation into a sequence of bits: floating-point numbers. What do we need? Well, each number can be either positive or negative, so we need some way of showing that. And we’ll have to store both the exponent (e.g, 13) and the mantissa (binary 1.101110111). The base (2, for binary) can be implied, as we know we’re working with binary. Put those three parts—mantissa, exponent, and sign—together, and you’ve got floating-point.

The practice

But it’s not as easy as that, and that’s why we have standards. First, how many bits are you going to use? Too few, and you don’t have much range. Too many, and you waste space on inconsequential fractions. However, sometimes you need those less-significant bits, so you might want to have options. Luckily, the standard gives us two main options: 32 and 64 bits. Unluckily, a lot of programming languages (like JavaScript) limit you to the latter. Some, like C, give you the choice between float and double (the latter meaning “double precision”, because that’s about what you get with more bits), but high-level programmers often don’t have that luxury. Since the “big” high-level languages tend to use 64-bit floating-point, then, we’ll look at it first.

Given our 64 bits, we need to divide them up among our three parts. The sign bit obviously only needs one, so that’s that. Of the remaining 63, the standard devotes 53 to the mantissa and 11 to the exponent. That lets us store binary exponents over 1000 and the equivalent of about 15 digits of precision. Add in a few special tricks (like denormalized numbers), and the total range runs from 10^-308^ to 10^308^. Huge. (32-bit still nets you 7 digits in a range of 10^±38^, which isn’t too shabby.)

Now, those of you better at math may have noticed a calculation error above. That’s intentional. The way IEEE 754 works, it saves a bit by a clever ruse. In decimal scientific notation, as you may know, the number to the left of the decimal point can’t be zero, and it has to be less than 10. (Otherwise, you could shift the point left or right one more spot.) The same is true for binary, but with a binary 10, i.e, 2. But there’s only one binary number that fills that role: 1. With a few exceptions, you’re always going to have the 1, so why bother putting it in?

The problem with this “implied” 1 comes when you have the one number that has no 1 anywhere in it. That, of course, is 0. But it’s okay, because the standard simply makes 0, well, 0. Exponent zero, mantissa zero. Sign…well, that’s different. Standard floating-point representation has two zeroes: negative and positive. They’re treated as equal essentially everywhere, but they do differ in that one sign bit.

The IEEE standard also does an odd thing with its exponents. Except for the case of a literal 0, every exponent is biased. For 64-bit numbers, the number 1023 is added to the exponent, so a number like 2.5 (binary 10.1 or 1.01 × 2^1^) would be stored as if it were 1.01 × 2^1024^. Why? Because it makes sorting and comparison easier, or so they claim.

In the rare event that you go outside the range, you get to infinity. Like zero, we’ve got two forms of that, one for either sign, but they’re considered nearly the same.

And then there’s NaN. This is a special value used mainly to make programmers scream, but it also represents invalid results like dividing by zero or taking the square root of a negative number. NaN is special in that it’s a whole class of values (anything with all bits in the exponent field set to 1), but they’re completely different. NaN equals nothing, not even another NaN. It’s a null value and an error code at the same time, which is where things inevitably go wrong.

Care and feeding

NaN, though, is only one of the pitfalls of using floating-point. You also have to watch out for infinities, since they don’t play nice with finite numbers. Also, unless you have a really good reason for doing so (such as being John Carmack), you probably don’t want to mess with the bits themselves.

More important than knowing how to use floating-point numbers is when to use them. Or, rather, when not to. They do give you precision, often more than you need, but sometimes that’s not enough. Take the classic example of 1/3. In decimal, it’s an endless string of 3s. Binary changes that to a repeating pattern of 01, but the principle is the same. No matter how many digits or bits you’ve got, you’re never getting to the end. So the simple code 1.0 / 3.0 will never give you exactly 1/3. It can’t. The same goes for any other fraction whose denominator isn’t exactly a power of two. So, if you need exact representation of an arbitrary rational number, floating-point won’t help you.

For 1/100, it’s no different, and that’s why floating-point isn’t a great idea for money, either. Sure, for most simple purposes, it’s close enough, but those tiny errors do add up, especially when multiplication and division get involved. If you’re serious about your money, you won’t be storing how much you have in a floating-point number. Instead, you’ll likely want a decimal type, something a lot of business-oriented languages offer.

In the general case, however, floating-point is the solution. You just have to know its limitations.

Social Liberty: Rights and Responsibilities

The following are some of the founding rights of Social Liberty, as set out by the Principle of Initial Conditions. Each is then given its own commentary regarding how it fits within the system and why it was chosen.

Right of Free Expression — All persons have the right to express in spoken, written, and published forms any truthful or opinionated statement not intended to cause direct harm to another, whether alone or with others.

This is a restatement of part of the First Amendment, covering freedom of speech and the press together with the right to assemble. “Direct” harm is intentional: words have no power to physically hurt, but they can incite others to do so.

Right of Faith — All persons have the right to practice their own faith without interference from a citizen or government.

This one covers the Establishment Clause part of the First, as well as most other “freedom of religion” aspects. Note that something like a cult where members are poisoned, or the rape and slavery practiced by ISIS, are not protected under the Right of Faith; allowing those violates the higher Principle of Purpose, as a government must endeavor to keep its citizenry safe.

Right of Arms — All persons are permitted to own and bear personal arms intended for their own defense.

Your basic Second Amendment, but written more clearly. Also, there’s no room for a comma splice to change the meaning.

Right to Privacy — No agent of government may observe or search a person without a warrant obtained under reasonable suspicion that a crime has been committed, nor may an agent of government seize any of a person’s property unless that person has been charged with a crime.

Definition of Agent of Government — An agent of government, in regards to the Right to Privacy, is any person working directly subordinate to the state for purposes of defense, security, or law enforcement, or granted such status by another agent.

Here’s your Fourth, with the usual search-and-seizure stuff. “Observe” includes wiretaps, too, and you can see how it also covers the Third Amendment.

Right to Criminal Trial — A person charged with committing a crime must be allowed a fair trial, by a jury if that person so chooses, without undue delay, and the person must be given sufficient opportunity to present a defense of the charges.

Standard Sixth with this one, plus a requirement that the court allow a proper defense. No “freeze their assets so they can’t pay a lawyer” trickery here.

Right to Civil Trial — When two people are in dispute regarding a debt or infringement of rights, either party may request a judicial hearing or jury trial to settle that dispute.

This one’s the Seventh Amendment, often forgotten in our time of binding arbitration. Arbitration, as a private matter, is not part of Social Liberty. Only the use of it in place of a court is within the government’s purview.

Right to Petition — Any person may petition the government, through a trial by an impartial arbiter or jury of citizens, to redress a perceived violation of that person’s rights.

This one’s actually part of the First Amendment (“petition the government for a redress of grievances”), but it’s put here so it falls with the other “trial” Rights. Effectively, it is the right to sue the government if it is breaching your rights. As with the others, the wronged party has the right to choose a hearing or jury trial.

Right to Freedom of Person — No person may be forced by another to work without proper compensation.

Definition of Proper Compensation — Proper compensation, in regards to the Right to Freedom of Person, consists of monetary pay, tangible benefits, and status or rank as befits the work performed.

Slavery, technically, is forbidden by the Principle of Purpose, but this restates it as a Right, roughly equivalent to the Thirteenth Amendment. The definition also subtly invokes minimum wage, “wage gaps” (via the Principle of Equality), and things like insurance benefits.

Right to Vote — All able citizens are permitted to vote on matters of government representation and public petitions, and no action may be taken by another to deprive a person of this right.

Responsibility Of Voting — An able citizen must vote in representative elections or on balloted matters of local or state import, unless this would cause undue hardship or duress.

Definition of Able Citizen — Regarding the Right to Vote and the Responsibility of Voting, an able citizen is a person above the age of majority who is of sound mind.

Voting rights are mentioned in quite a few amendments to the US Constitution: the 15th, 19th, 24th, and 26th are all concerned with opening up the vote to more people. Social Liberty dispenses with all that; every adult who is capable of doing so not only can vote, but must vote. In other words, it’s more like Australia, where everyone is both automatically registered and required to vote in elections. Also, ballot measures are enshrined here as an important part of the political process.

These are not the only rights granted by the Doctrine of Social Liberty, but they are some of the most notable. For the most part, they flow logically from the Principle of Initial Conditions, sometimes affected by the other Principles. And they are rights that, when stated in this form, should be universally agreed upon. Nothing in them prefers or promotes a specific political agenda, except the general notion of greater liberty for all.

Building aliens: physiology

We’re a few parts into this series now, and we still haven’t discussed what aliens look like! It’s time to remedy that. Here, we’ll look at alien physiology and body structure. From cells to organs to “the surface”, we’ll see what goes into making something seem alien, yet plausible.

On the inside

A lot of the earlier parts go into making aliens. After all, they are organisms evolved in and adapted to a specific environment. That’s going to affect their nature. If you’ve ever watched some of those David Attenborough nature shows, then you probably know this already. Fish that live deep in the ocean tend to be flatter. Desert plants have ways of capturing and storing water. Humans lost most of their body hair, while gaining the larger brains that enable us to write (and read) posts like this.

Physiology, of course, is about more than just appearances. It’s also about how the body works. And that’s a complicated matter. We, as humans, have a bunch of organs, almost all of which have to function just right. Some have redundancy—we can live without one lung, or one kidney. Others, like the heart, brain, or liver, are alone; notice how many of those have extra protection. And then there are a few that don’t really seem to be of any use. We can get by just fine without tonsils, for instance. I do. And the appendix literally does more harm than good, having the sole purpose of occasionally becoming inflamed or worse.

Other complex organisms have organs, too. Some of them have different sets of them. Ruminants (like cows) have multiple stomachs, for example. Birds, being egg-layers, have extra equipment for that purpose. And so on.

But the systems that organs control are fairly general. Those things an organism must do will often have dedicated systems. In addition, there will be a few other “support” systems to make these work. So let’s look at what’s biologically required of us, and we’ll see how that translates to aliens.

Intake

Everything living requires some sort of energy input. For us, that comes in the form of food, water, and air. We need all of these to run the chemical reactions that create life as we know it. So does everything else. Thus, we’ve got a mouth that’s front and center, our universal access point for input. So do most other animals.

Plants are a little different. They don’t need to “eat” in the same way we do. Much of their energy input comes from photosynthesis, a different kind of reaction using sunlight as the power source. But they still require water, and they still need air. (And that includes some oxygen, not just CO2.) So you won’t see plants with mouths, except in the case of carnivorous plants—and most of those instead use a trapping mechanism.

As for aliens, the situation depends on evolutionary history and environment. If your aliens eat and drink, then they’ll have some equivalent to a mouth for that purpose. After the mouth, there’s the digestive tract, where nutrients are extracted from the food. While it won’t necessarily be human-like, it has the same function as ours, so it might be somewhat similar to something on Earth.

Output

Not everything is digestible. The leftovers are mostly useless to us, so there’s no point keeping them around. Thus, our bodies get rid of them, in the form of waste. Animal waste, including human, does have its uses (e.g., as fertilizer or fuel), but it’s mostly just that: waste. Because we don’t want it inside us, we’ve got a system to get it out.

For solid waste, of course, we’ve got a dedicated part of the body. Liquid waste (urine) gets mixed in with other parts, however, in a bit of evolutionary parsimony: we’re not going to use both functions at the same time, so it wouldn’t hurt to let one organ do two unrelated jobs. Other organisms, including aliens, might not do this, which is okay unless you’re really into that sort of thing. Excretory systems, in an advanced, sapient species, may develop cultural taboos, too, but that’s a subject for a later post.

Reproductive

The sole reason to live, from an evolutionary perspective, is to reproduce. At its core, that’s why sex is enjoyable—if we didn’t like it, we wouldn’t do it as much. And so it stands to reason that reproductive organs have a lot of cultural significance attached to them. But they’re also interesting from a biological standpoint.

As stated above, human reproduction overlaps with excretion, but that’s not necessarily a given in aliens. What is, though, is that they’ll reproduce. And it’s likely to be sexual reproduction, not the asexual style used by, say, bacteria. Sexual reproduction requires at least two parents (possibly more, as in the recent news about three-parent IVF), but that gives it the benefit of better genetic mixing. By taking genes from two sources, organisms have a better chance to resist a bad mutation. That’s not the only upside, but it’s one of the biggest.

The internal part of reproduction has its own intricacies. For mammals and many other animals, only one parent actually contains the reproductive machinery. Males can impregnate, but females give birth. It doesn’t have to be this way. Other species on our planet show hermaphroditism (some or all members have both sets of reproductive organs). Another possibility, though harder to make work, is more than two sexes. And then there are odder methods. An alien race could be all females, but some can temporarily express “maleness”. Or the males could carry eggs for a period of time.

Just as important as the organs at work is the way reproduction happens. Are babies born live, as in mammals? Do they hatch from eggs? How many are born at once? For this one, humans are mostly one-at-a-time, but multiple births aren’t exactly rare. Other species, especially those that lay eggs, have larger litters or clutches.

(Oh, and before you ask, it’s astronomically unlikely that we’d be compatible enough with an alien race to reproduce with them. Half-human hybrids, though great for storytelling purposes, are not the hardest of science.)

Senses

Organisms must experience the world around them, if for no other reason than to obtain food and find a mate. For that purpose, we have our senses: sight, smell, taste, touch, hearing. Each one has a use, and each has developed over the ages.

Evolution determines which senses are present. The ecological niche of a species is a good indicator of what its sensory capabilities will be. Cave-dwellers often have poor eyesight—if they even have eyes at all. Carnivores might have heightened senses of smell to track prey, while scavengers may have weakened taste. Here, the best guideline is reasoning: think of what your aliens would need where they live—or, if they’re highly advanced, where they originally came from.

Exotic senses can exist, within reason. Echolocation is popular in Earth animals, especially those without a good sense of sight. An herbivore living in a dangerous area might develop better peripheral vision. Hearing in the infrasonic and ultrasonic is perfectly valid for aliens, as are infrared and ultraviolet sight. Some birds seem to have sensitivity to magnetic fields. About the only things that aren’t possible are those that, well, aren’t possible. Like psionics, or seeing X-rays.

Each sense is going to have at least one organ behind it. We’ve got eyes, ears, the nose, the tongue, and the skin. Others are possible, though. Whiskers, antennae, suckers, tails, and anything you can think of can go towards the sensory system, if you can give it a good reason for being there.

Body plans

The outside of the body—what a species looks like—is probably more important from a storytelling point of view.

We humans have a distinct body symmetry. Left side looks like right, and we’ve got a lot of double organs, like lungs, eyes, and ears. And most animals are the same way. There might be small differences, such as fish with both eyes on the same side of the head, but those tend to be exceptions that prove the rule. This bilateral symmetry isn’t the only option. Starfish, for example, show a radial body plan: arms sticking out from around a center. Many plants aren’t really symmetrical at all, instead opting for a kind of “fractal” body plan.

Another thing we, as animals, have is segmentation. You might recall from science classes long ago that our bodies are divided into three segments: head, thorax, and abdomen. The head is where the brain lies, while the other two make up the body proper. And each of those segments has a pair of limbs (it’s a pair because of that bilateral symmetry). If we had another segment, say between the thorax and abdomen, we might have a second pair of legs (like a centaur) or arms (like Goro from Mortal Kombat). And if we kept growing new end segments as we aged, we’d be literal human centipedes!

Interesting minutiae

That covers the most important parts of an organism’s physical body. There are plenty of other systems (circulatory, nervous, endocrine, etc.) that will likely have counterparts in an alien race, but they follow much the same logic as those mentioned above.

Some other bodily things to think about include:

  • Defenses: Some organisms have evolved methods to defend against predators…or each other. Some plants are poisonous. Many snakes are venomous. Cacti and porcupines are both covered in sharp and pointy armor, while turtles and snails opt instead for hard shells. If your aliens were very recently not near the top of the food chain, then they’ll likely have their own ways of protecting themselves.

  • Pheromones: Human pheromones are mostly mythical, but a lot of animals do have them. They’re used to attract mates, mark territory, or as a further defense mechanism. Aliens could have them, as well, although they likely wouldn’t have any effect on us.

  • Vestigial organs: Evolution rarely discards that which is no longer needed. If it’s not actively harming the reproductive process, it’ll likely stick around far past its expiration date. That’s what happened with the human appendix, and it’s possible for an alien species, too.

  • Blood: It’s a staple of sci-fi that aliens don’t always have red blood. Sometimes, theirs is even toxic to us. Both cases result from using a different chemical mix than our iron-based hemoglobin. So if you’re looking for a hard-science excuse for green blood, that’s where you’ll want to start.

Conclusion

I could go on for hours, but this post is long enough already. Again, the best way to create aliens is to think about them. Environment affects appearance. Ecology matters. Inside and out, an alien race is beholden to its environment. If it isn’t, then it’s only a matter of time before it becomes so. But we, as worldbuilders, can work backwards: make what we want, then create the world to justify it.

The alien lexicon

Alien languages, we can assume, will function more or less like human ones. They may have different sets of sounds, different grammatical rules, but they all have the same purpose: to communicate. It’s really what they communicate about that’s where worldbuilding meets language-building.

Personally, I’m not a big fan of the theories stating that a language influences its speakers’ thoughts to the point where they are unable to understand or even imagine those things the language can’t say. If that were strictly true, loanwords would be all but impossible. No, the brain is more complex than that. We can make new words (or borrow existing ones) for new ideas. That’s kinda the whole point of derivation.

But it’s aliens

Now, when you throw aliens into the mix, things change. Their brains likely won’t work the same way as ours. They’ll still be associative, probably, but the associations they make will be far removed from what we know. So it’s entirely possible that they will have words that literally have no translation into human tongues, and vice versa. Different environments, different evolution, different biology will all play a role in this, so it’s up to you to know how your aliens “work”. Only then can you decide what words they’ll have.

Clearly, any word for a terrestrial species won’t have a direct translation, unless you have some serious backstory going on. (On the other hand, for a fantasy race, such as elves, it’s entirely acceptable and expected that they’ll know the same plants and animals humans do.) But take a step back. Look at the wider world.

Those things not affected by the differing biology of aliens can be relatable. It’s not hard to see that they’d have words for astronomical phenomena (sun, moon, planets, etc., depending on their homeworld’s specifics), though they’ll probably have different cultural connotations. An Earthlike planet, similarly, will have weather—weather much like Earth’s—so there will be an array of weather terms: rain, snow, cloud, wind, and so on. Other things that aren’t tied to the biosphere can also cross this divide: chemical elements, fire, water, mountains, oceans. Essentially anything in the “non-living” sciences works here.

It’s with biology and its subgenres that the real fun begins. Your aliens will have their own names for their own animals, plants, body parts, occupations, and cultural paraphernalia, among other things. Some of these can be related to our own: if an alien calls the part of its body it talks out of a “glorb”, it’s a safe bet you can translate that as “mouth”. Others…not so much. Imagine, for instance, an alien race capable of seeing into the infrared. Those guys will have a whole host of color words that make no sense to us at all. A species of eight-legged bug people might have special names for those extra limbs, but we’d refer to them all as “legs”. If they’re lucky, we might divide them into “forelegs” and “hindlegs”, but we’re not going to recognize the nuances.

Really, designing an alien conlang’s lexicon is more an exercise in defining its culture than anything. In that regard, yes, language influences thought. But from a designer’s perspective, let’s look at it the other way around. How do your aliens think? What makes them special, compared to the humans of Earth? Let those questions, among others, be your guide. Find the ways aliens differ, because that’s where their lexicon will be, well, alien.

First contact

It is easy to go too far here, however. Much of the language will be somewhat compatible with a terrestrial tongue. It may not be exact, but it won’t be too much worse than translating between two wildly different natural languages. Our six thousand get up to some pretty crazy stuff already, especially in the vocabulary department. Even if we don’t have a perfect translation, we’ll figure something out.

If you’re making an alien conlang for a story, it’s almost a certainty that you’ll have some kind of “first contact” situation. There, if the aliens are at all like us, they’ll know to keep things simple. Diplomatically speaking, it’s best to adjust your level of speech to that of your listener, particularly when the wrong word could spark an interstellar war or something of that sort. So you don’t have to go overboard on the “alien words for alien things” bit. Sprinkle in a few words here and there to make them feel otherworldly—names for weapons or lesser alien species are a good choice for this—and call it a day. Everything else will have a reasonable interpretation in English or your natural language of choice.

However you go about it, the lexicon is a great place to really drive home the otherness of an alien race. Most readers and viewers won’t bother figuring out the finer points of grammar or making sense of the strange sounds emanating from alien mouths. The words, by contrast, are right there. They’re front and center, most notably when an alien speaker drops one into casual conversation, like they do in every sci-fi movie or TV show ever. In some cases, that might be your only opportunity to flesh out a culture or world that wouldn’t otherwise get screen time, so take advantage of it.

Free short story: “Miracles”

I’ve told a lot about the writing I do. Now it’s time to show it. “Miracles” is a little story I wrote in March 2015, and I’m posting it here as a free example of my work. Although it’s a little over 11,000 words long, I still consider it a short story.

Set in the 1730s, it’s a brief tale of a young brother and sister, Thomas and Mira, and their flight from England to the American Colonies. Crossing the Atlantic is treacherous, especially for a pair of twelve-year-old orphans, but they have to go. They can’t stay home, but can they outrun the dark secret they share?

Read it now

Continue reading Free short story: “Miracles”

Procedural midpoint displacement

So I’ve been talking in the abstract about procedural generation. Now, let’s get to something solid. In this post, we’ll look at one of the most basic methods of “terrain” generation out there. (I use the scare quotes here for a very good reason, as you’ll soon see.) The technique is called midpoint displacement, and it’s a fairly simple method that can give sensible results…if you know how to use it.

The easiest way to demonstrate the algorithm is in two dimensions. That’s for a couple of reasons. First, lines are easier to visualize than planes in a medium like this. Two, heightmaps take longer to construct, and they’re harder to tweak. So instead of making actual terrain (i.e., an area of simulated land), we’ll make a line-art representation. Think of it as a cross section if you like, or the beginnings of a 2D scroller’s background.

Onto the algorithm itself. You start with a blank surface (a straight, horizontal line, in our case). Take the midpoint of that surface and move it up or down by a small, random amount. Now you’ll have two lines meeting at an angle. That might not look very terrain-like, but, at this stage, it’s not supposed to. The trick with midpoint displacement is that it’s recursive. For each of these line segments, do the same thing as before: move the midpoint by a random amount. Keep going as long as you want, either until you’re bumping up against resolution limits or you reach some predefined level of detail.

The end result is an increasingly “fractalized” line that begins to look less artificial and more like something that could come from natural processes of erosion and the like. The more subdivisions you do, the smoother the finished product will look, like so:

midpoint-displace

The above image shows midpoint displacement, with an increasing number of subdivisions. At the top, we have 1, going up to 10 at the bottom. (Note that these are separately generated images.) By the bottom, we’re starting to see something that doesn’t look too bad. You can go farther in your own code; I used Inkscape just for illustration, and 10 is the highest setting it has.

Using your imagination, you might be able to see how this could be interpreted as terrain. It’s a very rugged terrain, though, and that comes from the other tweakable parameter. Remember how I told you, at each step, to move the midpoint a little in either direction? Well, how far you move it determines how rough the generated terrain becomes. This is the smoothness factor.

In general, midpoint displacement works best if you decrease the range of movement at each subdivision. Otherwise, you get wild swings that don’t look at all natural. The “default” assumption is that each step has half the range as the one before it, but changing the smoothness affects this; smoother generation requires smaller variation.

Interactive tools to visualize midpoint displacement aren’t hard to find, and code samples are almost as easy, so we’ll leave off here for now. Later, we’ll look at expanding this idea to a three-dimensional world, where we can truly see the effect of terrain generation.

Social Liberty: Definitions

First, let us call the fundametnal properties of good government the Principles. These are so central to the idea of Social Liberty that they literally cannot be violated within its framework. A Principle is inviolate by definition, for changing it would change the nature of the space. Principles are thus axiomatic; the six I have chosen define the very concept of Social Liberty.

Second, a Right is a property taken to be inherent to the system. It cannot be abridged, violated, or removed except by another Right or as punishment. Rights in Social Liberty include many of those taken to be inalienable and self-evident, such as freedom of expression, freedom of religion, the right to bear arms, and the right to a trial. A new right can be created, as described by the Principle of Evolution, in a manner dependent upon the system of government.

Third, a Law may be defined as a requirement that must be followed by the citizens of a state. Laws may not be written to directly infringe Rights, but they may define the boundaries of those Rights, and violation of a Law may cause Rights to be lost temporarily. In addition, Laws may be used to clarify cases where two different Rights are in conflict. For example, a Law cannot revoke a Right of Free Speech, but it is allowed to spell out those instances where that Right is overruled by a Right of Privacy.

Fourth, a Responsibility is a duty impressed upon citizens as part of the social contract they form with their government. Laws may bring about Responsibilities, but these may not permanently deprive a citizen of a Right. Responsibilities may also arise logically from Principles; these Responsibilities may violate Laws and limit Rights.

Fifth, a Privilege is subordinate to a Law. It is a lesser right created by the interaction of Laws and Rights, and it may be removed by either. New Rights are rare, but new Privileges may be invented more rapidly, under the Principle of Evolution.

Finally, let us define a Definition as a clarification of the meaning of a word as it is used in the text of a Right, Responsibility, Law, or Privilege.

The Doctrine of Social Liberty is made up of these Principles, Rights, Responsibilities, Laws, and Definitions. They are written in plain language, because understanding the principles of one’s state is necessary for a citizen. Each is given a name for easier reference, as in this example:

Right of Arms — All persons are permitted to own and bear personal arms intended for their own defense.

In later Laws or other text, this can be referred to simply as “the Right of Arms”. For example:

Law of Disallowed Weapons — Any weapon capable of killing multiple people with a single shot, or requiring the operation of more than one person, shall not be considered a personal arm under the Right of Arms.

With these definitions, we are able to construct the structure necessary to create a nation-state that fulfills the goals of Social Liberty.

On ancient times

The medieval era gets a lot of screen time, and for good reason. Medieval Europe has a kind of romantic appeal, with its knights and chivalry and castles, its lack of guns and bombs and cars and planes. It’s our collective nostalgic getaway. Fantasy, of course, revels in the Middle Ages; the “default” fantasy setting is England circa 1200, at the height of the era. But any kind of fiction can take us to medieval times. We have our Game of Thrones and Lord of the Rings, yes, but also our Vikings and The Last Kingdom, our Braveheart and Excalibur.

But what about earlier times? What about the days before the castles and cathedrals were built, before knights wrote their code of chivalry? What about the ancient era?

Defining the ancient

First, let’s define what we mean by “ancient”. We can consider the Middle Ages to end in 1453, with the fall of Constantinople; the refugees fleeing into Europe from that city sparked the Renaissance. The beginning of the era, however, is harder to characterize. That’s mostly because of the Dark Ages, those centuries where nothing much happened. (Except when it did.) Records are fairly scanty in the period before Charlemagne—before about 800—but I think we can all agree that the Roman Empire really was ancient. Thus, the year of its fall in the west, 476 AD, marks a good boundary between the ancient and the medieval.

So we’ll say ancient times ended in 476. When did they begin? That’s a difficult question that gets to the heart of anthropology. Suffice to say, the ancient era began with human civilization. Even if you’d prefer to subdivide (Bronze Age, Classical Era, etc.), its all ancient.

That leaves us with a grand sweep of history, possibly as much as ten thousand years! In our modern, fast-paced world, that seems like an eternity. Indeed, it is a long time, no matter how you look at it, and things changed remarkably from the beginning of the era to the end. Fifth-century Rome was nothing like Homer’s Athens, and neither really resembled Sargon’s Babylon from the eighth century BC, or Middle Kingdom Thebes a millennium before that, or the Stone Age settlement of Çatalhöyük. (Jericho has been occupied almost continuously since the beginning of the ancient era, and you can bet it went through a number of different looks through the ages.)

Writing an ancient-times work requires you to know the period. For the big names—Rome, Greece, Egypt, Mesopotamia—that’s relatively easy. These cultures all left a large body of written knowledge, in addition to easily excavated structures. We know a lot about how they lived, so a writer has more than enough to work with. Lesser-known peoples, such as the Etruscans, Harappans, or Picts, are much harder. Quite a few are only attested in a few sites, and those may be impossible to fully grasp. (On the other hand, that means no one can complain that you screwed up your history!)

The ancient world

Whichever part of Antiquity you choose as your setting, you’ll have to get to know the world. The hardest part is seeing what little you have to work with. Technology, for instance, is such an important part of our times that it’s hard enough to imagine the medieval world, with its lack of…well, everything we take for granted. And ancient times were even worse in that regard. At the earliest, we’re talking about days when the wheel was the height of invention. The reason the Iron Age is called the Iron Age is because it’s defined by the working of iron. For ancient smiths, that was awfully hard as it was; steel was literally impossible.

But the ancients (especially the Romans) made great advances in their own right. Rome, of course, invented concrete, while the Egyptians built the pyramids and the Greeks had all their grand wonders. China built a Great Wall that, like the Maginot Line, never really lived up to its promise. These cultures of old also developed early sciences (the Greeks were pretty good at geometry, as you probably know) and quite a few other things. Our modern legal system also owes a lot to the Roman one, filtered through the Middle Ages though it was.

One part of life rises above everything else in the ancient world: religion. Every ancient culture placed a heavy focus on matters of religion. In fact, it’s often hard to untangle religion from other fields, because it permeated life. Science, government, art, and literature were all tools used for religion’s purposes. And it’s not hard to see why. When the world is so much bigger than you, than anything you know, and when it’s so wild and untamed compared to ours, where can you find any form of safety? Religion was so important that most archaeological sites are practically assumed to be religious in nature until proven otherwise.

Besides the sacred, many other forces worked to shape the ancient world. Remember that we’re dealing with a time before modern industry, but also before the developments of the Middle Ages. People had to look to their basic needs first: food, water, shelter. Survival. Only once they were certain they could survive could they work to thrive. Most people didn’t make it that far, however. Subsistence farming was a way of life. So was hunting and gathering, a practice preserved in only a very few spots today. Only a select few rose above that. True, there were more “middle-class” people in the great cities, particularly towards the end of the era, but urban life was for the 1%.

Travel was hard. Communities were small. People could go their whole lives—much shorter than our own, on average—without leaving their homeland. But that was probably for the best, as danger lurked everywhere. Disease, predators (on two legs or four), war, famine—all these can be subsumed under the one word that best describes the foreign: uncertainty.

The city on the hill

Rome was the big exception to this. Romans made a habit of being worldly, urbane, sophisticated. Their empire, as horrible as we’d consider it today, was the apex of ancient civilization. It removed the uncertainties of life in the era, replacing them with the rule of law, with connections and bureaucracy and, well, government. Earlier cultures built roads to connect towns, but Rome took that to an extreme. Aqueducts existed long before the Appian was built, but we associate these creations with the Romans because they perfected the art through repeated practice.

A story set in Imperial (or even Republican) Rome will still have most of the same aspects as something from earlier Antiquity, but it can also show a different way of life, one which has much more in common with our own. That’s probably why it has some of the best representation in fiction, including:

  • The HBO series Rome (naturally)
  • Shakespeare’s Julius Caesar, required reading for high-school English classes
  • Spartacus, whether in its original movie form or the stylized TV series from a few years ago
  • Ben-Hur, recently remade as a box-office flop
  • Passion of the Christ, because the birth of Christianity came in a corner of the Roman Empire

By contrast, other ancient cultures show up less often in modern media. The Greeks get endless retellings of Alexander, the Iliad, and the wars against the Persians (e.g., 300). Ancient Egypt gets fanciful flicks like Exodus: Gods and Kings and The Scorpion King. Mesopotamia is almost totally limited to Biblical stories such as Noah. (In books, things are a little better, if only because you don’t have to spend money on costumes and set design.)

It’s entirely possible to write a story about the ancient world. It’ll take research and thought, as well as the capability to imagine a time so alien to anything we know. It’s been done before, though, and there are good stories to tell. Not just the Caesars and the Constantines, or Jesus or the Jews. Antiquity comprises an entire world far larger than our own, a world in the process of being formed.