How King of Glory Scaled to 4,600 Servers: Inside Its Backend Architecture

King of Glory’s technical director Sun Xun recounts the evolution from a PC RTS framework to a massive mobile MOBA, detailing the game’s server‑hall and PvP split, the introduction of proxy servers, the shift from TCP to UDP with frame‑sync, and ongoing network and scaling optimizations.

21CTO
21CTO
21CTO
How King of Glory Scaled to 4,600 Servers: Inside Its Backend Architecture

Game Background

In 2012 the team created the PC RTS Ba San Guo OL , which later transitioned to a PC MOBA and eventually became the mobile MOBA King of Glory . The project shifted from the Unreal engine to Unity, requiring a complete rewrite of the codebase.

Key Lessons from Ba San Guo

The earlier RTS experience informed the team’s understanding of MOBA design, client‑server patterns, and frame‑sync concepts such as handling reconnections and view synchronization.

Overall Backend Architecture

The current architecture consists of two primary server groups: a Game Hall and PvP servers. A Proxy layer was later added to hide internal process distribution and to solve cross‑platform (Android/iOS) same‑server issues.

Additional components include a Room Matching server for matchmaking, a Adapter that bridges large‑region resources for cross‑region play, and various specialized servers (e.g., ranking, team).

All non‑critical modules can be scaled online or automatically isolated when faults occur, limiting the impact of failures to specific logical zones.

Network Synchronization Strategy

Initially the game used a Client‑Server model with TCP, but performance issues under packet loss led to a switch to UDP combined with a frame‑sync approach.

Key characteristics of the frame‑sync solution:

Server collects all player inputs every 66 ms, packaging 15 packets per second.

Packets are cached and retransmitted in order; missing packets trigger server‑side redundancy.

Clients perform deterministic calculations without floating‑point variance, ensuring strong consistency.

To mitigate UDP packet loss, the server adds redundancy (e.g., sending the previous three frames) and performs application‑layer retransmission.

Despite its strict ordering requirements, frame‑sync provides low latency essential for fast‑paced MOBA combat.

Post‑Launch Adjustments

After launch, the architecture remained largely stable, with most changes focused on network optimization: CPU usage reduction, latency and packet‑loss handling, and dynamic redundancy scaling.

Monitoring tools track per‑match latency, packet loss, and desynchronization rates, which have been reduced from ~2 % to 0.03 % through automated testing, robot simulations, and dedicated pre‑release servers.

Operational Insights

Common sources of gameplay stutter include congested regional bandwidth, high‑latency Wi‑Fi routers, and weak cellular signals. The team continuously refines network routing, redundancy, and CPU efficiency to improve player experience.

21CTO 综合自网络
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendMobile GamingGame Architectureserver scalingnetwork synchronization
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.