ray tracing

When I was just a scamp in my 20s I used to ray trace high resolution (320×200) 24-bit colour depth images on my 286. Don’t panic, I had a 8087 math coprocessor in there so it went super fast. A day or two per image.

Now you might very reasonably wonder what renderer you could get in those dark days in the 80s. What sort of interface would you have available? Surely Blender wasn’t around yet, right? AutoCAD 3D maybe?

In those days we cranked out images with POVRay.

POVRay is what is known as a “constructive solid geometry modeller”. Whereas these days (and even a lot of those days) we render meshes of triangles and use a surface normal function to fake the reflection of light rays into curves (yes, a modern rendered sphere is actually a mult-faceted gem and the renderer lies to you about its smoothness), a constructive solid geometry (CSG from now on) modeller uses primitives like spheres, cones, cylinders, boxes, and toruses that are described by their analog functions. So no impure faceted surfaces (unless you want them). Your light ray returns are pure. You are not being lied to.

The difference to the eye of course is uninteresting. But there’s a lot of joy in purity for some nerds, like me. Hell when gaming I don’t even like the d10 because it’s not a Platonic solid.

But what can you do with such appropriately named “primitives”?

Just about anything, as it turns out (though partially because one of your primitives is a bicubic patch but that’s for another time). The reason you can do plenty is because of the “constructive” part. If you know set theory you probably know what’s coming. Because in addition to placing cubes all over the place, you can perform constructive operations on them.

So, for example, you can take the intersection of two objects — what’s left and therefore rendered is the volume that exists only in both shapes. Or the difference: take a sphere and cut chunks out of it with boxes and cylinders. Or the union of course, just gluing them together. With these functions you can do an enormous amount of work before you even get to the tricks of texturing and colouring and finishing. Here’s what I’m working on right now with what is really the same POVRay I used in 1988.

asymptote small
That Jupiter image is a JPL image enhanced by the amazing Sèan Doran. I licensed it from him for use in Diaspora Anabasis a while ago and it sits nicely here. The ship is from our current Diaspora game — that’s the Cinderella.

That’s still a work in progress, as I say, but largely complete. Just needs some work on lighting and colouring.

But what, you ask, does the interface look like? Is it at least better than Blender?

Well hell yes it is. While there are third party interfaces that glue on to POVRay (which is super easy as you’ll see in a sec), the input into POVRay is a descriptive language. Like my other love, PostScript, POVRay uses a scene description language: you just type your description of the scene into a text file and then drive the renderer over it. Your image falls out the bottom.

That “just” is a little flippant. Here’s the code for the crew module of that ship:

