WebsocketSQL Backend v1.5
🚀 Quickstart - WebSocket + SQL Backend
In this guide, you'll learn step-by-step how to set up the WebSocket + SQL backend for BulletHell Elemental Template v1.4. This backend option requires additional server-side configuration but offers full database support and online multiplayer functionality.
Websocket Servers:
Websocket Colyseus Server v1.5 - Download
Websocket Colyseus Server v1.5 + Lootbox logic - Download
Websocket Colyseus Server v1.4 - Download
SQL files:
Base SQL database file - Download
Update SQL 1.5 - Download
🎯 Unity Project Setup
Open the Login Scene:
Locate
BackendBootstrapin the Hierarchy.In the inspector, change the Backend Selection to
WebSocket SQL.
Configure Backend Settings:
In the
Server Urlfield, input your server IP.Example for local testing with XAMPP:
ws://localhost:2567
🛠️ Server Setup (Local - XAMPP)
📥 Installing XAMPP:
Download and install XAMPP for your OS.
Open XAMPP Control Panel.
Start Apache and MySQL services.
🗃️ Database Creation (MySQL):
Open your browser and navigate to
http://localhost/phpmyadminClick "New" and create a database named:
game_dbSelect
game_db, click "Import".Choose
DatabaseImport.sqlfrom the server folder provided with the template.Click "Go" to import the tables and initial data.
🌐 Server Setup (Production – Colyseus + MySQL Backend)
💻 System Requirements
OS: Ubuntu 22.04 LTS (recommended) or Windows 10/11
Node.js: v22 LTS
Database: MySQL 8 or MariaDB 10.6+
Web Server: Apache 2.4 (with PHP 8.2+)
Admin Panel: phpMyAdmin (latest version)
- MySQL 8 is required for JSON fields and CHECK constraints used in the schema. phpMyAdmin is recommended for database inspection, import/export and manual queries.
🔐 Configuring .env Files:
Create two .env files: .env.development and .env.production. Modify them as follows:
Example .env.development:
SAMPLE=development
PORT=2567
AUTH_SALT=your_generated_salt_here
JWT_SECRET=your_jwt_secret_here
SESSION_SECRET=your_session_secret_here
BACKEND_URL=http://localhost:2567
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=root
DB_PASS=
DB_NAME=game_db
REDIS_URL=redis://127.0.0.1:6379For production (.env.production), replace localhost with your server's public IP address.
🚦 Running the Server:
For development:
npm startFor production:
npm start
Your WebSocket server should now run at:
ws://localhost:2567for localws://YOUR_SERVER_IP:2567for production
📁 Exporting Game Data from Unity
Run Unity Game in Editor:
Open the
Loginscene and press Play.Ensure you are logged out to return to the Login screen.
Export JSON Data:
Select
ExportDataJsonGameObject in Hierarchy.Click "Export All Game Data" in Inspector.
Minimize Unity and maximize again (forces data refresh).
Locate Exported JSON Files:
Files are located in the Unity project's
Datafolder.Copy these files into your server's
Datadirectory.
🎉 Done! You have successfully configured the WebSocket + SQL Backend for BulletHell Elemental Template v1.4. Now you're ready to test and deploy your online BulletHell game!
Last updated