Game Development 15 min read

Using Egret Engine for Mini-Program Cloud Development and Real-Time Data Push

At a Tencent Cloud technical salon, Egret Technology’s senior product manager demonstrated how the Egret engine’s built‑in cloud development and WebSocket‑based real‑time data push enable mini‑programs such as leaderboards and chat rooms, eliminating server setup, reducing backend costs, and simplifying cross‑platform game creation.

Tencent Cloud Developer
Tencent Cloud Developer
Tencent Cloud Developer
Using Egret Engine for Mini-Program Cloud Development and Real-Time Data Push

The article reports on the Tencent Cloud Community technical salon "Mini-Program Cloud Development" held in Beijing on September 21, featuring a presentation by Zhang Yu, senior product manager at Egret Technology, on leveraging the Egret engine for mini-program development with real-time data push capabilities.

Part 1 introduces the Egret engine as an early cross-platform game engine supporting H5 games and WeChat mini-games, with one-click publishing to iOS and Android, integrated workflow tools such as DragonBones animation editor and 3D game editor, and notable games built with the engine like the early 2014 "Block the Neurocat". The engine now includes built-in cloud development capabilities enabled by default in new projects.

Part 2 details a real-time data push practice project, contrasting short‑polling (e.g., traditional HTTP request/response used in games like "Happy Farm") with long‑connection WebSocket approaches that enable bidirectional instant communication essential for high‑real‑time games such as "Honor of Kings". The push mechanism is likened to mobile push notifications: the client subscribes to specific data; when the server‑side data changes, updates are pushed to the client.

Part 3 explains how to implement a leaderboard using this push capability in four steps: (1) create a ranking collection in the cloud database; (2) from the game client call a cloud function to send player score and info; (3) the cloud function retrieves the current list, inserts the new score, sorts descending, keeps the top ten, and updates the database; (4) the client watches the leaderboard collection and refreshes the UI upon receiving pushed updates.

Key code snippets are preserved: await db.collection(rank).doc(top10).get for fetching the leaderboard record, and WX.cloud.callfunction for invoking the addScore cloud function.

The article further connects real‑time data push to a single‑direction data flow (View‑Actions‑State) analogy, suggesting a data‑driven development mindset where the game client acts as the View, cloud functions as Actions, and the database as State, enabling automatic UI updates when data changes.

Examples of marketing mini‑games using the technology are given, such as cooperative fishing or gold‑digging games that reward players with coupons, and interactive features like friend‑sharing notifications that boost engagement.

Benefits of adopting cloud capability include eliminating the need for servers (no domain filing or licenses), removing backend engineering costs, avoiding server configuration and front‑back‑end integration, simplifying environment separation via appID, and enhancing security against attacks.

Finally, Egret Technology plans to encapsulate common components (chat room, leaderboard, guild, etc.) with ready‑made UI, client logic, and cloud‑function code, allowing developers to only customize the interface and reduce development effort.

Q&A highlights: initial component focus is chat room; reconnection after disconnection is handled by application‑level retry logic; single‑direction data flow is a design mindset, not a specific solution, and can be implemented by refreshing component state upon receiving pushed messages.

Game developmentWebSocketmini-programCloud FunctionsTencent Cloudcloud developmentEgret engineReal-time Data Push
Tencent Cloud Developer
Written by

Tencent Cloud Developer

Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.

0 followers
Reader feedback

How this landed with the community

login 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.