Galaxy108 project structure2 min read

Galaxy108 project structure feature image

Project Architecture Overview

Game

The game is built using ReactJS as the core framework, with carefully selected and integrated open-source libraries. The game's runtime is divided into multiple parallel threads for rendering (main thread), AI, physics, pathfinding, NPC simulation, world map, and map chunk processing. Data sharing between threads is achieved using SharedArrayBuffer, OR packing objects into buffers using schemapack for efficient transfer between threads.

For multiplayer mode, the server is developed using NodeJS and packaged with pkg. The client-server communication framework is built on a combination of geckosIO and webTCP, supporting frame synchronization and packet loss compensation.

Website

The website is developed using NextJS, including the frontend, backend CMS pages, and three content creation tools:

  • Creature Editor
  • Weapon Tool Editor
  • Behavior Tree Editor

These tools allow for efficient creation and management of game content.

Server

The server infrastructure is managed using CloudFormation for resource creation. Lambda functions are used in conjunction with API Gateway to automatically package and deploy related cloud resources. Game and website assets are stored in S3, while user data is stored in DynamoDB.

Deployment

Both the game and website are automatically deployed via AWS Amplify whenever updates are made. For multiplayer functionality, I am researching an automated solution to start and stop EC2 instances dynamically, which will be synchronized with the multiplayer server status displayed on the game's frontend.

This architecture ensures scalability, efficiency, and a seamless experience for both developers and players.



项目架构概述

游戏部分

游戏使用 ReactJS 作为核心框架开发,并基于深思熟虑筛选的开源库进行了整合。游戏的运行时分为多个并行线程处理,包括渲染(主线程)、AI、物理、寻路、NPC 模拟、大地图和地图区块等。线程间的数据共享通过 SharedArrayBuffer 实现,或使用 schemapack 将对象打包为 buffer 以在线程间高效传输。

多人游戏模式的服务器使用 NodeJS 开发,并通过 pkg 打包。客户端与服务器之间的通信框架基于 geckosIOwebTCP 开发,支持帧同步和丢包补偿。

网站部分

网站使用 NextJS 开发,包括前端、后台 CMS 页面以及三个游戏内容创作工具:

  • 生物编辑器
  • 武器工具编辑器
  • 行为树编辑器

这些工具能够高效地创建和管理游戏内容。

服务端部分

服务端基础设施使用 CloudFormation 进行资源创建。Lambda 函数API Gateway 配合,用于自动打包和部署相关云端资源。游戏和网站的静态资源存储在 S3 中,用户数据则存储在 DynamoDB 中。

部署

游戏和网站通过 AWS Amplify 在有更新时自动部署。针对多人游戏功能,我正在研究一套自动开关 EC2 实例 的方案,并将其与游戏前端的多人服务器状态页面同步。

这一架构确保了项目的可扩展性、高效性,并为开发者和玩家提供了无缝的体验。