Thursday 11 October 2012

Consider a Simple Mathematical Process


Consider a simple mathematical process, like an algorithm that generates the digits of Pi. Pi never stops, so in a way, the algorithm provides a window into an arrangement of information that's infinitely long.

Now look at a slightly more complicated process, such as Conway's Game of Life. Much like the Pi-computing algorithm, this is just another mathematical process, but the arrangement of information it describes is somehow richer: the game represents a 2D space evolving over time, with gliders, glider guns generating them, and so on.

What's interesting about both of these is that the "world" defined by the algorithms is in some way independent of actually running the simulation. Two people who calculate Pi will come up with the same answer. You can calculate 1000 digits of Pi and come back half an hour later, and calcluate another 1000 digits, and you'll have the same 2000 digits as someone who did 2000 at once.

Similarly, two people who run Conway's game (from the same starting conditions) will watch the same set of events unfold. Just as with Pi, they can stop the simulation, take a coffee break, and turn it on again, and the world inside continues completely unaware. You can rewind it, run it again, and it's all the same.

So in a way, simulations are a way of exploring a mathematical space. The existence of that space, in some ways at least, is independent of whether and when we explore it. The fact that a certain collision between 13 gliders happens on turn ten billion of a particular game seed is independently discoverable - it's already there, encoded in the rules, awaiting our discovery.

Now consider simulated worlds that are rich enough to develop artificial life, sophisticated enough to be self-aware. (By this, I mean that the simulated beings have an internal model of their world that includes a representation of themselves.) If you're a materialist, I think it's a short step to imagine that such beings could have an experience of themselves that's as rich and as convincing as ours is.

Nevertheless, we could pause that simulation, rewind it, run multiple copies, and none of this would affect the experience of the beings inside, because their experience is wholly encoded in the interplay of information that the simulation rules describe.

Much like the glider collision, or the 100th digit of Pi, their consciousness is already there. Running the simulation just allows us to experience it. Their world is real, to them. Even if we don't run the simulation.

Even if we don't .. invent it?

