-
Notifications
You must be signed in to change notification settings - Fork 225
[feat] Creation of the “Action RPG Combat System v5” Plugin #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v5
Are you sure you want to change the base?
Conversation
- Introduced the `@rpgjs/action-battle` package with dependencies linked to the workspace. - Updated `pnpm-lock.yaml` to include new dependencies for action-battle. - Enhanced player capabilities in `Player.ts` by initializing level to 1 and modifying item handling. - Added new properties for items in `Item.ts`, including attack and defense attributes. - Updated `BattleManager.ts` and `MoveManager.ts` to improve battle and movement management functionalities. - Enhanced `ParameterManager.ts` with comprehensive parameter management features, including experience and level progression. - Updated sample project to integrate action-battle features, including AI behavior and item management. - Added detailed JSDoc comments throughout the codebase for better documentation and usage examples.
const distance = this.getDistance(this.event, this.target); | ||
|
||
// Check if target is still in vision range | ||
if (distance > this.visionRange * 1.2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why this 20% buffer is needed as in my opinion would only lead to the missunderstanding what is going on. I think that game developer could himself define some buffer if needed.
packages/action-battle/src/server.ts
Outdated
// Calculate attack hitbox based on player direction | ||
switch (direction) { | ||
case "up": | ||
hitboxes = [{ x: -16, y: -48, width: 32, height: 32 }]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to have this configurable
const dirY = dy / distance; | ||
|
||
// Create attack hitbox in front of the event | ||
const attackDistance = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const attackDistance = 30;
This could be parameterizable
- Translated and updated the Battle AI system documentation to provide clearer guidance in English. - Added new features including configurable parameters for attack distance and vision range buffer. - Improved AI behavior with enhanced detection and pursuit mechanisms. - Updated the BattleAi class to manage health directly through the event object. - Introduced new examples for AI usage and player combat integration. - Enhanced the physics system to prevent sensor bodies from passing through walls during knockback. - Added comprehensive JSDoc comments for better understanding and usage examples throughout the codebase.
- Fixed the indentation of the `this.event.moveTo(player);` line in the `pursue` method of the `BattleAi` class to ensure proper code formatting and readability. - This change enhances the maintainability of the codebase by adhering to consistent coding standards.
✨ Description
This PR introduces a real-time, Zelda-style Action RPG combat system for version 5 of the project, implemented as a plugin.
The system is based on assigning behaviors to events, enabling events to act as active enemies.
⚙️ Main Features
✅ Vision
Each enemy can detect the hero within a certain radius / field of vision.
Pursuit begins when the hero is spotted.
✅ Movement
Enemy automatically moves toward the hero.
Obstacle/pathfinding handling (if applicable in this version).
✅ Attack
Once in range, the enemy attacks the hero.
Attack deals damage and knocks the hero back.
✅ Damage Display
Lost HP is shown as damage numbers (“hits”) above the hero.
Clear visual feedback for the player.
🧩 Plugin Architecture
New dedicated plugin for version 5, toggleable in settings.
Modular system allowing enemy behaviors to be defined via parameters or event notes.
Compatible with the event system for easy configuration by creators.
📌 Technical Notes
Behavior is assigned to an event via a tag or plugin parameter.
Movements and attacks are real-time (not turn-based).
Knockback strength depends on attack power.
Configurable damage display (color, duration, etc.).