#declare cabin_xlate = -25;


	  merge {
	  	
	     difference {
	       sphere { <0, 0, 0>, 2 scale <2,1,1> translate <cabin_xlate,0,0> }
	       cylinder { <-28,1,1>, <-24,1,1>, 0.3 }
	       cylinder { <-28,-1,1>, <-24,-1,1>, 0.3 }
	       cylinder { <-28,1,-1>, <-24,1,-1>, 0.3 }
	       cylinder { <-28,-1,-1>, <-24,-1,-1>, 0.3 }
	       
	       box { <-23,10,10> <-23.1,-10,-10> }
	       box { <-25,10,10> <-25.2,-10,-10> }
	       box { <-28.5,10,10> <-28.6,-10,-10> }
	     }
	
		difference {
			sphere { <0, 0, 0>, 1.95 scale <2,1,1> translate <cabin_xlate,0,0> }
			cylinder { <-28,1,1>, <-21,1,1>, 0.3 }
	       	cylinder { <-28,-1,1>, <-21,-1,1>, 0.3 }
	       	cylinder { <-28,1,-1>, <-21,1,-1>, 0.3 }
	       	cylinder { <-28,-1,-1>, <-21,-1,-1>, 0.3 }
	       
			texture {
				pigment { Black }
			}
		}
	
		object { plate translate <cabin_xlate,0,0>}
		object { plate rotate <90,0,0> translate <cabin_xlate,0,0>}
		object { ring translate <cabin_xlate,0,0>}
		
	     cylinder { <-25,0,0>, <-24.8,0,0> 2 }
	     cylinder { <-24,0,0>, <-23.8,0,0> 2 }
	     #declare store_texture = texture {
	     			normal { ripples 1 scale 0.2 }
				pigment { color rgb <0.2,0.15,0.1> }
	     			finish {
	     				ambient 0
	     				diffuse 0.2
	     			}
	     		}
	     	#declare fasten_texture = texture {
	     		 pigment { color rgb <.2,.2,.2> } 
	     		 finish {
	     		 	specular 0.8 roughness 0.001
	     		 	reflection { 0.4 metallic }
	     		 }
	     	}	
	     	merge {
	     		sphere { <-20, 0, 1>, 1 texture {store_texture} }
	     		torus { 1, 0.1 translate <-20,0,1> texture {fasten_texture } }
	     		torus { 1, 0.1 translate <-20,0,1> rotate <90,0,0> texture {fasten_texture } }
	     		}
				merge {
	     		sphere { <-20, 0, -1>, 1 texture {store_texture} }
	     		torus { 1, 0.1 translate <-20,0,-1> texture {fasten_texture } }
	     		torus { 1, 0.1 translate <-20,0,-1> rotate <90,0,0> texture {fasten_texture } }
	     		}

				merge {
	     		sphere { <-20, 1, 0>, 1 texture {store_texture} }
	     		torus { 1, 0.1 translate <-20,1,0> texture {fasten_texture}}
	     		torus { 1, 0.1 translate <-20,1,0> rotate <90,0,0> texture {fasten_texture}}
	     		}

				merge {
	     		sphere { <-20, -1, 0>, 1 texture {store_texture} }
	     		torus { 1, 0.1 translate <-20,-1,0> texture {fasten_texture}}
	     		torus { 1, 0.1 translate <-20,-1,0> rotate <90,0,0> texture {fasten_texture}}
	     		}
	
	     	merge {
	        cone { <0,0,0> 0.2 <-40,0,0> 0.001 rotate -45*z rotate 90*x translate <-25,0,0> }
	        cone { <0,0,0> 0.2 <-40,0,0> 0.001 rotate -45*z rotate 180*x translate <-25,0,0> }
	        cone { <0,0,0> 0.2 <-40,0,0> 0.001 rotate -45*z rotate 270*x translate <-25,0,0> }
	        cone { <0,0,0> 0.2 <-40,0,0> 0.001 rotate -45*z rotate 0*x translate <-25,0,0> } 
	
	        texture {
	           pigment { color rgb 0 }
	           finish {
	              ambient 0
	              diffuse 0.2
	              specular 0.9  roughness 0.0001
	              reflection { 0.6 }
	           }
	        }
	     }
	
	     texture {
	        pigment { body_pigment }
	        finish{
	           ambient 0.0
	           diffuse 0.3
	           specular 0.9 roughness 0.001
	           reflection { metallic 0.4 fresnel 1 }
	        }
	     }
	     
	    translate <-4,0,0>
	  }

Yeah okay that makes my “just” seem like a bit of an over-reach. But besides the nerdy joy I experience writing any kind of code, I adore the precision of this: things go exactly where you want them because you tell the machine exactly where it goes. No nudging of objects in the modeller’s mesh preview. No snapping to grids. Everything goes exactly where you say you want it. It gives me a rush every time.

Now I don’t expect anyone else to get off on this, but consider: this renderer I’m running is essentially the same today as it was 34 years ago. A few little features go in as processing improves (though it hasn’t been updated in some time now) but the renderer is basically complete. I can render a file (if I had a floppy disk drive) from 1989 without change. That’s like getting a WordPerfect file to load (and I was TODAY years old when I learned that WordPerfect actually still exists so bad analogy, Brad).

Anyway, I’m not trying to sell you on this dinosaur but rather explain the little joys I get from using it. The naked code, the purity of concept, the precision, and, of course, the nostalgia.

