Combat modes
RPGJS ships three combat modes. Each one is a separate package that you install as a module, and each one works in a solo game (standalone RPG) and in an online game (MMORPG) with the same code.Action Battle System
Real-time combat on the map: enemies with an AI, combos, dashes, skills, projectiles.
Turn-based battle
Classic turn-based fights in a battle scene shown above the map.
Tactical battle
Units move on a grid, act in phases and fight for an objective.
Which mode?
The turn-based and tactical battles read the native fields of the database (
name, spCost, power, hpValue, spValue…) and keep what only they need in their own field, so one skill record can serve both. They do not depend on each other: install one, or both.
Solo and multiplayer
The same rule holds in every mode: the server owns the combat. The client draws it, plays the animations and sends the player’s inputs; the server checks them, applies the rules and synchronizes the result.- Solo (standalone RPG): the server runs inside the game, in the browser. You write the same server code as for an online game, and battles start the same way.
- Multiplayer (MMORPG): the server is shared. A battle lives in the room of its map, so every fighter and spectator must be on that map. A player who disconnects leaves the battle, and the battle goes on without them.
- Action Battle System: factions and multiplayer
- Turn-based battle: start a battle
- Tactical battle: start a battle
Build your own combat mode
The turn-based and tactical battles are built on@rpgjs/battle-kit: the registry of running battles (busy players, spectators, disconnections), the hooks of the game modules, the reading and writing of a player, the controls of a battle screen, sound cues and presentation pieces. Start from it to write a combat mode of your own that behaves like the built-in ones.