We're Participating in #Hacktoberfest2024! 🤩 Check out our open issues and help us simplify multiplayer game development!
Docs
Features
Typesafe Functional Programming

Typesafe Functional Programming

Movex is built entirely in Typescript. If you know Redux or the React.useReducer() hook or any flavor of Flux you'll feel right at home.

Purity

The first and most important concept Movex relies on is what in Functional Programming is called "purity".

What this means is that a function called with the same input multiple times must always return the same output. The function becomes pure when it doesn't rely on the context outside of itself such as the global scope, to process its response.

Note: Movex expects the Reducers to be pure functions.

Determinstic Action Propagation

Once the Resource Reducers are pure, Movex takes advantage of that under the hood to ease the network load, by using the method of Determinstic Action Propagation.

What this fancy word means is that instead of sending the whole resource state back and forth, which can be huge, or even just the deltas of an update, which can be many, it simply sends the Action itself from the originating client to the server, to process the master state, and then from the server to the rest of the clients so they can process the next state as well and sync-up.

This is possible, because when the Reducer function is pure we can guarentee that the returned output, from an equivalent input (action and prev state) will be EXACTLY the same accross all the different environments (server and all clients).

You can read more about Authoritative Servers in a Multiplayer Game System here (opens in a new tab) and about Determinstic Propagation here (opens in a new tab).