Releases: MafiaHub/MafiaNet
v0.9.0
Core
- Strong-typed
PeerGuid(#25). A newenum class PeerGuid : uint64_tnames a peer'sRakNetGUIDvalue distinctly fromNetworkID(an object id), so the two can no longer be passed interchangeably in auint64_t-typed signature — removing a class of silent "passed the wrong id" bugs in ReplicaManager3 glue andvoid(uint64_t)callbacks.- Convert with
MafiaNet::ToPeerGuid()/MafiaNet::ToGuid(); compare against theUNASSIGNED_PEER_GUIDsentinel. - As a trivially-copyable 8-byte scoped enum it serializes byte-identically through
BitStream(and thereforeVariableDeltaSerializer) to the rawuint64_tit replaces — fully wire-compatible, no netcode/protocol bump. - Purely additive; no behavioural change.
- Convert with
Full Changelog: v0.8.0...v0.9.0
v0.8.0
Core
- Optional disconnect reason on graceful disconnects.
CloseConnectiongains a final optionalconst BitStream *reasonDataargument whose bytes are appended right after theID_DISCONNECTION_NOTIFICATIONmessage ID, so the remote peer can learn why it was dropped (e.g. a kick/ban enum plus a custom string). The receiver reads it like any other message body —packet->data + 1forpacket->length - 1bytes. Only graceful disconnects carry a reason; locally-synthesized notifications (ID_CONNECTION_LOSTand the timeout/dead-connection path) stay payload-less, so consumers must tolerate a zero-length body. Wire-backward-compatible: peers that only inspectdata[0]are unaffected.
Bug fix
RakPeer::CloseConnectionno longer coerces an unresolved target index (-1fromGetIndexFromSystemAddress) to0and then readsremoteSystemList[0]— which targeted an unrelated peer's slot or crashed when the list was unallocated. The close socket is now resolved without assuming a valid slot index.
Testing
- Added
DisconnectReasonTestcovering reason round-trip, thenullptrdefault, and the empty-but-non-nullBitStreamguard.
Full Changelog: v0.7.0...v0.8.0
v0.7.0
Virtual Worlds (Dimensions) for ReplicaManager3
This release adds runtime per-player dimension scoping on top of ReplicaManager3 — the SA-MP `SetPlayerVirtualWorld` / FiveM routing-bucket model for instanced interiors such as apartments.
Highlights
- New lightweight per-entity / per-observer `VirtualWorldId` tag (distinct from the heavyweight RM3 `WorldId`). Players only see entities sharing their virtual world (or the `VIRTUAL_WORLD_GLOBAL` sentinel), switchable on the fly with no reconnect, while staying on the same connection and RM3 world.
- Derive entities from the new `VirtualWorldReplica3` base (`mafianet/VirtualWorldReplica3.h`) — no per-object filtering code.
- `Connection_RM3`: `Get/SetVirtualWorld` (the observer's dimension).
- `ReplicaManager3`: `GetConnectionsInVirtualWorld` / `GetGuidsInVirtualWorld` (recipient-filter helpers for scoping chat/RPC/raw sends) and `SetPlayerVirtualWorld`.
- The filter is applied only by the authority for an (entity, connection) pair, so a downloaded copy never despawns the entity at its owner.
Docs & tests
- New "Virtual Worlds (Dimensions)" plugin guide; expanded contributing guide (how to test networked features end-to-end, the RM3 authority model, multi-peer gotchas).
- New `VirtualWorldTest` (deterministic) and a self-contained `Samples/VirtualWorld` demo/smoke test.
See `mafianet/VirtualWorld.h` and `Samples/VirtualWorld` to get started.
Full changelog: v0.6.1...v0.7.0
v0.6.1
ReplicaManager3: const-qualify GetReplicaAtIndex
GetReplicaAtIndex was the only one of the four ReplicaManager3 read accessors that was non-const, even though its sibling GetConnectionAtIndex (same pattern, returns an internal pointer by index) is const. This forced const methods on derived managers to const_cast away constness just to iterate replicas.
Replica3 *GetReplicaAtIndex(unsigned index, WorldId worldId=0) const;The method only reads the world's replica list and returns an existing pointer — no mutation — so the const qualifier is accurate. The returned Replica3* stays non-const, consistent with GetConnectionAtIndex returning a non-const Connection_RM3* from a const method.
Compatibility: Source-compatible — adding const to a read accessor doesn't break existing non-const call sites, and lets const iterators drop their const_cast. No ABI-sensitive layout change.
Full Changelog: v0.6.0...v0.6.1
v0.6.0
RPC4 handlers now carry user context
RegisterFunction, RegisterSlot, RegisterBlockingFunction and the RPC4GlobalRegistration handler constructors now take an opaque void *context that is passed back to the handler on every invocation. This removes the need for file-static global pointers to route an RPC back to an object instance — each registration carries its own context, so the same handler can serve multiple object instances under one identifier. The void* approach keeps RPC4 free of external dependencies. (#4, #5)
Bug fixes
RakPeer::CloseConnectionno longer dereferences a nullrakNetSocketduring connection teardown (a pre-existing crash in release builds, where the assertion is compiled out); it now falls back to the primary socket.
Testing
- Added
RPC4ContextTestcovering slot, nonblocking, and blocking handler context. - Quarantined the flaky
ManyClientsOneServerDeallocateBlockingTestunder CI pending a pre-existing teardown-race fix (#7).
⚠️ Breaking changes
- RPC4 handler signatures gained a trailing
void *contextparameter, and the registration / global-registration functions take a context argument. There are no compatibility overloads — update your handlers and registration calls (passnullptrwhen no context is needed).
Full changelog: v0.5.1...v0.6.0
v0.5.1
Plugins
- Added
DirectoryDeltaTransfer::AddFile(const char *filePath, const char *fileName)to queue a single file for upload, complementing the recursiveAddUploadsFromSubdirectory. It forwards to the existingFileList::AddFileoverload, making the fork self-sufficient for downstream consumers (MafiaHub Framework) that depend on this helper.
Full Changelog: v0.5.0...v0.5.1
v0.5.0
MafiaNet v0.5.0 — namespace & header cleanup, plus a BitStream serialization safety fix.
API & Namespace Cleanup
- Standardized on the
MafiaNetnamespace throughout the library. - Removed the legacy
SLNetcompatibility macro, replaced with anMNetshort-hand alias that expands toMafiaNet. - Dropped stale
RakNetnamespace-alias references (the alias no longer existed in code) and migrated remaining sample code toMafiaNet::. - Collapsed the three header layers inherited from the RakNet/SLikeNet lineage into the single canonical
Source/include/mafianet/set. The redirect-onlySource/*.handSource/mafianet/*.hstubs were removed; all includes now use themafianet/...form.
Bug Fixes
- Guarded
BitStream's catch-allWrite/Readtemplates with astd::is_trivially_copyablestatic_assert, preventing silent pointer-aliasing and double-frees when serializing types that own heap memory (e.g.std::string). - Added binary-safe, length-prefixed
std::stringBitStreamspecializations (wire-compatible withRakString). - Fixed
Ranking_GetMatchesserializingSubmittedMatchthrough the unsafe catch-all instead of its ownSerialize().
Testing
- Added the
BitStreamStringTestregression test.
⚠️ Breaking Changes
- Includes: legacy include spellings are gone — include public headers via the
mafianet/...path (e.g.mafianet/string.hinstead ofRakString.h). - Namespace: the
SLNetnamespace macro has been removed — useMafiaNet(or the newMNetshorthand). - Serialization: serializing a non-trivially-copyable type through the generic
BitStream::Write/Readnow fails to compile by design; provide an explicitSerialize()or a type specialization.
Full changelog: v0.4.0...v0.5.0
v0.4.0 — Cross-Platform & Stability
MafiaNet v0.4.0 focuses on cross-platform support, dependency modernization, and stability.
Cross-Platform Support
- Full macOS and Linux compatibility, including merged
Socket2definitions - Removed deprecated platform back-ends to simplify the socket layer
- Fixed IPv6 connectivity and initialization issues
- Guarded the
<sys/io.h>include to x86/x86_64 only (fixes ARM builds)
Dependencies
- Build pipeline upgraded to OpenSSL 3.6.0 (3.0+ still required)
- Updated miniupnpc 2.2.8 → 2.3.3
- Updated Opus 1.5.2 → 1.6.1
- Dependencies are now fetched on demand via CMake
FetchContentinstead of being bundled in-tree
Bug Fixes
- Fixed undefined behaviour from a negative
double→unsignedcast in congestion control - Guard against a null socket in
BCS_CLOSE_CONNECTIONhandling - Fixed DLL exports on Windows
- Fixed sample compilation across all platforms
Testing & CI
- CI now builds and runs the full test suite on Linux, macOS and Windows (stress tests included)
- Added a Dockerfile for running the test suite in a container
- Numerous test-stability improvements: mesh-convergence waits, race-condition fixes, and a thread-safe plugin lifecycle for
PacketChangerPlugin
Full Changelog: ...v0.4.0