PocketMine-MP/changelogs/4.18-alpha.md
2023-03-16 21:45:18 +00:00

3.3 KiB

For Minecraft: Bedrock Edition 1.19.70

Note about API versions

Plugins which don't touch the pocketmine\network\mcpe namespace are compatible with any previous 4.x.y version will also run on these releases and do not need API bumps. Plugin developers should only update their required API to this version if you need the changes in this build.

WARNING: If your plugin uses the pocketmine\network\mcpe namespace, you're not shielded by API change constraints. Consider using the mcpe-protocol directive in plugin.yml as a constraint if you're using packets directly.

Alpha release warning

Alpha releases are experimental. Features introduced in these releases are subject to change or removal.

APIs which existed prior to this version will continue to work as normal, so plugins which use them will continue to work.

Highlights

This version makes changes to the internal network system to improve server performance and reduce memory usage.

While these changes don't affect non-internal API, they are still significant enough to warrant a new minor version, as they may break plugins which use the internal network API (not recommended).

4.18.0-ALPHA1

Released 16th March 2023.

General

  • Improved server performance in congested areas of the world (lots of players and/or entities in the same area).

API

pocketmine\event\server

  • The following new classes have been added:
    • DataPacketDecodeEvent - called before a packet is decoded by a NetworkSession; useful to mitigate DoS attacks if PocketMine-MP hasn't been patched against new bugs yet

Internals

  • Introduced new system for broadcasting entity events to network sessions.
    • This change improves performance when lots of players and/or entities are in the same area.
    • New interface EntityEventBroadcaster and class StandardEntityEventBroadcaster have been added to implement this.
    • All entity-specific on*() and sync*() methods have been removed from NetworkSession (BC break).
    • NetworkSession now accepts an EntityEventBroadcaster instance in its constructor.
    • NetworkBroadcastUtils::broadcastEntityEvent() can be used to efficiently broadcast events to unique broadcasters shared by several network sessions.
  • All network sessions now share the same PacketSerializerContext and PacketBroadcaster by default.
    • Previously, every session had its own context, meaning that broadcast optimisations were not used, causing significant performance losses compared to 3.x.
    • This change improves performance in congested areas by allowing reuse of previously encoded packet buffers for all sessions sharing the same context.
    • Packet broadcasts are automatically encoded separately per unique PacketSerializerContext instance. This allows, for example, a multi-version fork to have a separate context for each protocol version, to ensure maximum broadcast efficiency while encoding different packets for different versions.
    • PacketSerializerContext is now passed in NetworkSession::__construct(), instead of being created by the session.
  • StandardPacketBroadcaster is now locked to a single PacketSerializer context, reducing complexity.
  • Introduced NetworkBroadcastUtils::broadcastPackets(), replacing Server->broadcastPackets().
  • Server->broadcastPackets() has been deprecated. It will be removed in a future version.