channeld is an open source, light-weight and efficient messaging gateway server designed for distributed game servers (typically MMO) and other backend applications that require real-time, subscription-based user interaction with high concurrency (e.g. instance messenger server).
See the concepts in the design doc.
There are three major types of application benifit from channeld's architecture design:
channeld can be used as the relay server to forward/broadcast messages between game clients.
channeld can be used as the gateway server to route messages to different dedicated servers.
The ultimate purpose of channeld is to enable distributed composition of dedicated servers, together to form a seamless large virtual world.
- Protobuf-based binary protocol over TCP, KCP or WebSocket
- FSM-based message filtering
- Fanout-based data pub/sub of any type defined with Protobuf
- Area of interest management based on channel and data pub/sub
- [WIP] Backend servers load-balancing with auto-scaling
- [WIP] Integration with the mainstream game engines (Unity, Unreal Engine)
channeld is aimmed to support 10Ks connections and 100Ks mps(messages per second) on a single node (uplink + downlink), and 10Ms mps in a distributed system.
Currently, the completeness of the project is 40%.
There is a dedicated roadmap documentation.
Keep in mind that the requirements of the real-life projects will decide the priority of the development.
The fastest way to run the server is with Docker Compose.
There's a docker-compose file set up for running the chat rooms demo. Navigate to the root of the repo and run the command:
docker-compose up chat -d
After starting the server, browse to http://localhost:8080.
Use the input box at the bottom to send messages, to the GLOBAL channel by default. The input box can also be used to send commands, which are started with '/'. The supported commands are:
list [typeFilter] [metadataFilter1],[metadataFilter2],...
// the result format isChannel(<ChannelTypeName> <ChannelId>)
create <channelType> <metadata>
// the channelType is an integer. See the ChannelType enum value defined in the proto fileremove <channelId>
// only the channel creator has the permission to remove the channel.sub <channelId>
// subscribe to the channelunsub <channelId>
// unsubscribe from the channelswitch <channelId>
// switch the active channel. Only the active channel displays the new chat messages.
Follow these steps if the docker image has not been built for the tanks service yet:
- Check out the unity-mirror-channeld repo
- Create the Unity project following the instruction
- Either build the Linux player from Unity Editor (Build -> Linux Server), or via the command:
Unity -batchmode -nographics -projectPath <PATH_TO_YOUR_UNITY_PROJECT> -executeMethod BuildScript.BuildLinuxServer -logFile build.log -quit
. The path to the Unity Editor needs to added to the PATH environment argument in order to run the command. - Build the docker image:
docker build -t channeld/tanks .
Running the Unity tanks demo with Docker is similar to running the chat rooms demo. Navigate to the root of the repo and run the command:
docker-compose up tanks -d
Then you can the play the game in Unity Editor. See the full instruction here.