Customization
Action Battle is configured by responsibility (combat, visual, ui, ai, skills) and can be extended with plugins. Stats use the standard RPGJS API.
Recommended composable DX
New action-battle configuration is grouped by responsibility:combatowns gameplay rules: player attack profile, damage, knockback, and hit hooks.visualowns temporary combat feedback: sprite animations, flashes, damage text, CanvasEngine effects, and previews.uiowns client components: action bar, targeting overlay, attack preview, and custom GUI or sprite components.aiowns reusable AI behavior functions.skills.targetingowns action targeting metadata for skills.
visual preset on the server and client when your project splits
configuration by runtime. The server still decides when authoritative hit, hurt,
skill, and enemy attack feedback should happen, but it sends one compact
action-battle client visual event. The client resolves that visual locally and
groups the flash, hit text, sound, component animation, or sprite animation.
This keeps gameplay authority on the server while avoiding several visual
packets for one combat moment. The client also triggers local input feedback
such as the attack preview.
@rpgjs/action-battle.
Visual composition
createActionBattleVisual() accepts a preset or a map of visual parts. A visual
part is a function receiving the current combat context and helper methods.
impact preset selects an official CanvasEngine preset from the combat
context: hitSpark for normal hits, slashSpark for combo finishers,
impactBurst for charged or critical attacks, magicBurst for skills, and
healPulse for healing. Its world-space damage popup changes font size, color,
outline, movement, and duration for the same contexts. The built-in component
animations are registered as action-battle-hit-fx and
action-battle-damage.
A skill or weapon action can override its impact presentation with serializable
metadata:
fx.component(entity, id, params).
Action-battle visual composition runs through the general
Client Visuals mechanism for server-triggered combat
feedback. Use direct server visual APIs for isolated one-off effects, and use
visual here when you want action-battle to group combat presentation on the
client.
The legacy animations option still works for sprite animation names and
temporary graphics. New orchestration should go through visual, while
animations remains useful as the data source used by
fx.graphic(entity, "attack"), fx.graphic(entity, "hurt"), and
fx.graphic(entity, "castSkill").
Composable UI
Action Battle uses RPGJS’s generic, server-authoritative hotbar. Enable it on the server withui.hotbar; targeting and attack-preview components remain
client-owned and replaceable.
Compatibility
The legacyattack, systems.combat, systems.ai, and skills.getTargeting
options are still supported. New code should prefer combat, ai, and
skills.targeting so each part of the action-battle module stays independently
replaceable.
Plugin-first extension points
Action battle is structured as replaceable systems. You can keep the default Zelda-like sword attack and only replace the pieces your game needs.@rpgjs/action-battle/server:
ActionBattleCombatSystem, ActionBattleAiBehavior,
ActionBattleHitHooks, and ActionBattleHitResult.
For data-driven enemies, use createActionEnemy():
BattleAi, the server lets the
event handle onAction and does not create the combat hitbox. Enemy events
with BattleAi still trigger the A-RPG attack.
Configure stats with the standard RPGJS API
The AI uses the event’s existing data.Health and resources
Parameters
Skills
Items and equipment
Classes
States
Combat sounds and dynamic music
Action Battle can play local action cues and crossfade the current map BGM into a looping battle track:{ id, volume, cooldownMs }. Basic attacks are predicted locally and suppress
the matching authoritative cue for 250ms. A skill’s own sound field takes
priority over the generic skill cue. Cue cooldowns prevent repeated area hits
from producing an unusable wall of sound.
Combat threat is authoritative on the server and isolated per player. Alert,
combat, fleeing, and stunned enemies keep that player in combat. On equal
priority the currently selected enemy stays stable; bosses default to priority
100 and ordinary enemies to 0. Configure an enemy-specific track with:
combatAudio, map combatMusic, and enemy combatMusic
plus combatMusicPriority. createStudioActionBattleAudio(config) can provide
the same settings statically before these fields are available in a project.
Studio media ids are resolved lazily; resolving a new effect does not stop
music that is already playing.
The Adventure AI director limits how many enemies attack one target
simultaneously. Other enemies keep repositioning instead of stacking the same
attack: