Daily Quest Mechanics
Relevant source files
The following files were used as context for generating this wiki page:
The Daily Quest Mechanics represent the core engagement and progression loop of the Solo System. This system gamifies daily habits and physical exercises by assigning them "quest" status, providing rewards in the form of experience points (XP), and enforcing penalties for non-compliance. The system is designed to track user progress through various ranks and levels, mirroring the progression found in RPG-style "leveling" systems.
The mechanics are entirely client-side, utilizing browser local storage to persist user data, including points, current tasks, and penalty history. It operates on a daily cycle based on the Asia/Riyadh time zone, ensuring that tasks are refreshed and penalties are calculated at the start of each new day.
Core System Architecture
The system's architecture is built around a centralized state object and several key logic functions that handle data persistence, UI updates, and the daily refresh cycle.
Data Model and Persistence
The system state is stored in localStorage under the key solo_penalty_v1. The data structure includes:
points: The cumulative XP of the user.lastUpdate: The date of the last system sync (ISO format).dailyTasks: An array of task objects currently assigned to the user.lastPenalty: The amount of XP deducted during the last daily transition.
Sources: Quest.html:120-123, index.html:120-123
The Daily Cycle Flow
The system executes a "Daily Cycle" check every time the page is loaded. This check determines if a new day has started by comparing the current KSA date with the lastUpdate field.
The logic ensures that users are penalized for any tasks left unchecked before the day rolls over.
Sources: Quest.html:164-186, index.html:164-186
Task Management and Difficulty Scaling
Tasks are dynamically generated from a predefined taskDatabase and scaled according to the user's current rank.
Task Categories
The system categorizes tasks into three main domains:
- Physical: Strength and endurance exercises (e.g., Push-ups, Squats, Plank).
- Discipline: Routine habits (e.g., Bed making, Water intake).
- Mental: Intellectual growth (e.g., Reading).
Difficulty Scaling (The Rank Config)
The difficulty of tasks and the magnitude of rewards/penalties are dictated by the getRankConfig function. As a user earns more points, the system shifts the "difficulty key" used to select task descriptions from the database (e.g., from 'f' for easy to 'r' for hard).
| Rank | Points Required | Reward (XP) | Penalty (XP) | Level Req (XP) | Difficulty Key |
|---|---|---|---|---|---|
| F/E | 0 - 149 | 2 | 3 | 10 | f |
| D/C/B | 150 - 799 | 3-4 | 5-6 | 12-20 | d |
| A/S | 800 - 1999 | 4 | 6 | 25-30 | a |
| SS/R | 2000+ | 6 | 8 | 40-50 | r |
Sources: Quest.html:105-118, Quest.html:125-135, index.html:125-135
Leveling and Progression Logic
The system distinguishes between Rank (milestone-based) and Level (incremental).
Level Calculation
The calculateLevel function uses a recursive-style logic to determine the user's current level based on points. Unlike a static XP table, the requirement to reach the next level scales dynamically based on the current rank configuration's req (requirement) value.
Sources: Quest.html:137-146, index.html:137-146
UI Components and Interaction
The interface provides real-time feedback on task completion and system status.
- Task Interaction: Clicking a task card triggers the
toggleTask(i)function. This function flips the task's completion status (d), adds or subtracts the rank-specific reward from the total points, and immediately saves the state. - Visual Indicators:
- Completed tasks are styled with the
.completedclass, reducing opacity and applying a grayscale filter. - The
xp-bartransitions its width based on the percentage of progress toward the next level. - The
status-msgdisplays a red penalty alert iflastPenalty > 0.
- Completed tasks are styled with the
Sources: Quest.html:150-162, Quest.html:188-194, index.html:188-194
Summary of Quest Lifecycle
The Daily Quest Mechanics create a self-sustaining loop of accountability. By leveraging the Riyadh time zone for synchronization and Local Storage for persistence, the system ensures that user progress is tracked accurately without the need for a backend server. The dynamic scaling of rewards and task difficulty ensures the "Solo Leveling" experience remains challenging as the user's total XP grows.