Common Questions
Is the mod dead?
No. There will be a formal announcement if the mod ever dies. No-progress does not mean the death of the mod. The mod is developed by the community, who all have lives outside of the mod. If you want something in the mod so badly, code it yourself! We accept any constructive PRs.
What happened to Zetrith?
He's around doing his own thing, who knows, he might make an appearance every now and then if we're lucky.
How can players connect?
Players can connect through Steam, LAN, or Direct. To use direct connect, portforward 30502 through UDP or use a VPN like Hamachi.
Installation
The easiest way is from the steam workshop. You can also install it manually by just grabbing the latest release from here and unzipping it into your Rimworld mods folder.
Hosting and Joining
Steam
The easiest way to connect is through Steam. Just host a world with the Steam option checked, and your friends should be able to shift-tab join on you.
Direct Connect or LAN
For direct, portforward UDP 30502 on your local address and give out your public ip to your friends to connect. When hosting the server, just type 0.0.0.0 in the host address box.
Welcome to the Rimworld Multiplayer Wiki.
Discord
Github
Website
Steam Workshop
What is this wiki?
This wiki is in the form of a HackMD book. It is a live edited, community contributable markdown document that is somewhere between a discord conversation and a github wiki. To contribute, you must make an account with hackmd, but you can link your github account and that will work fine.
Introduction
The networking for Rimworld, like networking for many RTS games is done via deterministic lockstep, if you are not familiar with this I suggest looking in here.
Entry Point
The class HostWindow:89 contains the entry point of the mod. It is responsible for creating the Multiplayer menu item, which allows the player to either join an existing game, or host a new game.
Init of MP Menu Item
Create listener to add or update LAN server connections
Create NetManager on port 5100
Foreword
Firstly, I’d just like to clarify that by “handshake” I mean the veritable hailstorm of packets sent between the two instances of Rimworld - which I’ll refer to as the “client” and “server” for the joining player and the hosting player respectively, despite this not being entirely accurate - during the first few seconds of a connection, during which def databases are checked for mismatches, protocol versions are checked, and world data is exchanged.
Initiating the Connection
The client initiates the connection by opening a socket to the server’s port and sending a ClientProtocol packet (ID 0), along with the current network protocol the client is using. The server receives this and checks it against its own protocol version. If the two don’t match, then the client is disconnected with the reason Protocol (1). Otherwise, the server sends back a ServerModList (16) packet with its RimWorld version as a length-prefixed string, and the mods the server is running, in order, as a length-prefixed array of length-prefixed strings.
Defs Check
The client does not do any validation on either of these fields, assuming both the rimworld version and modlist is fine - though it does keep track of them - and in response sends the data needed to validate that the def databases match. This consists of a ClientDefs (1) packet, and along with this it sends the number of DefDatabases registered as well as, for each of these databases, what type it contains (e.g. ThingDef) as a length-prefixed string, followed by a 32-bit integer containing the number of Defs in that database, followed by a 32-bit integer containing the hash of the database.
If the client sends more than 512 database types, it’s disconnected with reason Generic (0)
Compiling
Clone the repo into RimWorld's Mods folder (otherwise reference paths will need fixing)
Run the Multiplayer.csproj file found in the source folder with an IDE and you can just press start to compile it.
Now you can just copy the About, Assemblies, Defs and Languages folders into another folder in the mods folder.
Trouble Compiling?
Ionic.Zip.Reduced might cause problems for some. The proper Nuget package is here.
Debugging
We are using this Github issue to track the languages we have left to localize for. If you know any of these languages well, you can contribute by downloading this file and translating every english phrase between > and < into your language.
When you're done, either make a Github PR for the language or send the translated file to one of the admins and they will review it.
//Someone add a brief description of the MAPI and links to it here. -Swept
Precompiled 0MultiplayerAPI.dll
A Small Example
In this section, we're going to focus on the basics of the api. Specifically, we're going to enable a mod for Multiplayer.
The boilerplate
By the time RimWorld reaches your mod the API is ready to use, you can call it wherever you see fit. See basic C# mod tutorials. The easiest place is [StaticConstructorOnStartup]