×
Description
Changelog
Reviews (0)
Reusable RPG stats and XP leveling components for Godot 4: health and mana pools, attributes, flat and percent modifiers you can tag by source, and a level curve with stat points to spend.
Features
Statresource: a base value, a min and max, a current value, andvalue_changedanddepletedsignals.- Pools and attributes. Health, stamina and mana are pools you spend and
refill. Strength, dexterity and the rest are attributes.
get_value()returns the right number for each: a pool's live value, or an attribute's fully modified value. - Source-tagged modifiers.
set_modifier(&"strength", &"equipment/iron_sword", 20)adds a bonus you can remove later by name, without touching any other bonus. Setting the same source twice replaces it instead of stacking. - Clear by source or by category:
clear_source(&"equipment/iron_sword")takes one item off every stat it touched, andclear_modifiers_from_prefix("buff/")wipes a whole category. - Flat and percent:
(base + flat) * (1 + percent), so a +25% blessing scales your gear too. StatsComponent: attach it to any character. Each instance duplicates its stat definitions, so enemies sharing one.tresnever share health.LevelingComponent: an exponential XP curve, several level-ups from one big XP gain, stat points per level, and per-stat point costs.- Save and load:
get_stats_snapshot()andget_save_data()return plain dictionaries you can write to disk. StatPresets: ready-made stat sets (souls-like, simple RPG, action, survival, minimal).
Requirements
- Godot 4.7 or later, standard build (GDScript only, no .NET needed).
- Tested on Godot 4.7.2 stable on Windows. Earlier 4.x versions are untested.
- Uses the Compatibility renderer, so it runs on older GPUs too.
Quick Start
- Press F5.
- Click +200 XP to level up, then spend the points on STR, DEX or VIT.
- Toggle the Iron Sword and watch Strength go up by 20, then come back down.
- Toggle the Blessing, then Rest: max health grows by 25% and the pool fills to the new max.
- Click Save, change some things, then Load.
Known Limitations
- Snapshots save base and current values, level, XP and points. Modifiers are not saved: re-apply them from your equipment and buffs when you load.
_initialize_stats()builds the stats. It runs in_ready(); call it again yourself if you setstat_definitionsin code afterwards, as the demo does.- Stat points always add 1 to the base value. Spending a point on vitality does
not also raise health; connect
stat_point_spentif you want derived stats. - The demo is a UI panel, not a game scene.
- Tested on Godot 4.7.2 on Windows only.
License
MIT. See LICENSE.
Third-Party Assets
None. The demo uses Godot's built-in UI theme and fonts.
Learn How It Works
Want to understand how this works instead of just copying it?
CodingQuests teaches you how to build systems like this step by step in Godot, with interactive lessons and real projects.
- Stats & Leveling System
builds these components lesson by lesson, from a single
Statresource to levelling and stat points. The first 4 lessons are free with a free account, and the first 2 need no account at all.
Source code, integration instructions and issue tracker: https://github.com/CodingQuests/godot-stats-leveling
Changelog for version 1.0.0
2026-10-17 01:27:41
No changelog provided for this version.