asymptote
Here she is at 320×240 by the way. Some things do get better.

virus

Viruses are amazing.

We tend to break the world into things that are alive and things that are not alive, but the boundary between those two categories is mighty blurry. And the problem is that any definition that includes viruses in the “alive” category probably also includes many substances that are clearly not what we meant. Possibly even things that are not organic. In fact, if a virus is “alive” then your definition of alive probably includes some machines and even software. When we call self-replicating parasitic/malicious software a virus we might be more literal than we intend — the two are really not that different.

t4-trans
Not a Cornavirus. This is a mechanized view (by me!) of a T4 microphage — a virus that eats some kinds of bacteria. Same concept, cooler shape.

So a virus is basically a protective shell with some chemically active locations that contains a bunch of RNA. A kind of incomplete strand of DNA. That RNA is enough information to replicate the virus if you’re near the necessary component molecules and can find some replicating machinery. That is, as a virus, you have the instructions for replicating yourself but no factory. In fact the virus has no metabolism at all — it’s really somewhere between a machine and a highly differentiated chemical compound. It doesn’t breathe, it doesn’t eat, it doesn’t shit. It doesn’t use energy in any complex fashion. It’s just a complicated bit of matter, relatively inert.

But it’s not inert chemically. Its exterior has chemical probes that detect specific locations on its prey and exploit those locations — strictly chemically, mind you, though under a powerful enough microscope the line between chemical and mechanical also gets blurry — to penetrate the prey. This chemistry, once the reactions are complete, also cause the RNA to enter the prey. Let’s stop calling it prey: the prey is a particular kind of cell. Viruses are pretty specific in that there are only a few or even one kind of cell that each is equipped to assault with its chemical boarding grapnels and breaching charges.

Once the RNA is injected, the prey cell does all the work. And again, this is mostly chemistry: RNA reacts with other molecules present in the prey to start and complete a production process. Your own cell’s machinery, which are supposed to be for making more cells, use these alien instructions to make viruses instead. And the instructions for making a virus, this alien RNA, includes the instruction to make more RNA and put that in the new viruses. This is mind-blowing (to me at least) because this is all chemical. It’s just a machine that does what it does and someone slips it a new set of instructions and suddenly the machine is making more instruction-slippers complete with more instructions. But there’s no intent because there’s not even a metabolism let alone a brain or even a nerve. This little monster is a machine. Just a machine.

It’s not even a cell, really. It’s just a box with auto-grapplers and breaching-charge-chemistry, a chemical valve, and a ton of strips of instruction code.

Why does that even hurt you? A couple of things about this attack are a problem for you.

One of course is that energy you spend making viruses is energy you are not spending fixing and reproducing cells that are good for something.

Another is that the empty shells float around in your body and they aren’t supposed to be there. Viruses fill you up with virus-garbage. Imagine you are the sea and virus husks are plastic six-pack holders and shopping bags.

And of course once your immune system figures our there are invaders it starts all the anti-invasion processes, including inflammation, expulsion (coughing, sneezing, puking, and other horrible -ings), and fever. If your immune system is hard at work and the viruses aren’t dying then you are busy spreading the virus uselessly and also being slowly killed by your immune response since you can’t survive a very high fever for long. Your body really hopes the elevated temperature will kill the virus before it kills you. It’s a gamble and the evidence that it usually works is that it’s what we do and we’re not extinct.

COVID-19 likes fairly specific cells in your lungs. Its grappling hooks and breaching charges only work on those cells. That’s why the symptoms are respiratory and specific to the lungs. A cold attacks a more common set of cells throughout your respiratory system including your sinuses which is why those symptoms are broader. Those cells are also more resilient or less necessary than the ones COVID-19 targets. COVID-19 likes cells that are really important for breathing and also really bad when the region is inflamed (since that adds pressure and fluid in your lungs and as anyone who has breathed a beer knows, fluid does not belong in lungs).

