GitHub - Wyze3306/PocketMine-MT: Multi-threaded server software for Minecraft: Bedrock, built from scratch in PHP, C and C++ · GitHub
Skip to content

Wyze3306/PocketMine-MT

 
 

Folders and files

Repository files navigation

PocketMine-MT
A multi-threaded fork of PocketMine-MP for Minecraft: Bedrock Edition

What is PocketMine-MT?

PocketMine-MT (Multi-Threaded) is a fork of PocketMine-MP that enables parallel world ticking — each world runs on its own CPU core, and each world can further shard its own tick work across multiple RegionThreads. On a 12-core server, 12 worlds × N regions = dozens of CPU cores doing real parallel game work at 20 TPS.

Key features

  • Parallel world ticking (Phase B) — each world runs in its own thread at 20 TPS independently. Enable with world-threads.enabled: true in pocketmine.yml.
  • Intra-world region sharding (Phase C) — each WorldThread spawns up to N RegionThreads (one per 16×16 chunk region with players) that run real tick work in parallel: chunk deserialization, random-tick candidate selection, and block/sky light propagation move off the WorldThread entirely for region-owned chunks.
  • Async chunk I/O — chunk loading and saving happen in background worker threads. Autosaves no longer cause lag spikes.
  • Async events — plugin event handlers can return Promises for non-blocking processing.
  • 100% backward compatible — all existing PocketMine-MP plugins work without modification (with threading disabled).

How it works

Main thread (network + plugins)          WorldThread per world (gameplay)
├─ RakLib network                        ├─ Own game singletons (copies)
├─ Plugin events                         ├─ Own WorldProvider (own files)
├─ Packet sending                        ├─ Entity physics, AI, doTickThreaded
├─ Player connections                    ├─ Apply region random-tick batches
└─ WorldThreadSyncProcessor              ├─ Install region LightArrays
    ├─ Block changes → players           └─ Drain changedBlocks once/tick
    └─ Entity moves → players                  ├─ Forward to main thread
                                               └─ Mirror to RegionThreads

                                         RegionThread per 16×16 region
                                         ├─ Own singletons (per-thread copies)
                                         ├─ liveChunks (deserialized locally)
                                         ├─ Pick random-tick candidates
                                         ├─ Block + Sky LightUpdate execute
                                         └─ Ship LightArrays back to WorldThread

Quick Start

# pocketmine.yml
world-threads:
  enabled: true                  # Phase B: thread-per-world
  region-threads-per-world: 4    # Phase C: up to N RegionThreads per WorldThread

Set region-threads-per-world: 0 to disable intra-world sharding and keep a single thread per world. Keep world-threads.enabled: false to run the stock single-threaded loop.

Documentation

Plugin Compatibility

Plugin type Compatible?
Economy, chat, ranks, teleport ✅ Yes (main thread)
Block/entity event listeners ⚠️ Events disabled on threaded worlds
Everything with threading OFF ✅ 100% compatible

See MIGRATION.md for the full compatibility matrix.

Upstream Sync

git remote add upstream https://github.com/pmmp/PocketMine-MP.git
git fetch upstream && git merge upstream/stable

License

LGPL-3.0, same as upstream. See LICENSE.

About

Multi-threaded server software for Minecraft: Bedrock, built from scratch in PHP, C and C++

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

Contributors

Languages

  • PHP 99.9%
  • Other 0.1%