Leveling Mechanics
Relevant source files
The following files were used as context for generating this wiki page:
- index.html
- Quest.html
- README.md
- LICENSE (Assumed standard repository file)
- .gitignore (Assumed standard repository file)
The Leveling Mechanics in the Solo System project govern the progression of a user through various ranks and levels based on the completion of daily tasks. The system utilizes a point-based XP (Experience Points) architecture to determine a user's standing, applying both rewards for task completion and penalties for failure to meet daily requirements.
This system is designed to simulate a "game-like" progression interface where physical, mental, and disciplinary activities translate into numerical growth and rank advancement.
Sources: index.html:112-140, Quest.html:112-140
Core Progression Logic
The progression logic is divided into two primary metrics: Ranks and Levels. While Ranks represent broad tiers of achievement (F through R), Levels provide granular progress within those tiers.
Rank Configuration
Ranks are determined by the total accumulated points. Each rank defines the specific rewards gained from tasks, the penalties for incomplete tasks, and the XP requirements for leveling up within that tier.
| Rank | Min Points | Reward (+XP) | Penalty (-XP) | Level Req (XP) | Difficulty Tier |
|---|---|---|---|---|---|
| F | 0 | 2 | 3 | 10 | f |
| E | 70 | 2 | 3 | 10 | f |
| D | 150 | 3 | 5 | 12 | d |
| C | 300 | 3 | 5 | 15 | d |
| B | 500 | 4 | 6 | 20 | d |
| A | 800 | 4 | 6 | 25 | a |
| S | 1200 | 4 | 6 | 30 | a |
| SS | 2000 | 6 | 8 | 40 | r |
| R | 3000 | 6 | 8 | 50 | r |
Sources: index.html:129-138, Quest.html:129-138
Level Calculation
Levels are calculated iteratively. A user starts at Level 1, and the system checks if their total points exceed the requirement for the current level. If so, those points are "consumed" for the calculation, and the level increments until the remaining points are less than the next level's requirement.
This diagram illustrates the iterative loop used in the calculateLevel function to determine the user's current numeric level based on cumulative XP.
Sources: index.html:140-149, Quest.html:140-149
Task System and XP Flow
Leveling is driven by the interaction with the taskDatabase. Tasks are categorized into physical, discipline, and mental. The difficulty of the task assigned depends on the user's current rank tier (f, d, a, r).
Data Flow for Task Completion
When a user toggles a task, the system calculates the change in points based on the reward value associated with their current rank.
This sequence shows the flow from a user action to the persistent storage and UI update.
Sources: index.html:184-192, Quest.html:184-192
Penalty System
A critical component of the leveling mechanics is the daily cycle check. The system tracks the date using the Asia/Riyadh timezone. If a user returns on a new day and has incomplete tasks from the previous session, a penalty is applied.
- Penalty Calculation: The number of incomplete tasks is multiplied by the
pen(penalty) value of the rank the user held during those tasks. - Floor Limit: The system ensures points never drop below 0.
- Message Triggers: If a penalty is applied, a
lastPenaltyflag is set, which triggers a red warning message in the UI.
Sources: index.html:164-182, Quest.html:164-182
Data Persistence
The leveling state is maintained in localStorage under the key solo_penalty_v1. The stored object structure includes:
points: The total XP.lastUpdate: The last recorded date inYYYY-MM-DDformat.dailyTasks: An array of task objects{n: name, c: category, d: done}.lastPenalty: The amount of XP lost in the last cycle.
Sources: index.html:125-127, index.html:204, Quest.html:125-127
Conclusion
The Leveling Mechanics of the Solo System provide a robust framework for gamified habit tracking. By linking XP requirements and task rewards to a dynamic rank system, it creates a scaling difficulty curve that adjusts as the user progresses. The integration of a daily penalty system ensures accountability, making XP a volatile resource that requires consistent engagement to maintain and grow.