But your body does learn to hunt these things. When you recover you don’t recover because the virus is tired — it will replicate, exponentially, until all of your targeted cells are dead from exhaustion if it can. But you build attack cells that can change their chemistry over time until they successfully target and destroy this invader. Once you have a successful breeding pool of attack cells, they hunt and disable the viruses. And your body remembers this, so next time you see the same virus, you are equipped for defense. Unless the virus changes even a fairly small amount, in which case you might have less or even no defense again, just like the first time.

Your attack system is not very responsible though. They just fuck up the attacker and move on. You still have all the virus-garbage to get rid of and so are still to some degree symptomatic until you shed all that garbage.

Viruses are machines. If they were much larger they would literally be mechanical, but at the scale they exist, mechanism is chemistry. But it’s not metabolism and thinking of them as alive blurs categories to the extent that “alive” starts to lose meaning.

We are under attack by a hegemonic self-replicating swarm.

Viruses are science fiction.

rules fluidity in an imagined space

Role-playing games are notorious for rules fluidity: players modify the rules to suit their immediate needs to such an extent that there is often a special rule granting this authority. It may even be a sufficient (though not necessary) feature to categorize something as a role-playing game. I won’t try to sell that point here, but think about it.

So why? Many bemoan this, wanting rules that satisfy all table needs. Many celebrate it, pointing out that this is where the fun is (where the game becomes a game about designing the game you’re playing, which does sound fun).

MapIn general an RPG explores an imaginary space. A space the size of the world or larger sometimes. And the behaviour of this world, no matter how weird, is intuitively understood. We might all understand it slightly differently, but we do have a private understanding. We can easily imagine the way things that are not described in the text would or could work. So the private world of the RPG is effectively as complex as the real world, but it gets explored piecemeal — it doesn’t exist somewhere in whole cloth but rather as you imagine a new part of the space you easily imagine how it must operate.

So now you want rules to govern how this space is explored.

Let’s call the imagined space a BARN.

Let’s call the rules a PAINT BRUSH.

You want to paint the barn. You need to pick a paint brush, The brush, however oddly, must also be fun.

Okay, so you love detail work (a fiddly combat simulator, say, with lots of kinds of polearms meaningfully differentiated). You want to use a double-ought brush. A tiny brush. You can never paint the whole barn with this. That’s fine, you just give permission to the end user to paint whatever bit you left blank however they want. If they enjoy painting, everyone wins. Well everyone who likes detail painting anyway.

But let’s say your goal is to cover the barn. You don’t want to leave any space for the end user to paint. But your imagined space is huge and complex. What are your choices?

You can broaden your brush — abstract your system to the point that you get enough coverage to credibly cover your barn. It might be a little sloppy in places, but you can have a reasonable expectation of coverage. Now your detail painters are still going to get in there with their fine brushes and elaborate and touch up the moulding and so on, but you can’t stop them. You achieved your goal of delivering a painted barn. And depending on how much work you can do you can go anywhere from a 3” brush (pick a system that suits that!) to a paint roller (again I invite you to imagine what game I’m thinking of) to a spray gun. I bet there’s even an experimental explosive painting device out there that paints not only the barn but much of the surrounding countryside.

You can also constrain your barn. This happens a lot in some design spaces: declare we are not going to even think about the barn. We are only interested in the door. Anything outside the door is not part of this project. And then pick a relatively fine brush and paint a perfect door. There are lots of games in this category.

When we say “why are RPGs like this” we aren’t really talking about RPGs. We’re talking about some category of RPG or even some category of player talking about RPGs. And consequently we’re talking about a fairly specific barn/brush case or expectation. But in reality there are many ways to paint that barn, with and without requiring the rules-creative input of the end user. We have to think of handing the end user the brush as an option any RPG should consider — and then accept or reject.

The important thing about game design to me is not doing it one way or another. It’s doing whatever you do deliberately. Everything should be intentional in your text. There may be unanticipated (emergent) properties to the game, but everything you write down should have a goal. Including, possibly, the goal of offering design space to the user.

 

players making shit up

The further your game world drifts from the real, modern world the more you have to let players make shit up.

Here’s my logic.

