XP Guide#39
Open
DannyIsYog wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add XP progression guide (Nakama + Hiro + Unity)
Summary
Adds the XP Guide companion project under
Guides/: an end-to-end XP progression system built on Hiro's Achievements and Economy systems, with a Nakama server plugin and a Unity client.The guide demonstrates how to model player levels as sub-achievements driven by an XP currency, so that granting XP anywhere in the game automatically advances the player's level without callers needing to know levelling exists.
How it works
XP is a currency, and levels are sub-achievements of a
player_levelsgroup, each with amax_countequal to the XP required to complete it (100, 200, ... 1000 for levels 1–10).The flow:
rpc_grant_xpwith a base amount.xpcurrency via the Economy reward APIs, so active modifiers (e.g. a double-XP booster) apply.XPLevelPublisherlistens for thecurrencyGrantedevent onxpand advances the level sub-achievements by the actual granted amount.UpdateAchievementscall, so one large grant can complete several levels and partially fill the next.auto_claim, so completing one grants its gem reward immediately.Routing progression through the publisher rather than the RPC means any future XP source gets levelling for free.
The quest group (
defeat_thunder_world) exists to exercise the loop from a realistic source: its sub-quests grant XP, gems, and coins, and one of them grants a 2× XP reward modifier for 120 seconds, which the client surfaces as an active-booster badge.Testing
XPControllerTestspass against a local Nakama instance.defend_the_villageactivates the 2× booster badge and doubles subsequent XP grants.