WeChat Mini-Game Development: From Zero to One with Cloud Development
The talk explains how to build WeChat mini‑games from scratch using Cocos Creator and the platform’s cloud development suite—covering database, storage, cloud functions, real‑time push updates, and the MGOBE multiplayer engine with both frame and state synchronization options for rapid, serverless game deployment.
Since the first batch of WeChat mini-games launched in early 2018, the mini-game ecosystem has rapidly established itself leveraging WeChat's massive traffic and monetization capabilities. Currently, WeChat mini-games have over 400 million monthly active users with hundreds of thousands of developers.
How to Develop a Mini-Game from Scratch:
WeChat third-party development is divided into two categories: WeChat H5 and public account articles based on general web technology frameworks, and regular mini-programs and mini-games developed based on WeChat's technical framework with private technical features. Among the differences between H5, regular mini-programs, and mini-games, mini-games are the only ones that truly support relationship chain data usage solutions.
Development Tools:
The speaker transitioned from CreateJS to Cocos Creator for game development. Cocos Creator encapsulates various functions or elements that might be used in games into individual components, with their own callback methods. These components can be dragged and assembled in visual development tools to form games. Cocos Creator allows programmers to define properties that can be exposed to other team members, solving frontend demands and improving development quality and efficiency.
Cloud Development (小程序·云开发):
Cloud development addresses the parallel process between frontend and backend development. It provides three core capabilities (database, storage, cloud functions) and two encapsulations (authentication and cloud calling). Developers don't need to handle server-side API AccessToken mechanisms or mini-program login authentication - cloud development encapsulates all of these. Cloud functions are the core of Serverless, providing appid and openid automatically through private protocols, with authentication handled at the cloud function frontend.
Real-time Push Capability:
Cloud development database added real-time push update capability, enabling direct data monitoring from mini-program and mini-game clients. Developers can specify query statements for monitoring, and when query results change, the client receives push notifications containing updated content. This capability supports scenarios like instant messaging, state synchronization, and real-time collaboration.
Multiplayer Game Implementation (MGOBE):
The Mini-game Online Battle Engine (MGOBE) solves the technical and operational challenges behind multiplayer games. Developers only need to call a few JS interfaces to implement room management, online matching, and networked battle functionality within 5 minutes without complex backend code.
Two Synchronization Methods:
Frame synchronization (used in games like Honor of Kings) publishes player action instructions to the backend, which then synchronizes messages to all clients at fixed intervals. However, it has high network requirements, weak anti-cheat capabilities, and long reconnection times.
State synchronization offers strong anti-cheat capabilities, suitable for large-scale battles like battle royale games, with shorter reconnection times. MGOBE supports state synchronization, allowing developers to write logic without worrying about deployment.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.