LAN protocol (v4)
Clients find and join a Relioncross server over UDP, one JSON object per datagram (at most 1,200 bytes), tagged by "t". It replaces DirectPlay 8 session enumeration and connect. The shared Rust message types live in the fl-net crate, so the Rustlancer client does not depend on the server.
Messages
| Client sends | Server replies |
|---|---|
{"t":"discover","v":4} (broadcast is fine) | {"t":"info","name","protocol","players","max_players","password_required","tick_hz"} |
{"t":"join","v":4,"name":"Pilot","password":null,"account_password":null} | {"t":"joined","client_id","account_id"} or {"t":"rejected","reason"} |
{"t":"leave"} | {"t":"left"} |
Join rules
- Protocol version must match (
vis 4). A v1, v2 or v3 client is rejected withprotocol version mismatch. Version 3 added chat, and a client that does not knowchat_messagecannot parse it. Version 4 addedaccount_passwordtojoin; it may be left out. - If the server has a password, it must be supplied in
password. - With
auth.provider: accounts, the name must be an account andaccount_passwordmust be that account’s password. A wrong password and an unknown name both getrejectedwithwrong account name or password. With the defaultopenprovider,account_passwordis ignored. See local accounts. - The server must not be full (
server.max_players). - The name is at most 32 characters with no control characters, is passed to the
auth.provider, and must not already be in use (case-insensitive). - Sending
joinagain from an address that already joined returns the same session.
Sessions and rate limits
These need no wire change. The keys are in the configuration reference.
- A session with no valid datagram for
server.session_timeout_secs(default 60) frees its slot. A repeatedjoincounts as a keep-alive and returns the samejoinedreply. - Datagrams over
server.rate_limit_per_sec(default 50 on average, burstserver.rate_limit_burst, default 100) from one address are dropped before parsing, with no reply. - A
joinwith the same name from a new address takes the session back, with the sameclient_id, once the old address has been quiet for 5 seconds. Before that it is rejected withname already in use. The takeover trusts the name alone, so it is for a trusted LAN only.
Characters
After join, a client can list and create characters. Only the account that created a character can select it.
| Client sends | Server replies |
|---|---|
{"t":"characters"} | {"t":"character_list","characters":[{name,ship,system,base,money}],"starts":[{id,base,ship,money}]} |
{"t":"create_character","name":"Trent","start":"new_player"} | The updated character_list, or rejected (invalid or taken name, unknown start). |
{"t":"select","name":"Trent"} | A spawn message (below), or rejected. |
Starting options are read from your game install (DATA/CHARACTERS/newcharacter.ini) together with the ship loadout from DATA/SHIPS/loadouts*.ini. The retail data has one: new_player, a ge_fighter at Li01_01_Base with 2,000 credits and a 16-item loadout. Names are 1–32 characters (letters, digits, space, _-.) and unique across all accounts, ignoring case. Characters are stored as JSON files under <storage.dir>/accounts/. If the game data cannot be loaded the server still runs, with characters disabled.
Spawn message
Server to client, in reply to select, with everything the client needs to render a player appearing. For now every spawn is docked at the character’s start base; the space form is defined for when the server tracks flight.
{"t":"spawn",
"system":"Li01",
"placement":{"kind":"docked","base":"Li01_01_base"},
"ship":"li_fighter",
"equipment":[{"equip":"li_light","hardpoint":"HpLight01"}]}
// or, in space:
"placement":{"kind":"space","position":[x,y,z],
"orientation":[r00,r01,r02, r10,r11,r12, r20,r21,r22]}
Orientation is a row-major 3×3 rotation matrix. ship is an archetype nickname the client resolves through shiparch.ini. A non-empty equipment list overrides the ship’s default loadout, including its lights.
Flight state (v2)
Version 2 adds five messages. A client must select a character first. It stays docked until it sends launch.
| Message | Direction | Meaning |
|---|---|---|
{"t":"launch"} | client to server | Leave the base. Reply: a spawn with a space placement. A repeated launch returns the ship where it is. rejected if the client has not joined or has no character selected. |
{"t":"dock"} | client to server | Return to the base of the selected character. Reply: a docked spawn. The other players get a despawn. The server does not check the distance to the base. |
{"t":"state","seq","position":[x,y,z],"orientation":[9 floats],"velocity":[x,y,z]} | client to server | The ship’s own state. No reply. The server ignores it while docked, when seq is not above the last one it took, or when a number is not finite or is out of range. |
{"t":"snapshot","tick","players":[{"client_id","name","ship","state":{...}}]} | server to client | Every tick: the other players in space in the same system. A list that does not fit in 1,200 bytes spans several datagrams that share one tick. |
{"t":"despawn","client_id"} | server to client | That player left the system: it left, timed out, docked or selected a character again. Drop its ship. |
Units are metres and metres per second. Orientation is the row-major 3×3 matrix used by placement. server.tick_hz (default 10) sets the snapshot rate. A client should send state at about the same rate. UDP can lose a datagram, so each one carries the full state, and the server never acknowledges it.
Not finished. This part of the protocol has not been tried with a real Rustlancer client, and its design is not yet agreed with the client. The server trusts the client’s position and checks no speed, collisions or physics. The launch position is a placeholder near the system origin, because the server does not read base positions yet. Docking is not checked against the position. Positions are not saved: a restart docks every player at their base.
Players and chat (v3)
Version 3 adds one request for the player list and two chat messages. A client must select a character first. Its system is the system of its flight, or of its base while docked. A failure is answered with rejected and a reason.
| Client sends | Server replies |
|---|---|
{"t":"players"} | {"t":"player_list","system","players":[{client_id,name,ship,docked}]}: the other players with a character in the same system, docked or flying, ordered by client_id. snapshot still carries the positions of those in space. |
{"t":"chat","text":"..."} | Nothing on success. Every other player in the same system gets {"t":"chat_message","from","system","private":false,"text"}. The sender gets no echo of its own line. |
{"t":"chat","to":"Name","text":"..."} | Nothing on success. The one player whose character is called Name (case-insensitive), in any system, gets the same chat_message with "private":true. rejected with no such player online if there is none, or if it is the sender. |
from is the character name of the sender. A client must handle chat_message at any time, because the server pushes it when someone chats.
Rules for a line: it is trimmed, must not be empty, must have no control characters, and is at most server.chat_max_len characters (default 200, counted in characters, not bytes). Each session may send server.chat_per_minute lines a minute on average (default 30, 0 turns the limit off) after a burst of 5. A line that breaks a rule is rejected before it uses any of the allowance. The rejection reasons are empty message or control characters, message too long and chat rate limit. The datagram rate limit above still applies to everything.
Not finished. This part has not been tried with a real Rustlancer client. There is no chat history (a client that joins later sees nothing older), no channels other than system and private, no muting and no moderation beyond an operator kicking or banning a player. Chat is not saved, and the text is not filtered.
Client helpers
use fl_net::{discover, join, Message};
let servers = discover("255.255.255.255:2302".parse()?, Duration::from_millis(500))?;
let reply = join(servers[0].0, "Pilot", None, Duration::from_secs(1))?;
Limits
- No encryption or datagram authentication: trusted LAN only. The account password crosses the network in clear text, like the server password.
- No IPv6.
- Game-state messages beyond flight position and chat (combat, trade) are still to come, and the version will be bumped when they change the wire format.
Relioncross is unofficial and not affiliated with Microsoft or the IONCROSS community. It contains no Microsoft or IONCROSS files; bring your own copy of Freelancer.