This is a minimal engine/template for a browser-based pixelart 2D online RPG that I've written for fun while learning Phaser 3, an awesome HTML5 game engine. It is mostly inspired by Margonem.
Sigil features a semi-realtime WebSocket server that updates the global state with 0.1s intervals. It has almost zero overhead when no players are logged in.
Implemented features:
- Game client (HTML5 + Phaser) and server (Node.js)
- Registration and authentication
- Grid-based point-and-click movement using EasyStar.js pathfinding library
- Tile-based maps using Tiled for an editor. Multi-layer maps
- Character animation
- NPC citizens
- Basic GUI and a dialog system
TODO:
- Display other users
- Inventory and items
- Quests
- Battle system
- Enemies
Installing Sigil on a Linux server is very easy: just do npm install in sigil-server and copy all the files to the dedicated server directory, for example /opt/sigil. Then add a sigil.service to /etc/systemd/system:
[Unit]
Description=Sigil WebSocket Server
After=network.target
[Service]
ExecStart=node /opt/sigil/src/index.mjs
WorkingDirectory=/opt/sigil
Restart=always
RestartSec=5
Environment=NODE_ENV=production
User=<your server user>
Group=<your server group>
[Install]
WantedBy=multi-user.target
Make sure that your server user has write access to /opt/sigil/db.
Then run
sudo systemctl daemon-reload
sudo systemctl enable --now sigil
Configure your reverse proxy to route /sigil-server to localost:8050.
Copy sigil-client to your publicly available web folder, for example var/www/html/sigil-client.
Modify sigil-client/config.js. sigilProductionServer global variable should contain public URL of your running Sigil instance. For example:
var sigilProductionServer = "wss://mygame.com/sigil-server/";