HermitONL 0.1 (RobotCapitol): a 3D Game to learn Bitcoin (Russian Roulette Drop style)
Kai Chew

Kai Chew @kafechew

About: A full-stack developer with actuarial statistics background, had been building hardware & software (backend systems & web applications) for more than 15 years, especially industrial automation & suppl

Location:
Puchong, Selangor, Malaysia
Joined:
Jan 10, 2022

HermitONL 0.1 (RobotCapitol): a 3D Game to learn Bitcoin (Russian Roulette Drop style)

Publish Date: Apr 27
14 4

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

Hi Humanoid! Welcome to Hermit Online! You live in RobotCapitol, where prices of everyday goods rise rapidly. Every time you save your hard-earned money, it buys you less and less over time! Go talk to other robots (gundam-like robots, "InfoBot") to explore more about Money and Bitcoin. And then join the Quiz Challange (near the golden humanoid, "QuizMind") to earn more Bitcoin sats! Ready to start?

HermitONL Bitcoin Quiz

What I Built

This project is a robot-themed MMORPG called HermitONL (Hermit Online), built using the HYTOPIA SDK (and Hytopia Game Engine). Players take on the role of a newly activated humanoid robot in a world dominated by fiat currency. The core objective is educational: players learn about Bitcoin concepts by interacting with NPC characters and test their knowledge through a "fall-down" style quiz game mechanic. The game features persistent player progression (tracking sats earned, lessons completed, etc.) and is deployed live on Alibaba Cloud infrastructure.

Technology Stack

  • Game Engine: HYTOPIA SDK
  • Runtime: Bun (fast all-in-one JavaScript runtime)
  • Language: TypeScript
  • Database: PostgreSQL (hosted on Alibaba Cloud ApsaraDB RDS and PolarDB)
  • Asset Hosting: Alibaba Cloud Object Storage Service (OSS)
  • Content Delivery: Alibaba Cloud Content Delivery Network (CDN)
  • Deployment: Docker, Nginx (Reverse Proxy), Alibaba Cloud Elastic Compute Service (ECS), Alibaba Cloud ACR (Container Registry)

Demo

Short (1 min)

Direct Short version link: https://youtube.com/shorts/p7B3ru3xmQ4

Long (4.25 mins)

Play Live (Hytopia Client Link): https://hytopia.com/play/?join=aliyun.hermit.onl (recommended using Mobile Web Browser)

Github Repo

Please refer to my github repo for step-by-step guide for local setup and deployment to Alibaba Cloud.

Bitcoin Learning Game (Hytopia)

Welcome to the HermitONL (Hermit Online), a massive multiplayer online role-playing game (MMORPG) built with the HYTOPIA SDK. Players explore a voxel-based world, interact with NPCs to learn about Bitcoin concepts, and test their knowledge through timed quizzes.

Play Live (Hytopia Client Link): https://hytopia.com/play/?join=aliyun.hermit.onl (recommended using Mobile Web Browser)

OSS Example (3D Model): http://alicdn.hermit.onl/soldier-player.gltf

Gameplay Overview

  • Theme: Players are newly activated humanoids in a dystopian world, learning about Bitcoin's decentralized concepts to break free from centralized fiat control.
  • World: Explore a voxel-style city plaza and a separate quiz platform area.
  • Learning: Interact with Knowledge Giver NPCs in the plaza to receive text-based lessons on Bitcoin fundamentals (transactions, Lightning Network, etc.). Earn 1 sat per unique lesson completed.
  • Quizzes: Participate in timed quizzes on the quiz platform (solo or multiplayer). Pay 1 sat to enter. Answer questions correctly within the time limit by moving to the…

Github Repo Local & Deployment

3D Model

OSS/CDN Example: http://alicdn.hermit.onl/soldier-player.gltf

soldier-player

Alibaba Cloud Services Implementation

