|
Features

Cyberspace
in the 21st Century
Foundations II
Resource Prudence
Communication channels as our most precious resource. However, whilst
storage and processing are apparently inexhaustible in comparison,
they are still finite. So, as long as it doesn't compromise communication
performance, we should still strive to reduce use of these other resources.
Storage is Finite
While the combined storage of millions of computers may amount to
a lot, we should still contrive to share the storage burden evenly.
This means minimizing unnecessary duplication, and ensuring that stored
representations are fairly compact and high level.
Processing is Finite
Perhaps CPU is the cheapest commodity, but there'll always be extra
fidelity to fill idle hands. We should prioritize our modeling workload,
processing the more important before the less important. For example,
there should be greater fidelity at the player's focus than at their
periphery.
What do we End Up With?
We end up with each computer containing a world database that contains
a portion of the entire world. Just as in any other game, many of
the objects have behaviors, which means processing must be performed
in response to various events. However, in order that each computer
doesn't end up quickly diverging from any kind of agreement with every
other computer's idea of what's going on, there needs to be some kind
of synchronization.
As I said earlier, our approach is to let go of perfection, so perhaps
'synchronization' is too strong a word. I'd suggest that 'consensus'
may be a little more palatable. Consensus means that each computer
needs to participate in a global conversation about a virtual world
in order to reach a continuous agreement as to its current and, to
all intents and purposes, true state.
All computers are peers, there are no oracles, no central servers
that define truth or have direct access to it. We don't have central
servers because they cause bottle-necks and become too costly to maintain
- they're too big for their own boots.
Instead, all computers participate as peers in constructing a virtual
world. There is no absolute truth, no definitive version, merely a
consensual reality. If that's good enough for philosophers in the
real world, it's good enough for players in the virtual world.
The manner of achieving consensus between millions of computers can
be recognized as a distributed system. It's not that there's any inherent
merit in distributed systems per se, whether for massive multiplayer
games or anything else, it's simply that the system design one arrives
at for enabling scalable online games fits the definition of a distributed
system quite well. What exactly are we distributing? We're distributing
information between distributed resources so that agreement can be
maintained. And true to the definition of distributed systems, this
is all done transparently, so that each player can believe that they
have the entire virtual world spinning in a beige box under their
desk.
What to Distribute -- State, Events, Behavior?
What is the consensus about, what is it that we have to agree about?
You might conclude that we just needed to agree about the state of
the virtual world, and everything else falls out of that. But there
are alternatives, and they shouldn't be dismissed out of hand.
There is the matter of that which causes a change in state, and that
which governs the causes. These are 'events' and 'behavior' respectively.
In the real world, behavior is equivalent to the laws of nature and
is hardwired in to the fabric of reality. In the virtual world, behavior
consists of a bunch of rules that are typically represented in a scripting
language of some sort (if it isn't hardwired into the game code -
tut tut) and so becomes part of world state. Events are the causes
of behavior, and so events cause a change in state. Because of this,
events are often interchangeable with the collection of state changes,
i.e. an event is in effect a 'delta'.
There are two approaches to keeping computers in sync, either communicate
state or communicate the changes. There is thus a choice between the
following two items:
-
Communicate state changes and determine events locally
-
Communicate
events and determine state changes locally
The thing
is, state by its very nature contains a snapshot of reality, whereas
events represent changes in reality between one snapshot and the next.
Unfortunately, if you miss an event, it's much worse than if you miss
a snapshot. In order to maintain perfect state, you can't miss out on
any events. If you do, you need to retransmit them (and in the correct
order). This is because events have a context and represent a known
way of transforming state between one version and the next. They also
rely on perfect knowledge of the current state in order to transform
it into the next.
We've opted for the 'best effort' way of working so that means we've
got to tolerate missing information. It's fairly clear, then, that distributing
state is the better road to travel, given that state represents an accumulation
of events. We're also encoding behavior as part of world state as it
needs distributing too. Because
it's part of the state, we don't need to consider it separately.
Distributing
State
Each computer knows its local state perfectly, it just doesn't know
what the consensus of the current global state is. In simple terms,
it needs to compare its state with that of a peer and then receive an
update of the difference. The difference is equivalent to the series
of events that gave rise to it.
Ah, but, reality is a change in state over time, and I haven't catered
for time yet have I? Yes, it's no good to have computers simply converging
to a single steady state, they've got to converge to a state that dynamically
changes over time. For every element of state there is a corresponding
time associated with it, and given the choice between state of one time
and another, we'd presumably overwrite the oldest with the latest. But
how do we know the difference between a locally computed state and a
state locally computed on another computer?
Obtaining Agreement
We have five million computers messing about with their own version
of reality and somehow we're going to get them to come to a consensus.
It doesn't seem sensible to have any kind of argument about it. After
all, how can computers argue? They're all peers anyway. Even if they
could argue, it would be a waste of time that we couldn't afford. It
sounds like some kind of arbitration is required.
Conventionally this arbitration is obtained by having an arbitrating
version of the world located on a server. You tell all the clients "Don't
argue - the server is boss. If you've got different ideas, forget them
and let the server overrule everything you come up with." Of course,
the clients still have to model the world themselves, but defer to the
server whenever they get an update as to the correct state of affairs.
We aren't using the client/server approach, so what do we do? We distribute
it -- just like everything else. We use distributed arbitration. We
analyze the client/server approach and determine the essence of what
enables a server to arbitrate state, but divorced from the co-incidence
that it's all held in one place. The analysis is simply that for all
versions of every item of state, there is a single item version that
represents the one true version, and this one true version happens to
be held by a particular computer. In client/server systems the server
is the 'particular computer' in all cases. However, in a distributed
system, we don't locate these true versions on the same computer, we
distribute them all over the place. So there is still a 'one true version'
of every one thing, but it could be on any computer.
Somehow a computer needs to know whether it's got the one true version,
or whether it's simply guessing at it. In the latter case, it also needs
to know who has got the one true version, and what the latest news is
concerning its value. What we end up distributing is not just 'estimated
state', but also news of the 'true state', with more recent news overwriting
old news.
________________________________________________________
Ownership
|