Frequently Asked Questions

What is Croquet?

Croquet is a software system for creating multiuser digital experiences on the web. It lets you build real time multiuser apps without writing server code, or deploying servers.

How does Croquet work?

When a Croquet app starts, it automatically connects to a nearby cloud-based reflector in our worldwide fleet. The reflector mirrors user inputs to a virtual computer running on each user’s local client. Croquet makes sure these virtual computers stay in bit-identical synchronization. Every user has the same shared experience, even though no central server is coordinating things.

What is a reflector?

A reflector is a special type of public server located in the cloud. It's very simple and lightweight. All it does is forward events from Croquet clients to other clients that are connected to the same multiuser session. Reflectors are completely generic. Any app can use any reflector. This means that it's easy for us to deploy lots of reflectors across the globe, so everyone is close to a low-latency multiuser experience.

Where are reflectors deployed?

Croquet reflectors are currently deployed in data centers on every continent except Africa and Antarctica. We’re also in discussions with telecom providers to deploy them on the 5G edge for even higher performance and lower latency. It’s also possible to deploy site-specific reflectors in places like stadiums or factories for ultra-low latency. Contact Us for more information.

How does an end user launch a Croquet app?

Users can connect instantly to a Croquet multiuser experience without any installation or login. All that’s required is an internet connection, a device with a modern web browser, and the URL to a Croquet session. Sessions can be served from any normal webserver. They can be hosted inside an IFrame on an existing webpage, or shared between mobile devices with QR codes.

How does a developer make a Croquet app?

Sign up as a registered developer here. Once you’re a registered developer you can get a API key to embed in your code that grants access to the reflector network. You can read through the documentation and download the libraries here.

What is the typical latency of a Croquet session?

It varies from client to client, depending on how far they are from the session reflector. Typical roundtrip latency (to the reflector and back) is 20ms for fast connections, and up to 100ms for slow connections. The first user to join a session determines connects to the nearest reflector.

How many users can connect to a single Croquet session?

It depends on how frequently each user interacts. (i.e., sends a message to the reflector.) High-interaction applications can support dozens of simultaneous users per session. Low-interaction applications can support hundreds.

What platforms does Croquet support?

Croquet runs on any platform that has a modern web browser (such as Chrome or Safari) and an internet connection. It works on desktop systems, tablets, and mobile devices, and the same application can run cross-platform on a variety of different devices simultaneously. You can even use your phone as a real-time input device for an app running on your desktop.

What language are Croquet apps written in?

Most Croquet developers use JavaScript or TypeScript; however, the Croquet libraries are also compatible with WebAssembly. For information about other language options, talk to us on our developer Slack.

What is a model/view architecture?

Croquet apps are based on a model/view architecture. The model handles the synchronized simulation, and the view handles input and output. The model is always bit-identical for every client in a session, but the view can be different (for example, if two users are looking at a shared 3D scene from different angles). Because the model is local to the client along with the view, the view can read from it at any time. (It just can’t write directly to it.)

What is speculative execution?

Because the model and the View are both local, the View can speculatively respond to user inputs immediately, and then correct itself later if the model contradicts it. (For example, if two characters in a virtual world collide with each other.) Speculative execution makes apps more responsive. Croquet has no rollback. The model is always the “truth” of the shared experience, and the View references it to determine what to show the user.

What is publish/ subscribe?

Internal communications in a Croquet app are handled with a publish/subscribe mechanism. Objects publish events, and any other object that subscribes to an event will receive it. Events can be passed within the model or the View, or between the model and the View. Events sent from the View to the model go through the reflector to ensure every instance of the model receives the same event stream.

What is a snapshot?

Croquet periodically captures the state of the app’s model and saves it to the cloud. When new users join the same multiuser session, they load the latest snapshot to quickly get synched with everyone else. Snapshots are persistent, so even if everyone leaves and rejoins, the model will still be in the same state. Snapshotting is completely automatic. The developer doesn’t have to do anything to get seamless dynamic joins and session persistence.

How long are snapshots saved for?

Currently, indefinitely. (They don’t take up much storage.) As our client base grows, we will likely impose of cap of six months to a year. Snapshots that haven’t been accessed in that time period will be deleted. If you need longer storage of snapshots, contact us.

Can one slow client ruin the experience for other users in the session?

No. Croquet is not a lock-step system, and fast clients don’t wait for slow clients. The user with the slow client will themselves have a worse experience (a lower frame rate, and less responsive interactions) but the other participants in the session won’t notice any change to their experience.

What is simulation time?

To make sure that Models stay synchronized, Croquet doesn’t make use of normal system time. Instead, it uses simulation time. Simulation time exists only inside the virtual computer. The Croquet reflector sends a steady stream of heartbeat ticks to its clients so that simulation time continues to advance, allowing you to create dynamic simulations that unfold even without user input.

How does Croquet handle randomness?

Croquet Models use their own deterministic procedural random number generator. So even though the model is executing independently on each client, the sequence of random numbers will be the same, and the simulation will stay in sync.

How many dynamic entities can a Croquet simulation contain?

Because model state doesn’t need to be transmitted from a central server, Croquet doesn’t have an upper bound on the number of dynamic entities it can handle. You can easily create a multiuser simulation containing hundreds of dynamic objects. The main upper limit is snapshot size—once the data stored in a snapshot grows to several megabytes, there may be a noticeable hitch when the snapshot is taken.

Is Croquet compatible with other web libraries?

Croquet just handles synchronization. It doesn’t make any assumptions about what other libraries and tools you’re using. Anything that can go in the unsynchronized View is fully compatible with Croquet. However, if you want to integrate outside libraries into the synchronized model, there may be additional work to make sure the outside code is fully deterministic and capable of being snapshotted. For more information, talk to us on our developer Slack.

How does Croquet resolve conflicts? What happens if two users try to do something simultaneously?

The reflector strictly orders the input events coming from every user in the session, so there’s no such thing as “doing something simultaneously”. One user always goes first. Croquet itself doesn’t impose any arbitration scheme for resolving conflicting actions. The right thing to do in any given situation is very context-dependent, so Croquet merely provides an ordered sequence of input events and lets each individual app decide how to handle collisions.

Is Croquet secure?

Croquet fully encrypts all network traffic, including reflector messages and snapshots. And because the reflector doesn’t need to read the messages it’s reflecting, developers can even replace our encryption protocol with their own.

What happens if clients desync?

If a desync happens, it’s a bug. Usually, its because either the View has written directly to the model, or because the model accessed a non-replicated service like local system time. The reflector checks for possible desync events at snapshot time. It compares the snapshots it receives from each client, and if they don’t match, it forces the divergent client to restart the session with the correct snapshot.

How does Croquet handle application updates?

Every client in a Croquet session must be running the same version of model code to guarantee that everyone stays in sync. If an application needs to persist state across a code update, we provide a persistence mechanism in addition to the automatic snapshot.