Download

[WIP] Character Component System

I am currently working on a component system that will add RPG elements when placed on a pawn. While I’m sure there are plenty of others out there working on a system for this, I decided to give it a go anyway.

Current features:

  • Option to show the UI, or to not display it for using a different UI.
  • Option to set as NPC (Does not include AI).
  • Basic RPG stats: Strength, Stamina, Spirit, Dexterity, Intellect, Health, and Mana - Generated based on class attribute templates (can be adjusted or new classes added).
  • Attack Power, Spell Power, Health and Mana maximums and regen values are based on these basic stats.
  • Level and Experience system with adjustable parameters to customize the max experience per level curve. Handles experience over the max, adding levels as needed.
  • Function to handle taking damage and a death state.
  • In-combat system (basic) that will stop health regen and lower mana regen when in combat.
  • Should work entirely with multiplayer. I always test my stuff as a client.

I tried to make everything adjustable so that it can be customized easily. It is plug and play to a point, but some of the functions require calls from the character that has the component. This would include initializing the character, taking damage, and using mana.

I am fairly new to Blueprints, and I am open to suggestions and comments.

GitHub: https://github.com/envis10n/CharacterComponent

The wiki on GitHub also contains installation instructions and some tips for customization.

Looks amazing! I’m very interested in this as I am new to unreal :slight_smile:

I would like to know if you were able to achieve what I could not at the time I tried this.

Component to Component interaction.

Component to component interaction, in the sense of two components on the same pawn interacting, is easy. Components on separate actors require functions on the actor itself to act as an interface. I was also working on a spell component system that would interact with the character component. Normally, you would use an interface for this purpose. I was able to use variables in each component referencing the other by setting at creation. The spell system uses the character component reference to grab current mana and also use mana when casting. If we don’t have enough mana for the spell, we don’t cast. If we do, we set mana to mana - mana cost (for example). Off the top of my head, I can’t remember what I use the spell system reference for in my character component. Is there a specific thing you attempted to do? If so, I would love to give it a shot and see if I can’t come up with a solution to help you out.

EDIT:
A little example using two separate components on the same actor. Interaction is done between them by giving them references to the other as variables. There is also a simple function used to grab the value of a string variable, CurrentSpell, from the SpellSystem variable in the Character Component. Hopefully this is what you meant by component interaction.

example_1.png

example_2.png