Several Alibaba Cloud services were utilized to build, deploy, and host this game:

  • Elastic Compute Service (ECS):
    • Why: Chosen to host the backend game server (running the Hytopia SDK via Bun/Node.js within a Docker container) and the Nginx reverse proxy.
    • How: A ecs.t5-lc1m1.small instance (1vCPU, 1GiB RAM) running Ubuntu 22.04 was provisioned in the Singapore region, leveraging the free tier. Nginx was installed to handle incoming web traffic and proxy requests to the game server container.
    • Experience: The free tier instance provided a cost-effective way to deploy. However, the limited memory (1GiB) proved insufficient for building the Docker image directly on the instance (specifically during the bun install step), leading to OOM errors (exit code 137). This necessitated using Alibaba Cloud ACR.

ECS Keypair

SSH ECS

ECS Dashboard

  • ApsaraDB RDS / PolarDB for PostgreSQL:
    • Why: Selected for persistent storage of player data, including usernames, sat balances, completed lessons, and quiz results. Both RDS and PolarDB were explored; PolarDB offers cloud-native benefits like auto-scaling storage, while RDS provides a familiar managed PostgreSQL experience. The project currently uses the public endpoint from one of these services.
    • How: A PostgreSQL database (kai_pdb_name) and user (kai_pdb_account) were created. The application connects using credentials provided via environment variables (PGHOST, PGPORT, etc.). The initializeDatabase function in the code ensures the players table schema exists.
    • Experience: Setting up the database instance was straightforward. Initial connection and schema creation faced permission issues (permission denied for schema public), which were resolved by granting USAGE and CREATE privileges to the application user on the public schema via SQL commands. Interestingly, even though my ApsaraDB RDS was in Silicon Valley zone, it is working with Singapore ECS or local Malaysia machine docker.

ApsaraDB RDS for PostgreSQL

PolarDB for PostgreSQL

  • Object Storage Service (OSS):
    • Why: Used to host static game assets like 3D models (.gltf), UI icons (.png), and potentially other media efficiently and scalably.
    • How: An OSS bucket (hermitonl) was created in the Singapore region with Zone-Redundant Storage (ZRS) for higher availability. Specific assets (like soldier-player.gltf and UI icons) were uploaded. Bucket-level "Block Public Access" was disabled, and individual file ACLs were set to Public Read to allow access via CDN or direct URL.
    • Experience: Setup was relatively simple. Understanding the interaction between bucket-level "Block Public Access" and file-level ACLs was crucial for making assets publicly readable.

Object Storage Service (OSS)

  • Content Delivery Network (CDN):
    • Why: To accelerate the delivery of static assets (hosted on OSS) to players globally, reducing latency and load on the origin server.
    • How: A CDN domain (alicdn.hermit.onl) was configured, pointing to the OSS bucket (hermitonl.oss-ap-southeast-1.aliyuncs.com) as the origin server (using port 443 for secure origin fetch). DNS CNAME records were updated at the domain provider (Porkbun) to point alicdn.hermit.onl to the Alibaba Cloud CDN CNAME target. UI assets in HTML use a {{CDN_ASSETS_URL}} placeholder, replaced by an environment variable pointing to http://alicdn.hermit.onl.
    • Experience: The setup involved multiple steps (domain verification, origin config, CNAME). Troubleshooting involved verifying direct OSS access, checking DNS propagation, and confirming CDN domain status. HTTPS setup via CDN/ESA was explored but deferred due to perceived complexity/cost, settling on HTTP for asset delivery initially. The environment variable approach for integrating the CDN URL into the UI was identified as the likely intended method.

Content Delivery Network (CDN)

ESA

  • Container Registry (ACR):
    • Why: Adopted to overcome the memory limitations of building the Docker image directly on the small ECS instance.
    • How: An ACR instance/namespace/repository was set up. The Docker image is now built locally, tagged with the ACR repository path, and pushed to ACR. The ECS instance then pulls the pre-built image from ACR for deployment.
    • Experience: This workflow effectively solved the OOM build errors on ECS and represents a more robust deployment strategy. It requires initial setup of ACR and authentication on both the build machine and the ECS instance.

