

Author: Dolfe
ULTRAKILL Multiplayer Utility is a lightweight, Steam-based peer-to-peer (P2P) utility library for creating multiplayer features in ULTRAKILL mods using BepInEx. It provides a high-level interface for lobby creation, network messaging, data synchronization, and designed to reduce boilerplate and the pain of setting up steamworks.
Set lobby settings method
Add documentation for current_lobby
MultiplayerUtil.dll.MultiplayerUtil.dll in the BepInEx/plugins/ directory.MultiplayerUtil.Callbacks.StartupComplete before invoking any Steam functionality.You can easily manage Steam lobbies via static methods under MultiplayerUtil.LobbyManager:
// Create a new public lobby for 4 players
MU.LobbyManager.CreateLobby(
lobbyName: "New lobby",
maxPlayers: 4,
publicLobby: true,
cracked: false,
mods: false,
modIdentifier: ("YourMod", "Tag")
);
// Search for existing lobbies using your identifier
var lobbies = await LobbyManager.FetchLobbies(("YourMod", "Tag"));
// Join a lobby by its ulong ID
LobbyManager.JoinLobbyWithID(lobbyId);
// Disconnect from current lobby
LobbyManager.Disconnect();
MyClass exampleData = new MyClass();
exampleData.playerPos = ...;
LobbyManager.SendData(exampleData, SendMethod.UnreliableNoDelay);
// Make sure your class is System.Serializable
Available send methods:
Unreliable Fast but no guarantee of delivery or order, Ok at what it doesUnreliableNoDelay Very fast, no delay, no guarantee of it arriving or being in order, Good for fast changing data such as player positionsReliable Guaranteed delivery, but not necessarily ordered, Good for one time updatesReliableWithBuffering Reliable and ensures they are sent in the right order, Good for bulk data sendingYou can also:
LobbyManager.SendToLobbyOwner(data, SendMethod.Reliable);
To observe incoming data:
ObserveManager.SubscribeToType(typeof(MyClass), out Callbacks.SenderUnityEvent myEvent);
myEvent.AddListener(payload =>
{
var obj = Data.Deserialize<MyClass>(payload.Item1);
var sender = payload.Item2;
});
Hook into a range of events:
Callbacks.StartupCompleteCallbacks.TimeToSendImportantDataCallbacks.TimeToSendUnimportantDataCallbacks.OnLobbyMemberJoinedCallbacks.OnLobbyMemberLeaveCallbacks.OnChatMessageReceivedCallbacks.OnLobbyCreatedCallbacks.OnLobbyEnteredCallbacks.OnP2PConnectionFailedExample:
Callbacks.OnChatMessageReceived.AddListener(msg => Debug.Log($"Chat: {msg}"));
UnreliableNoDelay for real-time data (e.g., positions).ReliableWithBuffering for sequential state or synced actions.byte, short) when possible to reduce size.Just message me on discord (@dolfelive) or create a issue/pull request
Wifi symbol in icon from wifi by Baboon designs from https://thenounproject.com/browse/icons/term/wifi/ Noun Project (CC BY 3.0)
Dolfe AGPLish License Refer to LICENSE.md