Skill Structure
server-go/shared/skill.go
Enumeration of available skills (currently only Foraging)
Current skill level (1-75)
Total accumulated experience points (0-99,999,999)
The
ALL_SKILLS array tracks all available skills for iteration during save/load operations.Adding Experience
Players gain XP through scripted activities:server-go/shared/player.go
XP Gain Logic
- Check max XP: If already at 99,999,999, no XP is added
- Add XP: Increment current XP by the amount (capped at MAX_XP)
- Level up: If XP exceeds the next level threshold, increase level
- Max level: Level 75 is the maximum, no further leveling
Usage in Scripts
Grant XP through the scripting API:server-go/scripts/context.go
server-go/content/berry_bush.go
Level Progression
XP Requirements
Each level requires a specific total XP amount:server-go/util/xp.go
- Start fast for early levels (level 2 at 211 XP)
- Gradually increase difficulty (level 10 at 51,273 XP)
- Require significant effort for high levels (level 75 at 9,607,040 XP)
Level Calculation
Levels are calculated by comparing current XP to the threshold table:- Iterates from current level to 74
- Finds the first threshold that hasn’t been reached
- Sets level to that threshold index + 1
- Only checks once per XP gain (efficient for single level-ups)
Persistence
Encoding to Database
Skills are serialized to binary format:server-go/shared/skill.go
Decoding from Database
server-go/shared/skill.go
Empty blob handling allows backward compatibility with players created before the skill system was added.
Player Save/Load
Skills are persisted alongside inventory and position:server-go/shared/player.go
Adding New Skills
To add a new skill:- Add to enum:
- Update ALL_SKILLS:
- Update encoding loop:
- Update decoding loop:
Client Synchronization
Skill updates are sent via theSkillUpdate packet:
- Array of skill IDs that changed
- Reference to player object (contains all skill data)
- Client updates UI to show new XP/level
XP Table Reference
Full XP Table (Levels 1-75)
Full XP Table (Levels 1-75)
Next Steps
Content Scripting
Learn how to grant XP through interactive content
Inventories
Explore the inventory system for storing rewards