20180516_171517Universes are crazy big. Douglas Adams tried to tell us how big and didn’t come remotely close. Universes, however, that obey our physical laws at least have a set of truths that you can draw on. A set of premises. How gravity works, how fast light goes, what’s in the periodic table of elements, and stuff like that. And so, as a player, there is a significant fraction of the universe that you can manipulate safely (game-safe I mean). If I see a plausible orbital maneuver in the way the ref has laid out a space, well, I can probably do it. There are touchstones and they are myriad.

I think sometimes we forget just how much shared knowledge we have.

I used to play a lot of games set in my home town of Vancouver. One of the chief advantages to this was the touchstones — you could hide in that place you know, the culvert under the highway up near Kelly’s place — and you weren’t making that up as a player: that place exists. Most of us knew it. Many of us secretly drank there on Friday nights. So most of the play space is known and does not require mediation. It’s just real.

Science, if it works in your game, is like that contextual touchstone but writ large. We all know (and can expect and therefore manipulate) how gravity works, what air pressure does, how things behave at very low or very high temperatures. I don’t need the ref to fabricate any of it and imagine the burden if I did!

Now as you drift from real places in a real universe the amount of information needed to manipulate the environment increases and very very rapidly. There are millions of pages of material written about how this world works. Maybe billions. Your fantasy world, however, has only the tiniest fraction of that content: a practically non-existent amount of material. Frankly no one, even the originator of the fantasy world, knows much of anything about it compared to the content available from the real world.

But you should know. Your character lives in this world and is aware of a similar volume of data that you have by living in the real world. Your character knows about the equivalent of that culvert under the highway and thousands of other truths that know one has every thought to write down or map out. It would be an impossible task.

We mediate this by putting a ref in the hot seat. The fewer the touchstones, however, the more of a burden this becomes on the ref. And the less reasonable it is for them to mediate it — they don’t know either, we’ve just given them the authority to invent it.

I’ll suggest then, that the more your world deviates from reality the more benefit you’ll get from letting players make up their own details. As ref just nod and follow along. If you can’t pre-fabricate all of the details of the world then this will give you two significant advantages: you’ll get a world that’s the product of four or five peoples’ creativity rather than one (it’s nowhere near what went into the real world but it’s five times better than investing the whole problem in one person) and your players will be able to smoothly “recall” facts and even manipulate them without the awkward “was there some place we used to hide as children maybe” — useless roll — “yup there was a culvert under the highway” exchange.

Once you get used to that you can let them manipulate. For example, games rarely if ever examine exactly how magic works (mostly because it always results in contradictions in detail and so it’s best glossed over — magic basically can’t work so don’t look too close). If I’m playing an ancient wizard who’s researched it forever, though, then I expect to have some detailed hypotheses about the underpinnings of magic and a good deal of experimental evidence for it. And I will want to bring that to bear.

img_20170907_133639When I do, I want to imply vast knowledge I don’t actually have. Consequently it’s probably best if I just make it up. “I’ve studied fire magic all my life and I am certain that it is not simply brought into being as that would violate the third law of thaumaturgodynamics. Magical fire must therefore come from somewhere. I postulate that it comes from the plane of Elemental Fire and that therefore it must create a path. I think we should try to track this Efreet by trying to identify this path.” Now I’m not narrating my success, but I am saying a lot of facts about the world that no one ever ever wrote down in advance. Those facts should not be subject to mediation. The ref should greedily note them and start crafting complicated implications. And yet there is resistance to this kind of player participation in world building.

The map of your fantasy world is basically completely empty other than the gross geography. I highly recommend inviting anyone who’s found a blank spot to fill it the fuck out.

formalizing the art of invention

A lot of my refereeing is intuitional. I ad lib. I come up with one idea or image and then follow it around. When this happens in a game it works for me, but one of the things I need to do to make a game work for someone else is formalize these processes. Reveal them to others so they can reproduce them.

The problem is, of course, that I just do it. I don’t have a system.