Game Development Highlights

  • Persistence: Successfully integrated PostgreSQL (via Alibaba Cloud PolarDB/RDS) to save and load player progress (sats, lessons, quizzes), making the game state persistent across sessions.
  • Quiz Mechanic: Implemented the core "fall-down" quiz mechanic where players move to platforms corresponding to answers, with incorrect platforms disappearing.
  • Deployment Pipeline: Established a full deployment pipeline involving Docker containerization, Nginx reverse proxying, HTTPS via Let's Encrypt, and leveraging Alibaba Cloud services (ECS, ACR, OSS, CDN, Database).
  • Troubleshooting: Successfully diagnosed and resolved various deployment issues, including Docker build memory limits (using ACR), Nginx 502 errors (caused by application crashes), missing modules (due to .gitignore), and database permissions.
  • CDN Integration: Configured OSS and CDN for asset delivery and identified the environment variable method for integrating asset URLs into the game's UI.

Gameplay Overview

  • Theme: Players are newly activated humanoids in a dystopian world, learning about Bitcoin's decentralized concepts to break free from centralized fiat control.
  • World: Explore a voxel-style city plaza and a separate quiz platform area.
  • Learning: Interact with Knowledge Giver NPCs in the plaza to receive text-based lessons on Bitcoin fundamentals (transactions, Lightning Network, etc.). Earn 1 sat per unique lesson completed.
  • Quizzes: Participate in timed quizzes on the quiz platform (solo or multiplayer). Pay 1 sat to enter. Answer questions correctly within the time limit by moving to the corresponding platform area. Incorrect answers or running out of time results in falling and elimination for that round. Correct answers earn 10 sats.
    • Quiz Rules & Mechanics:
      • Basic Setup: Players stand on platforms where a question and 4 multiple-choice answer options are displayed. Each answer option corresponds to a specific platform area.
      • Game Flow: A Bitcoin-related question appears. Players have a time limit (e.g., 15 seconds) to run to the platform representing the correct answer.
      • Elimination: After the timer ends, platforms with incorrect answers disappear. Players on those platforms, or those who didn't choose, fall and are eliminated for that round. Correct players proceed.
    • Quiz Strategies:
      • Quick Reaction: Read the question and move to the chosen platform quickly.
      • Positioning: Stand centrally initially for easy access to all answer platforms. Observe others but don't blindly follow.
      • Knowledge: Use the knowledge gained from NPCs. Remember answers, as questions might repeat.
  • Progression: Start with 5 sats. Earn more through lessons and quizzes. Player progress (sats, completed lessons/quizzes) is saved.
  • (Incoming Features): Peer-to-peer sat transfers, shop for items/upgrades.

Conclusion

This Bitcoin Learning Game demonstrates the integration of the HYTOPIA SDK with various Alibaba Cloud services to create a persistent, deployed MMORPG experience. Players can currently learn about Bitcoin via NPCs and test their knowledge in a unique quiz format. Future development aims to expand interactivity with features like peer-to-peer sat transfers and an in-game shop. The project serves as both an educational tool about Bitcoin and a practical example of deploying a modern web game on cloud infrastructure.

Comments 4 total

  • James
    JamesApr 27, 2025

    Can you accept my invitation so that I can get a free gift?
    temu.com/u/XtD2852IPG47cIB
    The person who will install and login with this Referral link can buy anything here free

  • Fayaz
    FayazMay 8, 2025

    Congrats on winning! 🥳

    • Kai Chew
      Kai ChewMay 8, 2025

      Thanks! Same to you! Congratz! Let's fight for another challenge!

      • Fayaz
        FayazMay 8, 2025

        Sure! ❤️

Add comment