This is a submission for the Alibaba Cloud Challenge: Build a Web Game.*

What I Built

I created a multiplayer open-world game where you control a robot in an infinite, isometric grid-based world. Your mission is to use your imagination to build unique monuments that decorate the landscape. Each monument is dynamically generated with the help of AI (powered by ComfyUI), and is permanently placed at the location where it was created. As players explore the world, they can discover the creations of others and encounter fellow travelers cruising through the ever-evolving map, making it a vibrant and shared experience.

Demo

https://imaginarium.monster

Game Play

Game Play

Source Code

https://github.com/milewski/imaginarium-challange

The Repository Contains:

  • The game source code located in /game
  • The WebSocket server and API located in /server
  • The Terraform setup files for the infrastructure located in /infrastructure

Alibaba Cloud Services Implementation

To support the game's backend and dynamic content delivery, I utilized several Alibaba Cloud services:

  • Elastic Compute Service (ECS):

Used for hosting the backend servers, including the API and WebSocket services. ECS provided the flexibility and performance needed to run Rust-based backend components efficiently.

  • Object Storage Service (OSS):

Used to store and serve static assets generated by players, such as monument images. OSS offered scalable and reliable storage with easy access over the web.

  • Content Delivery Network (CDN):

Integrated to accelerate the delivery of frontend assets, improving load times and the overall user experience, especially for a browser-based WASM game.

  • Container Registry (CR):

Used to host and manage the container images for the server components. Leveraging Alibaba Cloud’s container registry streamlined the deployment process.


While there were additional Alibaba Cloud services that could have further enhanced the project, integrating them would have required more development time. I effectively had only four days to work on this project, and it was an incredibly fun experience. Overall, working with Alibaba Cloud was smooth and straightforward, largely thanks to the official Terraform provider, which made it easy to explore available services and quickly provision and configure the necessary infrastructure.

Game Development Highlights

The game was developed using the Bevy game engine, entirely built in Rust, and compiled to WebAssembly (WASM) to run seamlessly in the browser. User-generated monument images are dynamically created using a Stable Diffusion XL model, enhanced with several LoRAs via ComfyUI. All generation services are containerized with Docker and deployed to Alibaba Cloud in a Docker Swarm cluster of a single node.

Technical Highlights:

Bevy, Rust, Vuejs, Alibaba Cloud, Docker, ComfyUI, WebSocket, Axum, Terraform

  • The game runs entirely in the browser via WebAssembly.

  • Real-time communication with the server is handled through a WebSocket connection using a custom binary protocol.

  • Both the server and the client frontend are built in Rust, sharing code between them for efficiency and consistency.

  • A lightweight Vue.js wrapper manages loading logic, WASM communication, modal handling, and audio token interactions.

  • Monument generation is dynamic, leveraging ComfyUI pipelines for on-the-fly creation of assets.