But this is nonsense — I do it the same way every time. There must be a system. I just haven’t looked at it closely enough. So I’m going to go through a premise and lay out my thought patterns as a hierarchical choice tree. Someone else can use this as a jumping off point for their own exploration of the same premise. For a lot of game design this is the heart of it (for me): watching myself ad lib and then formalizing that.

Premise: you have a space that has not been explored (a slipstream that connects an unknown or forgotten system). You might not be familiar with Diaspora: a slipstream is a wormhole that connects two systems. There aren’t a lot of them — clusters in Diaspora are only a handful of connected systems.

Screenshot 2020-03-02 17.33.09

So in this cluster we have a link from Cando to…what? It starts out unknown! At some point the players are going to want to go there though, so…what’s there? Quick! There’s a session in twenty minutes?

Here’s what I would go through. At the top level, I explore the big questions.

  • Why did no one know about the route before?
  • Who’s there?
  • What’s there?

And then I cascade. For each I ask more questions. And then again. Until I get to some answers. And I might ask more questions.

  • Why did no one know about the route before?
    • It’s new
    • It has been deliberately hidden
    • It recurs
    • It was destroyed but has re-emerged

Once I have a nice set of possibilities, like say:

  • Why did no one know about the route before
    • It’s new
      • Why did it suddenly show up?
        • Local astronomical change
        • Change in the astronomy of the new side
        • New technology reveals it
        • Technology on the other side has suddenly allowed them to visit us
    • It has been deliberately hidden
      • Who hid it?
      • Why?
      • How was it revealed?
    • It recurs
      • When was it last here
      • How do we know that?
      • What causes it to oscillate?
        • Astronomy? Maybe a distant binary?
        • Technology? Did someone or something do this deliberately?
    • It was destroyed but has re-emerged
      • Who destroyed it?
      • How?
      • Why is it back?
      • Is it stable now?

I pick a path. That’s the plan. Here’s the whole tree:

  • Why did no one know about the route before
    • It’s new
      • Why did it suddenly show up?
        • Local astronomical change
        • Change in the astronomy of the new side
        • New technology reveals it
        • Technology on the other side has suddenly allowed them to visit us
    • It has been deliberately hidden
      • Who hid it?
      • Why?
      • How was it revealed?
    • It recurs
      • When was it last here
      • How do we know that?
      • What causes it to oscillate?
        • Astronomy? Maybe a distant binary?
        • Technology? Did someone or something do this deliberately?
    • It was destroyed but has re-emerged
      • Who destroyed it?
      • How?
      • Why is it back?
      • Is it stable now?
  • Who’s there?
    • Are there humans there?
      • Yes: may connect a whole other cluster, different colonist cultures
      • No: did there used to be?
        • Yes: dead failed colony
          • What killed it
          • How long ago
          • Is it still here?
    • No: new territory
      • Intelligence?
        • Yes: aliens, alien cultures
        • No: used to be but no longer
          • Dead civilization
          • Reclaimed by nature or ruined?
        • No: example of pristine location, no penetration by intelligence. What’s awesome? What’s horrible? It has to be DIFFERENT. No one has EVER been here.
  • What’s there
    • Nothing. What the hell? How is there a slipknot to nothing?
    • A normal system
    • A normal system with something anomalous
      • Black hole
      • Neutron star
      • Giant artifact
      • Evidence of ancient civilization
    • A very not normal system
      • Impossible orbital arrangements
      • Planet sized artificial structures
        • Bigger?
      • An artificial star
        • How do we know it’s artificial?

This can be used at two levels. At one level, it’s a thought process you can adopt in its most general form: ask a few big questions, answer them, and let the answers raise more questions. That’s one kind of mind’s tool.

If you are not comfortable with something so unbounded, at least in the context of this game, you can literally use this tree. I only used a fraction of it and even if you pick the same things I did, you probably won’t present them the same way I did. And your players won’t be arriving with the same baggage mine did. It will be different.

And of course this could be further formalized into a randomized oracle.

With the process laid bare, you can choose the level at which you want to ad lib and still benefit from someone having blazed a path for you. Happy trails.

antoine