I'll create a WorldBox-style pixel game starting with the map. Let me first explore the project structure.
Let me look at the main entry and index files.
Now I'll build the game. My plan:
- Map generation using procedural noise (island with sea, beach, grass, forest, mountains, snow, rivers).
- Canvas rendering with pixel-art tiles.
- Zoom & pan with mouse wheel + drag on desktop, pinch + drag on mobile.
- LOD: at far zoom, objects (trees, etc.) become dots; at close zoom, detailed pixels.
Let me create the core files. First, the noise/map generation utility.
Now the map generation logic that produces terrain types per tile.
Now the renderer — the core canvas drawing with LOD (level of detail) based on zoom. This is the heart of the game.
Now the main game component with the canvas, camera controls (mouse + touch), and UI. Let me create a hook for pointer/touch controls and then the App.
Now the App component with UI: title, zoom controls, minimap, and seed regeneration.
Now let me create the Minimap component.
Now let me update the index.html title and build.
The build succeeded. The game is complete and functional.
✅ Pixel WorldBox — Đảo Hoang
Tôi đã tạo xong bản đồ game WorldBox pixel hoàn chỉnh. Đây là những gì đã được xây dựng:
🗺️ Bản đồ đảo procedural (tự sinh)
- Thuật toán noise Perlin/fBm tự viết (
noise.ts) tạo địa hình tự nhiên
- Đảo nằm giữa, xung quanh là biển nhờ island falloff (độ cao giảm dần ra rìa)
- 11 loại địa hình: biển sâu, biển, nước nông, bãi cát, cỏ, rừng, rừng rậm, đá, núi, tuyết đỉnh, và sông (được đào tự động từ đỉnh núi chảy ra biển)
- Cây cối rải rác trên các vùng rừng
🔍 Zoom xa / gần với LOD (Level of Detail)
- Zoom xa (< 6px/ô): dùng ảnh nền 1px/ô được vẽ sẵn → mượt, cây thành chấm nhỏ (đúng như yêu cầu)
- Zoom gần (≥ 6px/ô): vẽ chi tiết pixel từng ô — ngọn cỏ, vết nứt đá, lấp lánh nước, cây có tán và thân 3D pixel-art
- Nước có hiệu ứng sóng động và ánh lấp lánh
- Zoom mượt hướng về vị trí con trỏ chuột
📱💻 Điều khiển đa nền tảng
- Máy tính: lăn chuột để zoom, kéo để di chuyển
- Điện thoại: chụm/tách 2 ngón để zoom, 1 ngón kéo để di chuyển (touch-none, ngăn scroll)
- Nút zoom +/−, nút về trung tâm, giao diện responsive
100dvh
🎛️ Giao diện
- Thanh trên hiển thị seed, chế độ hiển thị (Toàn cảnh/Chi tiết/Cận cảnh) và % zoom
- Minimap góc dưới với khung viewport, bấm để tele đến vị trí
- Nút 🎲 Đảo mới để tạo bản đồ ngẫu nhiên khác
Hiện tại đúng như yêu cầu — chỉ có bản đồ, sẵn sàng để giai đoạn sau thêm sinh vật, dân cư và các công cụ "thần thánh" của WorldBox. Bạn muốn thêm gì tiếp theo?
Files built: src/game/noise.ts, src/game/mapgen.ts, src/game/renderer.ts, src/game/useGameCanvas.ts, src/App.tsx, src/components/Minimap.tsx, index.html