Overview
Relaciona’s gamification system turns student profile data into interactive learning experiences. The platform includes multiple games that help students learn about their classmates while having fun.All games use session-based scoring and AJAX for instant feedback without page reloads.
Session-Based Scoring
The gamification system tracks performance using Django session storage.Score Tracking Pattern
Fromminigames/views.py:70-71, every game follows this pattern:
- Correct score: Number of correct answers in the current session
- Total attempts: Total number of questions answered
- Win percentage: Calculated as
correct / total
Game Prefixes
Each game uses a unique session prefix:| Game | Prefix |
|---|---|
| Face Guess | face_guess_ |
| Name to Face | name_to_face_ |
| Hangman | hangman_ |
| Student Interests | interests_ |
| Quiz Results | quiz_ |
| Complete Profile | complete_profile_ |
| Spotify Guess | spotify_ |
Score Management
Incrementing Scores
On each answer submission:Helper Function
Fromminigames/views.py:25-32, a unified response builder:
AJAX Instant Feedback
Games detect AJAX requests and return JSON instead of redirecting.Detection Pattern
Fromminigames/views.py:103-104:
Benefits
No Page Reload
Answers are submitted and scored without refreshing the page.
Instant Feedback
Students immediately see if they’re correct with custom messages.
Smooth UX
Gameplay feels fluid and responsive like modern web apps.
Anti-Repetition Logic
Games avoid showing the same student twice in a row for better engagement.Implementation
Fromminigames/views.py:108-114:
How It Works
This pattern applies to Face Guess, Name to Face, Hangman, and Spotify Guess games.
Text Normalization for Answers
The hangman and face guess games accept flexible text input.Normalization Function
Fromminigames/views.py:12-18:
Answer Validation
Fromminigames/views.py:86-96, the Face Guess game uses sophisticated matching:
Matching Logic
Answer Matching Rules
Answer Matching Rules
- Normalization: Both input and stored values are normalized (no accents, uppercase)
- Multiple Fields: Checks username, first_name, last_name, full_name, and nickname
- Exact Match: Direct equality after normalization
- Partial Match: Substring matching (minimum 3 characters)
- Bidirectional: Checks if answer is in valid name OR valid name is in answer
- “JUAN” matches “Juan Alberto González”
- “Gonzalez” matches “González” (accent removed)
- “Juanito” matches if it’s stored as nickname
- “JU” doesn’t match (too short for partial matching)
Game-Specific Features
Hangman Game Logic
Fromminigames/views.py:206-237, Hangman has unique state management:
- Track guessed letters to prevent repeats
- Display partial name with underscores for unknown letters
- Allow 6 incorrect guesses before game over
- Non-alphabetic characters (spaces) shown automatically
Quiz Results Matching
Fromminigames/views.py:323-326, shows a student’s VARK/Chapman results:
Complete Profile Game
Fromminigames/views.py:369-381, the most complex game combines multiple data points:
Student Filtering
Games filter available students based on profile completeness.Common Patterns
- Always exclude the current user (can’t guess yourself)
- Filter by required fields for game functionality
- Use
.distinct()to avoid duplicate students
Minimum Student Requirements
Fromminigames/views.py:136, many games require minimum participants:
Group Selection System
Fromminigames/views.py:35-48, games support both student and teacher access:
Student Access
Students automatically play with their assigned class group. No selection needed.
Teacher Access
Teachers choose which class to use for the game from their managed groups.
Age Calculator Utility
Fromminigames/views.py:20-23, used in several games:
Game Roster
Relaciona includes these gamified activities:Face Guess Game
Face Guess Game
Type: Text inputShow a profile picture, player types the student’s name.
- Flexible answer matching (multiple name fields, partial matches)
- Anti-repetition logic
- Requires profile pictures
Name to Face Game
Name to Face Game
Type: Multiple choiceShow a name, player selects the matching profile picture from 4 options.
- Random option shuffling
- Target + 3 distractors
- Requires 4+ students with pictures
Hangman Game
Hangman Game
Type: Letter guessingClassic hangman with student names.
- 6 incorrect guesses allowed
- Tracks guessed letters
- Shows partial progress
- Text normalization for accents
Student Interests Game
Student Interests Game
Type: Multiple choiceMatch a student’s profile picture to their description (age, favorite artist, motivation).
- Dynamically generates descriptions
- 4 student options
- Tests knowledge of personal interests
Quiz Results Game
Quiz Results Game
Type: Multiple choiceShow VARK and Chapman results, identify the student.
- Uses learning assessment data
- 4 student options
- Tests knowledge of learning preferences
Complete Profile Game
Complete Profile Game
Type: Multiple choiceMost comprehensive game showing age, favorite artist, VARK, Chapman, and motivation.
- Combines multiple data sources
- Shows “Pte” (pending) for incomplete assessments
- 4 student options
- Tests deep knowledge of classmates
Spotify Guess Game
Spotify Guess Game
Type: Multiple choiceListen to a Spotify song preview, guess whose favorite song it is.
- Embedded Spotify player
- Requires 4+ students with Spotify links
- Anti-repetition logic
- Tests knowledge of music preferences
Technical Architecture
Session Storage
Advantages:- No database writes for every answer
- Fast score updates
- Automatic cleanup on logout
- Per-user isolated scores
- Scores reset when session expires
- Not suitable for persistent leaderboards
- Requires
request.session.modified = Trueafter complex updates
AJAX Pattern
Future Enhancements
The current system is session-based. Potential enhancements could include:
- Persistent leaderboards across sessions
- Historical performance tracking
- Badges and achievements
- Time-based challenges
- Multiplayer simultaneous gameplay
- Performance analytics for teachers
Related Features
- User Profiles - Profile data powering the games
- Learning Assessments - VARK and Chapman results used in games
- Class Groups - Games played within class contexts