|
| 1 | +--- |
| 2 | +title: "GSoC ’25 Week 08 Update by Aditya Kumar Singh" |
| 3 | +excerpt: "Resolved key issues in shared Paint & Tour workflows, introduced a real-time XO-icon leaderboard in Doctor mode, and bootstrapped the Stickman activity scaffold." |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-07-09" |
| 6 | +slug: "2025-07-08-gsoc-25-AdityaKrSingh26-week08" |
| 7 | +author: "@/constants/MarkdownFiles/authors/aditya-singh.md" |
| 8 | +tags: "gsoc25,sugarlabs,week08,AdityaKrSingh26" |
| 9 | +image: "assets/Images/GSOC.png" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 07 Progress Report by Aditya Kumar Singh |
| 15 | + |
| 16 | +**Project:** [Sugarizer](https://github.com/llaske/sugarizer) |
| 17 | +**Mentors:** [Lionel Laské](https://github.com/llaske) |
| 18 | +**Assisting Mentors:** [Samarth Bagga](https://github.com/SamarthBagga) |
| 19 | +**Reporting Period:** 2025-07-03 – 2025-07-09 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Goals for This Week |
| 24 | + |
| 25 | +- **Goal 1:** Bug-hunt Shared Paint & Tour PR (Restore zoom-out capability when a session starts at a custom FOV, Guarantee that newcomers instantly receive every painted mesh, Ensure the palette reflects the host-selected mode (Paint / Tour / Doctor) on join.) |
| 26 | +- **Goal 2:** Finish Doctor refactor – replace the legacy username-only leaderboard with XO icons tinted to each participant’s Sugar colour. |
| 27 | +- **Goal 3:** Kick-off Stickman Activity – create a blank shell with full toolbar assets ready for upcoming features. |
| 28 | + |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## This Week’s Achievements |
| 33 | + |
| 34 | +1. **Fixed Zoom-Out Limitation** |
| 35 | + - **Issue:** When the Human Body activity was opened with a custom zoom level, users were unable to zoom out due to improper FOV (Field of View) limits. |
| 36 | + - **Fix:** |
| 37 | + - Implemented clamped zoom logic by calculating and bounding the `camera.fov` value between 5° and 75°. |
| 38 | + - Both scroll wheel and toolbar zoom now honor the same constraints. |
| 39 | + - This method ensures that camera zoom respects a realistic viewing range, preventing the camera from getting stuck in an unusable state. |
| 40 | + ```javascript |
| 41 | + function getFov(zoom) { |
| 42 | + return Math.min(Math.max(zoom, 5), 75); // clamp zoom to valid FOV range |
| 43 | + } |
| 44 | +2. **Shared Paint Mode – Late Joiner Synchronization** |
| 45 | + - **Issue:** When a new user joined an already shared Paint session, the previously painted parts weren’t visible to them. |
| 46 | + - **Fix:** |
| 47 | + - The host maintains a complete list of painted parts and their corresponding color mappings in paintedPartsList. |
| 48 | + - When a new user joins, the host invokes: `sendFullPaintDataToNewUser(presenceId)` |
| 49 | + - This sends all `meshName → hexColor` mappings via the `syncAllPaintData` action. |
| 50 | + - Peers then replay this data and apply consistent material colors to each 3D mesh |
| 51 | + - This method ensures that camera zoom respects a realistic viewing range, preventing the camera from getting stuck in an unusable state. |
| 52 | + |
| 53 | + |
| 54 | +3. **Mode Palette Sync Across Clients** |
| 55 | + - **Issue:** The palette mode (Paint, Tour, Doctor) would sometimes display inconsistently across users in a shared session. |
| 56 | + - **Fix:** |
| 57 | + - Centralized mode state and now rebroadcast on every mode change. |
| 58 | + - When any user joins, their client listens to `syncCurrentMode` and updates icons accordingly: |
| 59 | + - **Effect:** UI remains consistent regardless of when users join or switch modes. |
| 60 | + |
| 61 | + |
| 62 | +4. **Redesigned Doctor Mode Leaderboard with XO Icons** |
| 63 | + - **Objective:** Replace the old leaderboard (just usernames and scores) with a Sugar-style UI using XO icons and user colors. |
| 64 | + - **Implementation Highlights:** |
| 65 | + - `generateXOLogoWithColor(userColor)`: A dynamic SVG generator that outputs an XO icon with the user’s stroke and fill colors, derived from Sugar presence data. |
| 66 | + - `showLeaderboard()`: Constructs a ranked visual layout showing each user’s XO icon, name, and score—updated in real time with every correct answer. |
| 67 | + - **Algorithm Steps:** |
| 68 | + - Maintain a scoreBoard object mapping presenceId → {score, userInfo}. |
| 69 | + - Upon a correct answer: |
| 70 | + - Host sends a `scoreUpdate` broadcast. |
| 71 | + - All peers update their UI leaderboard. |
| 72 | + - Leaderboard HTML is re-rendered using updated user data and SVG icons. |
| 73 | +  |
| 74 | + |
| 75 | + |
| 76 | +3. **Stickman Activity – Initial Scaffold** |
| 77 | + - Created an initial version of the activity. |
| 78 | + - Toolbar now displays all expected icons (draw, move, add frame, delete frame, play, stop). |
| 79 | + - Currently, button clicks do nothing—but the structure is laid out to integrate drawing and animation logic next week. |
| 80 | +  |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## Challenges & How I Overcame Them |
| 87 | + |
| 88 | +- **Challenge:** Simultaneous paint broadcasts leading to race conditions. |
| 89 | + **Solution:** Ensured all paints are stored only on host, then synced post-join via a single action. |
| 90 | + |
| 91 | +- **Challenge:** Dynamic XO SVGs without image files. |
| 92 | + **Solution:** Used inline SVG with JS string templates to create colored icons on-the-fly. |
| 93 | + |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Key Learnings |
| 98 | + |
| 99 | +- Gained in-depth understanding of Three.js camera manipulation and persistence. |
| 100 | +- Built a robust synchronization pattern using presence broadcasts and authoritative state snapshots. |
| 101 | +- Practiced UI/UX consistency across Sugarizer activities with reusable SVG elements and Sugar-specific color schemes. |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## Next Week’s Roadmap |
| 106 | + |
| 107 | +- Write Weekly Blog Post summarizing progress, screenshots, and key learnings. |
| 108 | +- Fix Remaining Issues in Human Body Activity |
| 109 | +- Stickman Dashboard – Draw & Move |
| 110 | +- Stickman Frame Management |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Acknowledgments |
| 115 | + |
| 116 | +Thank you to my mentors, the Sugar Labs community, and fellow GSoC contributors for ongoing support. |
| 117 | + |
| 118 | +--- |
0 commit comments