Now, if we discover that our world is based on a set of principles that could, in theory, be simulated, then what follows is that our world might not be 'real', either. Nobody's running it - nobody needs to!
Maybe somebody is running it, somewhere in another universe, but all that means is that they're exploring part if it. It doesn't mean that they're creating us, just that they know what we're up to (if they've run it this far).

Actually, this line of reasoning pretty much guarantees that an infinite multitude of different meta-worlds are exploring our universe through simulations, as well as all possible other universes, just exploring different parts of it.

Wednesday 19 September 2012

Autocomplete & API Design

Autocomplete Rocks

As an avid Eclipse user, I love auto-complete.  It feels like it's a big, easily overlooked boost to how I program.  Not because it saves a few keystrokes here and there, but because it provides such a boon to explorability of the APIs that I use.  Essentially, I'm querying my programming environment to see what my options are.

Seeing a list of IntelliJ's top 20 auto-complete features, there are some really neat ones - chain completion is particularly cool.  IntelliJ will inspect in-scope variables several levels deep, so it's able to suggest methods of in-scope objects that I hadn't even considered.

Basically, this is a specific, but handy, limited method of querying my codebase/libraries.  I can envision more complicates ones, such as a completion that would help me with that perennial Java I/O plumbing problem of how I get from a FooWriter to a StringInputStream.  Could an IDE make a few suggestions?

Auto what?

I'm also a frequent user of Apache Tapestry, and one of the things that occasionally confounds me about it is that whenever I get rusty with a particular component, I need to look at the documentation to see what I can do with it.

Not docs accessed through my IDE, but actually busting out a web browser, and navigating through some documents meant for humans to read.  Actual essays!

This is because, in Tapestry, you write event handlers by giving an ordinary method a special name:

public void onSelectedFromMyWidget() { ... }

Tapestry uses reflection to make the association between the this method, and the "selected" event thrown by the component with the name 'MyWidget'.

But here the IDE knows nothing about the meaningful names.  There's no object to inspect, no interface that defines all the callback methods.  If I forget that the event type is 'selected' for LinkSubmit components but 'action' for ActionLink components, I have to go to the documentation.  If I don't realize I've misremembered, my event handler simply never gets passed any events.

I recently learned that HLS codes in Emacs, I wonder if this is related!

Sunday 16 September 2012

Bothered About Dungeons & Dragons


The height of the anti-D&D movement of the eighties was a painful time for me; it put several of my friendships on hiatus, and effectively end my close relationship with my best friend of the time.

At the time, I never heard of BADD - this anti D&D sentiment was a vague thing, seemingly fueled by parents' worries and a story about a young D&D fan who killed two young girls in nearby Orangeville. It was on the horizon - mixed up with religious ignorance south of the border.

After a dry spell of a few months, in the company of other friends, I found my way back into gaming - through the Fighting Fantasy RPG (of all things) and back into AD&D with a new group of enthusiasts and new friendships. An unpleasant chapter ended.

15 years later I stumble on this Wikipedia article about Patricia Pulling, the founder of BADD, and the whole thing acquires a much more human face; it's a tragic story, really. Fervently believing that the suicide death of her son was a result of D&D, she sued his school's principal and started her one-woman crusade.

The article goes on to say that although she and BADD gained a fair bit of media coverage through conservative and christian media, all of the lawsuits she initiated or later consulted for failed. Her own book discredited her through factual and mathematical errors, and eventually no less than the CDC concluded there was no link between fantasy gaming and suicide.

I find it very moving to look at this as the story of a mother who can't accept the loss of her son, and what a load of wasted effort and pain she stirred up for others in the process.

"BADD effectively ceased to exist", it concludes, "when Pulling died of cancer in 1997. By this time, BADD had been reduced to Pulling as its sole member." Sad stuff.

Monday 16 July 2012

Burning Wheel

For the record, my favourite role-playing game is Burning Wheel, hands down, mostly because it changed the way I look at RPGs.

The reason for this is that 'the plot' emerges, much of the time, from the players seizing the initiative and pushing towards their characters' written goals (termed 'Beliefs'). Instead of taking a psychologically (and literally) armored, 'survive the adventure' stance, PCs take risks, go out on a limb, pursue their gauche obsessions to accomplish these goals.

The GM's task is to push the central conflict, while at the same time producing character-specific challenges that reveal the characters more fully, giving them hard moral decisions, catch-22 sacrifices, and stirring up deep inner turmoil.

You can do this in any game, of course, but in BW, the reward and advancement mechanics are built around this. There's no XP for the adventure, only for driving toward your characters' goals, and for embodying your character's personal flaws and development in ways that enhance the story.

BW games start with out-of-character collaboration at the table - the group hones in on a central conflict that gets everyone fired up, and then character concepts are hammered out. Off-theme oddballs who are just along for the ride aren't welcome.


Creativity & Spontaneity

Because of this, you do need the right group. Players who want to sit back and be entertained, having their dark and taciturn ranger take potshots from the back - whether because they just can't be bothered or because they're creatively inhibited - will tend to drag things down.

Apart from their goals, the players are given additional tools to have creative input - a Circles ability, which lets them drum up useful contacts from their past (in the way that Han Solo looks up Lando Calrissian), and "wises", which lets them propose world facts.

The GM needs a lot of spontaneity to be able to roll with whatever players come up with, but on the other hand, planning is much simpler since you don't need to produce any more content than interests you (with its accompanying stat blocks, etc.). Preparing 'plot' is counter-productive, and hinders the game.

Apart from pushing the central challenge, the GM's job is to keep the spotlight on the really interesting aspects of the story. Whole months of grinding, travel time, practice montages, investing, keeping up with the bills, all are blinked away neatly.

Shaped by the Story

As I said, you can of course do this sort of thing in any game - the real advantage is that BW is trying to steer you there. One of the clever things about D&D's XP and classes is the way that they insulate the characters from the story. As long as you show up and get your XP from your cousin's mediocre adventure, you get to advance along your pre-chosen archetypal hero's journey - new feats, powers, etc.

In BW, the characters and the story develop in response to one another much more tightly. If you want your paladin steed, wizard's tower, or crazy chain-fighting ability, you're going to have to get it yourself! Characters are profoundly shaped by their experiences.

Social Conflict

The other thing that must be mentioned is Duel of Wits. BW expressly puts the dynamics between characters, PCs included, within the scope of the mechanics. Just as physical combat has detailed mechanics for important conflicts, so does social/verbal conflict.

This gives some people an allergic reaction, because it means that the other people at the table can shape things as intimate as your character's pecking order in the group. Like the other aspects of collaboration in BW, this requires trust and open communication OOC - some people might not enjoy being the group's toady, others might relish it, and this makes all the difference.

What it does do, however, is vastly expand the scope of interesting conflict in the game. You can now have parties that bicker violently but yet never get stalled - they have the conflict and move on (perhaps grumbling resentfully or simmering for a chance to turn the tables, but moving on nevertheless). You can have low-combat games where the grand conflict is a debate with the domineering village priest, who is refusing to authorize badly needed funds from Rome on the grounds that the village isn't pious enough.

Friday 6 July 2012

Coloring your Campaign

How do you come up with interesting elements to add to your campaign world?  A few months ago, I realized that I'd completely neglected to make any mention of animals, despite the whole campaign being set in the wilderness!

I wanted a tool that would help me remember to incorporate these things.  The end result of this little project was this (click to view):
The first version was a fancy series of concentric rings, which you could rotate to generate random combinations.  But printing/assembling was fiddly, rolling dice was easier anyways, and, more subtly, not all of the rings were meant to be used the same way.

This revised version (which I've actually had for a little while now, but never published here) is certainly easier to print, and is hopefully a little easier to use.

The philosophy behind this tool isn't to try to detail every aspect of a region, culture, or an NPC, but to create an interesting spine and then attach other details to it.

Brainstorming Silugan

For example, let's say the players are heading to Far Silugan, a location I haven't thought about much at all.  It's a riverside town at the edge of Keroon City's influence - beyond it are the trackless wastes of the Meer Galu.  That much I know, but what would make it memorable, or interesting?

I'll start with an Aspect of Nature - it seems fitting, because Far Silugan is so far from the city.  Rolling d8, I get 2: Landforms, Terrain, Geology.  (I haven't had my coffee, so nothing is leaping to mind yet.)  Now I'll add a Trend.  7: Upheaval.

Okay, that's interesting.  "Earthquake" is the obvious option, but the river makes me think of catastrophic erosion of a riverbank (possibly undermining important structures).  Maybe a sinkhole?  So, how does this influence the people?

Back to the top, I roll a sphere of human activity: 4 - Games, Play, Fashion.  Huh.  How is this affected by the erosion?  I roll a relation: 6 - Overt Domination Of.  The Games/Play/Fashion result isn't really grabbing me - I'm more interested in the undermined buildings that came to me before.

An emotion might be better: 8 - Celebration!  (Hah.)  Okay, fine, I can take a hint.

Now, how does what's happening present itself?  Nothing matters unless you perceive it.  I roll a sense: 5 - Smell.  Hmm.

Okay, Far Silugan is getting clear in my mind.  I see old, stone buildings, two or three stories mostly, but which have been completely undercut by the rapidly eroding river.  The populace, however, joyfully but steadfastly maintains the ancient arrangement of buildings, which somehow figures in a series of celebrations. The people maintain a laissez-faire, joyful outlook, and those that do not fish, busy themselves with maintaining the stonework.

After centuries of this erosion, the river now passes directly through the town, underneath the central plaza, now a dense arrangement of bridges and covered culverts.  Nevertheless, the erosion continues unabated, and one of the central buildings is expected to collapse any day now.  It is festooned with flags, streamers, and its lower story has been painted with wavy lines, symbolizing the wrinkles of old age.

When it finally does go, it will trigger a month-long celebration, during which the structure will be rebuilt atop new foundations.  The air is thick with the smell from countless fish being smoked in preparation.  Masons pile sand dredged from the river for mortar, while children play in the building's shadow, hoping to win at the game of being the last to touch the building before it falls, while old men pick their teeth, take bets on the falling day, and keep a watchful eye.

Tuesday 26 June 2012

Alignment is Allegiance

Musing about alignment in D&D today, I had a realization.  The very word explains its purpose - who are you aligned with?  When the world is dark, do you stand with good King Osric, or with the forces of chaos?

Once you take this into an environment with plenty of moral gray - in other words, just about every poignant decision in the story - it's just the wrong tool for the job.  Alignment is not about morality, it's about allegiance.

In an urban political campaign, 'good' and 'evil' could be usefully replaced with more relevant alignments, like "Royalist" or "Republican".  It's not about what you should do, but who you're doing it for.

Monday 18 June 2012

Arms Race


Morgan stopped by with a tip about weapons tonight.

"Dad, don't go into battle with a sword that works against your armor.  Your enemies can copy your sword.  Then you get to battle and it's like, da de dah, I'm fine - and everybody's dead, no winner."

"Uh, okay. .. What do you take to battle if your enemies have the same armor you do?"

"Better armor.  (Duh.)"

Thursday 19 April 2012

Brighter than White

Today I came across a really interesting demonstration of how the brain perceives light and color.

In this piece by Deviant Art's algenpfleger, we look directly into the sun, which overpowers the silhouettes of the two figures.

Look at the sun directly:



("Commander's Authority" image copyright Wizards of the Coast.)

I laughed at myself when I realized I was actually squinting! Were you?

My brain was telling me that there was so much light flooding at me from the sun that I should try to cut it down by closing my eyes a little - then, perhaps, I'd be able to make out more details of the hands and jewellery.

Of course, RBG monitors can't display anything brighter than 100% white, it's all an illusion, as is plainly seen when the image is cropped in half.

The blindingly bright whiteness of the sun is no brighter or whiter than the grubby, printer-paper white of my blog.

Tuesday 31 January 2012

You All Meet In A Tavern

Troll in the Corner has a post with five ideas for how to avoid the old cliché of the party meeting up in a tavern for their first adventure.

The Assumption

What's fascinating about all of these is the assumption that the party meets for the first time right as they take up the call to adventure. This assumption so ingrained in D&D culture that it's taken for granted - and yet, narratively, it's so awkward that it practically begs for cliché. With all these people meeting for the first time, a meeting place of strangers is an obvious choice.

So why is this type of start so common? It's baked into the rules of D&D, that's why! Not explicitly, of course, but here's what I mean:

1. D&D encourages individual character-making

To break away from the cliché, you need to have a party premise. The entourage, say, of a wealthy Venetian merchant having a mid-life crisis decides he's going to hire a group of mercenaries to raid Alexandria for the relics of St. Mark and bring them back to Venice. He goes along as expedition captain, leading a mix of fresh recruits and seasoned veterans of wars with Genoa.

But D&D markets adventurer career paths directly to players. Players invest emotionally in working their way up to Duellist or Underdark Assassin long before a particular adventure has been minted, and they're able to do so even if this makes no sense whatsoever in the context of the adventure.

Perhaps it's a maritime campaign in a sea monster-haunted archipelago. You might expect the adventurers to become tanned, salt-stained sailors - but nope! As long as you collect your XP, you can advance along your wish fulfillment career path, utterly untarnished by your actual experiences.

This kind of zero-cooperation concept building is a powerful tool for hooking casual players, or players not really mature enough (or simply not interested in) collaborating creatively. "I'll follow the plot, but keep your hands off my character!"

Of course you can have a party concept, but this runs subtly against the grain; players will need to give up tantalizing options in order to make it happen.

2. D&D encourages niche coverage

With D&D's niche protection, playing a party built around everyone being a mercenary fighter is a sure-fire way of getting your asses handed to you, just as surely as a whole party made of clerics. Parties that cover off all the combat roles are harder to explain, and are self-consciously meta-game tropes. "We need a tank."

Of course you can have a themed party that's missing certain niche roles by design, but this runs against the grain - the DM has to be very mindful of the impact of certain types of encounter, like invisible creatures or a wave of undead, that will be devastating for a party not designed to handle them.

3. The Weirdness of Levels

D&D's nearly linear power advancement makes a wide mix of adventuring levels problematic. Fifth-level fighters are vastly more effective than first-level fighters, so much so that encounters which barely challenge the veterans can be extremely risky for the greener soldiers, who have little to contribute besides serving as a distraction.

This puts tremendous pressure on the party to start out at the same or similar experience levels. Our hypothetical Venetian party, with its wealthy non-combatant leading a group of fifth and second-level fighters, is decidedly unstable in D&D.

Of course, you can do this if the DM is clever enough always to challenge the party appropriately, with mixed-level encounters - or by disengaging from the mechanics to one degree or other (e.g. not using the battle mat for combat, for example). But this takes effort and skill.

4. Missing Social Conflict

Why are the mercenaries following the merchant at all? In D&D, the only meaningful force that constrains players is the threat of injury. Social pressures, particularly between player characters, are non-existent.

Unarmed in this area, the expedition leader is irrelevant. Other than a few gold coins, at a game mechanical level he has nothing meaningful to contribute whatsoever. Who would want to play this character?

Of course, you can play out stories like this in D&D, it's just that they happen without any mechanical support. This can be satisfying, though for a story that focuses on social conflict, mechanics are interesting for the same reasons that combat mechanics are fun.

But free-form social conflict (over, say, the leadership of the party, or the choice of strategy the party takes) carries a few important risks. With no mechanical reason to back down from an argument, in-character argument either escalates to in-character disruption (PC-on-PC violence, or someone storming out of the party) or gets resolved at the player level.

A very collaborative group, all on the same page, may be able to role-play the debate amicably, with one player choosing to have his character 'be convinced'. More often than not, however, the debate rages on interminably, someone gives in reluctantly because of player-level tension: the winning player being more stubborn, persuasive, intimidating, or enjoys a more of the group's support.

In Conclusion

D&D invites players to make a "balanced party" out of thematically unrelated character concepts, all of the same experience level, without meaningful intra-party tension. The leaderless, informally egalitarian troupe of murderhobos is a natural consequence!

Thursday 5 January 2012

Does the Universe Exist?

Here's a thought that boggles my brain from time to time - what if the universe didn't exist. I'm not talking about stuff, like chairs and people and planets. That's a little unusual, but it's not so hard to imagine a universe that's got nothing in it, an infinite void. But that's not what I'm talking about. What if the void didn't exist either? Not only was there nothing, there was nowhere for it to be.

This hurts my head for a while, but then it starts to seem plausible. Unperturbed nothingness seems pretty elegant. Why should there be physical laws at all, let alone arbitrary arrangements of matter and energy? Why does the universe exist at all?

Does it?

Let's assume that physicists eventually come up with a complete description of the universe, a theory of everything. (Not a theory of "everything", including waltzes and parakeets, but a complete description of the root level of reality, the 'building blocks' as it were.)

What's the difference between this set of rules and the actual universe? What gives life to the rules and makes the world they describe real, or is the mere possibility of a universe just as real?

To quote Stephen Hawking:
Even if there is only one possible unified theory, it is just a set of rules and equations. What is it that breathes fire into the equations and makes a universe for them to describe?
What if it's nothing?

Okay, I admit this sounds totally bonkers, but consider the following thought experiment:

Let's assume for the moment that (1) you're a materialist, and you believe that cognition, self-awareness, intelligence, etc. are the output of computations (say) of the human brain.

Let's further assume that (2) we eventually develop artificial intelligence, maybe in a giant Game of Life, maybe some other way.

Unlike a robot brain, the AI we create isn't wired up to perceive the outside world, only events in its own simulated world - in essence, we've created a simulated universe (which may follow different laws than our own). So there's a society of simulated beings all chatting away with one another, or whatever they're doing. These aren't video game characters, mere sprites, these are rich, thinking beings that - when wired up to our world - behave just as richly as humans (though their thought processes and mental architecture might be very different), that just happen to be experiencing a completely virtual world.

Are these beings having a real experience, like we do? It would seem so, following from (1).

If you're still with me, here's where it gets weird. Is their experience somehow reliant on us running the simulation? Does it matter?

At first, it seems so. After all, if we never run the simulation, no experience for them, right?

Consider: if we pause the simulation, wait five minutes, and restart it, they'd never know. All their brains would freeze, along with everything in their little simulated universe, and be restarted, and they'd be none the wiser. In fact, if it's deterministic (like Conway's Game of Life) we could even rewind it a little and replay it. They're still motoring on like nothing had happened. These disturbances don't affect them at all.

In fact, run it backwards for a few years, turn it off, and when we get to the year 2076, start it over from the beginning. They still have no idea.

So it seems to me that the experience of these simulated beings is only loosely connected - if at all - to how and when we run the simulator.

Does it matter if we run it at all? If so, how?

If it doesn't matter if we ever run it, does it matter if we even invent it?

If not, it seems that a whole realm of existence and experience is 'out there', without us lending any energy to it whatsoever.

Back to us. If indeed we can find a simple theory of everything, maybe it's utterly unnecessary for anything to breathe fire into them. Perhaps all of experience is just the interaction between ephemeral possibilities of actuality. The universe doesn't really exist at all!