Croquet Architecture

Islands

An Island is a unit of space. You can link islands using portals; when you walk through a portal, you are moving from one island to another.

The actions within an island occur deterministically; objects within an island are built with both data and code.

The illusion of shared prescence is implemented by replicating both the data and actions of an island on the computers of each participant.

Each client which is participating in a Croquet Island runs a copy of the same code, and maintains the same Island state.

Messages

Croquet is built on Smalltalk, a message passing system. You initiate an action on an object by instructing another object to send a message to it.

In Croquet, messages are timestamped.

The timestamps of messages define an Island's clock; there is no external clocking, and different Islands may run at different speeds.

Message delivery

In Croquet, messages are delivered to all participants in an Island. This ensures that all particpants' Island replicas behave identically.

If a message originates within an Island, then each user's instance of Smalltalk will create the same message and send it to their local instance of the object. Hence, there is no need to replicate such a message, which is "internal" to the Island.

However, if the origin of a message is a Smalltalk object which is not part of the replicated Island, then a copy of the message must be sent to all replicas of the Island.

It is not possible to send a message directly to the local instance of an object in an Island. Instead, Croquet provides a well-defined mechanism which ensures the message is replicated to all participants.

Controllers

The Controller is the interface between the Island-specific replicated computation and the rest of the user's Croquet system.

Each participant has their own instance of a Controller; it is not replicated amongst participants.

Each Controller maintains a time-ordered queue of messages. Identical message ordering ensures that all replicas of an Island are synchronised.

Routers

There is only one instance of a Router amongst all of an Island's participants.

In fact, the Router could even be running on a computer which is not hosting a replica of the Island.

The Router's role is to forward messages to the Controllers of all replicas of a Croquet Island.

When forwarding a message, a Router tags it with both a timestamp and a message number. If the timestamps of two messages are the same, the message numbers are used by the Controllers to ensure identical ordering.

TFarRef

The objects within an Island are not directly visible outside of it. However, an Island may allow specific objects to have messages relayed to them.

A FarRef is a proxy that allows messages to be sent across an Island boundary. Code outside of an Island can only interact with its TFarRefs.

An Island must register a TFarRef for particular objects which are to be externally visible.

This proxy is itself a replicated object; an instance exists within each Island replica.

When a message is sent to a TFarRef, the TFarRef does not forward the message directly to the local instance of the object it is proxying for. If it did so, then other participants would not receive the message.

Instead, when a message is sent to a TFarRef, it forwards it (as a Smalltalk message) to the local Controller, which then forwards it over the network to the Island's Router.