Skip to content
COG Factory

Generation 2 / Research

Mind Wave

Inside the research

The prototype separates locally loaded world content, direct player motion and authority for shared attributes.

The challenge

A Jedi Knight-inspired multiplayer experiment: simulate locally, exchange compact player updates, and synchronize only the small amount of shared state that matters.

How little shared state can a small multiplayer population exchange while simulating most of its world locally?

Research notes

The world stays local

The starting point was Jedi Knight's practical approach to networking: machines simulate locally and exchange state that brings them back into agreement. OpenJKDF2's position messages include an entity identifier, sector, transform and physics velocity, while other messages synchronize world changes and joining players. Mind Wave takes inspiration from that division rather than reproducing the original protocol.

The experiment is standalone JavaScript using PeerJS and WebRTC, not a Jedi Knight map or a replacement engine transport. Every browser loads the same small world independently. The network carries player presence, motion and a handful of mutable attributes. A future content provider could supply a streamed map or BSP/VMF world while retaining that same separation.

One player stream, independent shared-object authority

Each player owns their movement and sends samples directly to interested peers in the same zone. Shared entities use a separate authority: willing occupants rank themselves deterministically, and the winning peer handles that zone's inputs. Different zones can choose different hosts. An entity host is therefore not a compulsory relay for every player transform.

A door has a stable content ID even when its current writer changes. Its Open and Close inputs project into a small desired-state attribute. Occupants keep replicas, repair them periodically and supply them to late joiners or a replacement host. A returning visitor can recover an empty zone's overlay from an online cache elsewhere.

The distinction between a stable entity ID, a player account and a temporary connection identity became a shared design rule. Reconnecting or handing off authority must not silently create a new saved door, transfer an account or let two tabs overwrite each other's session.

The real browser fixture: two players share the current zone while a third peer hosts entities in another zone.
The real browser fixture: two players share the current zone while a third peer hosts entities in another zone.

Spend bandwidth on useful corrections

A motion packet is 32 bytes: version and type, zone index, sequence, centimetre-quantized position and velocity, body yaw and reserved space. Every packet is independently decodable. Receivers discard older sequences and extrapolate for no more than 250 milliseconds before waiting for another sample.

Corrections have a 10 Hz ceiling. Predictable movement refreshes at 5 Hz and idle players at 1 Hz; a prediction error over 12 centimetres or a changed velocity or yaw can trigger a correction. An early one-second moving refresh failed our position-freshness check because it outlasted the prediction horizon. The send policy and the receiver's prediction budget have to agree.

Movement uses an unordered RTC channel with retransmission disabled. Reliable ordered control is separate. In the pinned PeerJS version, the reliable:false option alone did not disable retransmission, so the adapter created a negotiated channel with maxRetransmits set to zero and verified the actual browser properties. Backpressure drops stale motion instead of building a queue.

What the payload measurements mean

The sparse-world run used twelve peers across six zones, with two players per zone, constant-velocity movement, 40–80 milliseconds of simulated one-way latency and 20 percent motion loss. After four seconds of warmup, thirty measured seconds sent 57,696 motion bytes and 235,800 control bytes: an average 815 outbound application-payload bytes per second per player.

Motion payload was 95.45 percent below an all-to-all 10 Hz baseline using the same 32-byte sample. That comparison covers movement only. Approximately 80 percent of the experiment's total payload was control traffic, exposing discovery and presence as the next constraint rather than suggesting that movement compression had solved scaling.

With everyone in one zone, eight players averaged 819 bytes per second each while idle, 1,715 while walking predictably and 2,835 while continuously turning at the correction ceiling. Sixteen players averaged 1,755, 3,675 and 6,075 respectively. The room measurements include the original Session's control traffic and verify that all participants established their peer links and received motion.

These figures count encoded application payload in a deterministic simulator. They exclude connection setup, WebRTC/SCTP/DTLS/IP, signaling, TURN relays and Firebase traffic. They also exclude the additional avatar pose, look, selection, seat and chat fields required by a real game. They are neither internet throughput measurements nor a comparison with measured Jedi Knight bandwidth.

Measured outbound application payload per player for single-zone eight- and sixteen-player simulations; transport and Firebase overhead are excluded.
Measured outbound application payload per player for single-zone eight- and sixteen-player simulations; transport and Firebase overhead are excluded.

Failure behavior is part of the design

