DEV Community

Cover image for 🎲 [Dice and Dragons #2]
GBoschiero
GBoschiero

Posted on

🎲 [Dice and Dragons #2]

Building a D&D-Style Character System in Unreal Engine – Part 1: Stats and the Character Sheet

Welcome back! In the intro post, we talked about the goals of this series: to recreate a modular, Dungeons & Dragons-inspired character system in Unreal Engine using clean, extensible code architecture.

Now, it’s time to get to the heart of what makes a character feel alive in games like D&D: stats.

In this post, we’re going to walk through how D&D-style ability scores are structured, and how we’re planning to represent them in Unreal Engine using a dedicated Actor Component. This component will become the foundation for everything that comes later — initiative, hit points, armor class, skill checks, and beyond.

Let’s dive in.


Anatomy of a Character Sheet

When you look at a D&D character sheet, the first thing that jumps out is the six core ability scores. These scores define everything about how your character interacts with the world mechanically. They’re the DNA of the character.

Ability Abbreviation Governs
Strength STR Physical power, melee attacks, athletics
Dexterity DEX Agility, reflexes, stealth, initiative
Constitution CON Endurance, stamina, hit points
Intelligence INT Logic, memory, arcane knowledge
Wisdom WIS Awareness, insight, perception
Charisma CHA Charm, leadership, persuasion, presence

Each score is typically a number between 1 and 20 for most player characters, though enemies, bosses, or magical creatures may go higher.

These base scores also translate into modifiers, using a simple formula:

Modifier = floor((Score - 10) / 2)

So a score of 14 gives you a +2 modifier. A score of 8 gives you a -1. These modifiers influence everything from attack rolls to saving throws and ability checks.


How We’re Translating This to Code

Instead of hardcoding values into characters, we’re going to build a modular Actor Component that handles these stats independently of any specific class. Think of it like this:

A UCharStatsComponent will live on the character and handle their entire stat profile.

This component will store:

  • All six ability scores
  • Their corresponding modifiers
  • A method to recalculate modifiers anytime scores change
  • A clean API to add or subtract points
  • Integration points for effects, traits, and class features later on

Rather than scatter all of these as separate variables, we’ll keep them organized inside a custom FStats struct, which we’ll explore and implement in the next post.

If the component is the engine, the FStats struct is the dashboard — a neat, readable container for all stat-related data.


Why Use an Actor Component?

By placing stats in their own component, we gain a lot of design flexibility:

  • Characters, enemies, NPCs, or even summoned creatures can all share the same logic
  • We can inspect and debug stats in isolation
  • We can scale the system easily — adding racial bonuses, class traits, or magical modifiers later
  • We stay organized, avoiding bloated character classes

This also keeps us aligned with Unreal’s design philosophy: keep Actors lightweight, and move reusable logic into components.


Where We’re Going From Here

In the next post, we’ll introduce the FStats struct, define our EAbility enum to represent the six core stats, and start building the UCharBaseStatsComponent from the ground up.

We’ll also cover how modifiers are calculated automatically anytime scores change, and how we can expose this to both C++ and Blueprints.

This is the first mechanical building block in our character system — and once it’s in place, the rest (initiative, HP, AC, spellcasting) will snap together like puzzle pieces.

Stay tuned — and feel free to share how you’re building your own stat systems in Unreal!


Coming Next:

Part 2: Implementing the FStats Struct and Calculating Modifiers

Top comments (1)

Collapse
 
frankdevs profile image
Francis Sougué

Can’t wait to see this project fully realized!