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

  1. Open the Login Scene:

    • Locate BackendBootstrap in the Hierarchy.

    • In the inspector, change the Backend Selection to WebSocket SQL.

  2. Configure Backend Settings:

    • In the Server Url field, 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/phpmyadmin

  • Click "New" and create a database named: game_db

  • Select game_db, click "Import".

  • Choose DatabaseImport.sql from 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:6379

For production (.env.production), replace localhost with your server's public IP address.

🚦 Running the Server:

  • For development: npm start

  • For production: npm start

Your WebSocket server should now run at:

  • ws://localhost:2567 for local

  • ws://YOUR_SERVER_IP:2567 for production


📁 Exporting Game Data from Unity

  1. Run Unity Game in Editor:

    • Open the Login scene and press Play.

    • Ensure you are logged out to return to the Login screen.

  2. Export JSON Data:

    • Select ExportDataJson GameObject in Hierarchy.

    • Click "Export All Game Data" in Inspector.

    • Minimize Unity and maximize again (forces data refresh).

  3. Locate Exported JSON Files:

    • Files are located in the Unity project's Data folder.

    • Copy these files into your server's Data directory.


🎉 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