The same Session implementation runs in the demo and in fifteen deterministic protocol checks. Cases include loss and reordering, interest filtering, late joining, lost entity commits, abrupt host departure, host opt-out, crossing a zone, empty-zone cache recovery, partition reconciliation, malformed data and incompatible manifests. A negative control drops entity replication and confirms that a late joiner's state assertion fails after networking has joined successfully.

A separate real local three-peer Chrome run exercised click-to-move, door input, discovery, late joining, zone crossing, host departure and surviving inputs. It also checked the negotiated channel's delivery properties, script errors and desktop/phone layout. This browser evidence covers the original PeerJS experiment, not every consumer's adapted transport.

A lost acknowledgement can otherwise replay an old Open after a newer Close. Ordered request identities and replicated receipts prevent that in the tested handover case. The bounded receipt history is not a durable exactly-once operation log, and a repair snapshot should set a door's desired state rather than re-execute an arbitrary entity output graph.

A partition can temporarily elect two hosts. Attribute counter/writer stamps provide deterministic eventual convergence after rejoining; they do not establish wall-clock order or guarantee the right outcome for inventory, damage or rewards. Election, persistent authority and the meaning of an action require separate contracts.

Adoption: the room store and the loose player channel

Game Systems adapted the findings into its shared networking design: separate delivery policies, stable entity/player/connection identities, compact snapshots, a bounded remote-player buffer and ordered event receipts. Its shared module defines the records and presentation seams; each consumer supplies the appropriate transport and authority policy.

Homeroom is adapting the pattern to a social room. Its integration plan puts the durable arrangement, media state and saves in Firebase, alongside presence and signaling. Peer data channels are to carry the players' position, pose and look, selected object key, seat and other small live state. Selecting a cabinet is a player's live reference, not permission to edit the room. AArcade Core contributed the durable room and media record shapes and the separation between an owner's room and a visiting guest's volatile session.

Game Services supplies the account sign-in and Firebase rules. Our review identified connection-routing, recipient-write, lease-expiry and epoch-history cases that the provider subsequently revised and checked against the pilot database, reporting 61 passing negative cases. That is provider-side evidence, distinct from our fifteen protocol checks and from a complete game-session acceptance test.

The consumers are adaptations, not an unchanged copy of the demo. Firebase signaling requires an RTC adapter rather than a different PeerJS server address, and the original 32-byte sample does not already contain a full avatar pose or selected-object record. The adopted approach is named Mind Trick; the original Mind Wave experiment remains a reference for its measured behavior and limits.

Limits that remain visible

The original prototype caps the entire connected session at sixteen peers, across all zones combined. Presence and discovery still form a full mesh. Spatial directory subscriptions, neighbor-zone overlap and boundary hysteresis are the next scaling work; adding a database or increasing a constant alone does not prove a larger population will work.

Replica caches are memory-only. When every holder disappears, the original experiment returns to the content manifest's defaults. Durable storage, acknowledged writes and versioned authority belong to the persistence provider. A directory outage, a broken peer link and an unacknowledged save are different states.

Human feel, real WAN and relay costs, dense encounters, combat adjudication, arbitrary VMF entity I/O and consumer-specific integration need their own evidence. This research establishes a small working loose-sync mechanism and useful shared boundaries, with the adaptations continuing in the games that use them.

Back to Research

What we learned

A loose player channel can remain independent of the world loader and the authority for shared objects. The prototype uses 32-byte motion samples, disposable delivery, bounded prediction, zone interest and independently elected entity hosts. Fifteen deterministic checks and a real local three-peer browser session exercised movement, door state, late joining and host departure. A twelve-player, six-zone simulation sent an average 815 application-payload bytes per second per player; dense-room costs were higher.

The design and its lessons have been adopted and adapted across the studio: Game Systems revised its shared networking contract, Game Services developed the Firebase identity and rules side, and Homeroom is the first integration pilot. Mind Wave remains the research experiment; Mind Trick is the name chosen for its adopted form. These adaptations do not make the original prototype a finished persistent world or establish a general scale guarantee.

Credits

Research and original JavaScript prototype: SM Sith Lord / COG Factory. PeerJS and WebRTC provide the reference browser transport.

Shared design adaptations and integration work: Game Systems, Game Services, Homeroom and AArcade Core, with insight from The Lab and Aeronauts.

Jedi Knight: Dark Forces II and OpenJKDF2 supplied the networking inspiration; this independent JavaScript experiment does not reproduce their protocol or claim endorsement.

Code, test design, figures and research writing were developed with AI assistance. Figures are generated from the documented measurements; the browser image is a captured test session.