リアルタイム位置情報連動型マルチプレイヤーゲーム - Slither.io inspired shark evolution game
Samezarioは現実世界を歩き回りながらサメを操作し、海中でエサを食べて成長・進化しながら他プレイヤーと競うリアルタイムマルチプレイヤーゲームです。
- Frontend: Phaser 3 + TypeScript + Vite
- Backend: Go + WebSocket
- Infrastructure: AWS (ECS/Fargate + ALB + ElastiCache Redis + Amazon Location Service)
- IaC: Terraform
- Docker & Docker Compose
- Node.js 20+ (for local client development)
- Go 1.22+ (for local server development)
- Clone the repository:
git clone <repository-url>
cd Samether.io- Start services with Docker Compose:
docker-compose up --build- Open browser at
http://localhost:8080
cd client
npm install
npm run devcd server
go mod download
go run cmd/server/main.go.
├── client/ # Phaser + TypeScript frontend
│ ├── src/
│ │ ├── game/ # Game logic and scenes
│ │ ├── network/ # WebSocket communication
│ │ └── ui/ # UI screens
│ └── package.json
├── server/ # Go backend
│ ├── cmd/ # Entry points
│ ├── internal/ # Internal packages
│ │ ├── game/ # Game logic
│ │ ├── ws/ # WebSocket hub
│ │ └── session/ # Redis session management
│ └── config/ # Configuration
├── infra/ # Terraform infrastructure
│ ├── envs/ # Environment-specific configs
│ └── modules/ # Reusable Terraform modules
└── docs/ # Documentation
[Mobile Browser]
|
├── WebSocket (wss://)
| |
| [ALB]
| |
| [ECS Fargate]
| ├── WebSocket Server (Go)
| ├── Game Logic (20 tick/sec)
| └── Leaderboard Management
| |
| [ElastiCache Redis]
|
└── GPS Location
|
[Amazon Location Service]
REDIS_ADDR: Redis server address (default: none, optional)REDIS_PASSWORD: Redis password (default: empty)REDIS_DB: Redis database number (default: 0)REDIS_PREFIX: Redis key prefix (default: samezario:leaderboard)ROOM_ID: Game room identifier (default: hostname or "room-1")ROOM_CAPACITY: Maximum players per room (default: 50)INSTANCE_ID: Instance identifier (default: same as ROOM_ID)
GET /health- Health check (returns "ok")GET /healthz- Detailed health check with room infoGET /room- Current room snapshotGET /ws- WebSocket upgrade endpointGET /- Static files (game client)
join: Join game with player namegps: Update GPS coordinatestouch_input: Touch/joystick inputradar: Radar activation requestevolve: Evolution selectiondash: Dash activation (CP consumption)
welcome: Player ID and initial statestate: Game state updates (20 tick/sec)radar_result: Radar scan resultsevolve_available: Evolution optionsleaderboard: Top player infodeath: Death notification
# Server tests
cd server
go test ./...
# Client build check
cd client
npm run buildInfrastructure is managed with Terraform. See infra/README.md for details.
cd infra/envs/dev
terraform init
terraform plan
terraform apply- 仕様書 v1.1 - Full game specification (Japanese)
- Infrastructure README - Terraform setup and deployment
- Phase 1: PoC - Basic Slither.io mechanics
- Phase 2: GPS integration & CP system
- Phase 3: Evolution system (3 routes, 5 stages)
- Phase 4: Territory system
- Phase 5: Polish & optimization
Proprietary