PlayerWords

Word-guessing vocabulary activity for Moodle — full documentation.

English | Português

View on GitHub Download .zip

Moodle Plugin CI Moodle License Status PlayerGames Ecosystem Game Activity

PlayerWords is a word-guessing vocabulary activity for Moodle. Students guess a hidden word letter-by-letter within a configurable number of attempts, receiving colour-coded and symbol feedback on each guess.

Use the sidebar to jump to any section on this page.

Source code: github.com/jeanlucio/moodle-mod_playerwords


✨ Features

🎓 Educational Purpose

PlayerWords is designed to:

Suitable for:

🕹️ PlayerGames Ecosystem

PlayerWords is part of the PlayerGames gamification ecosystem for Moodle. Its main direct integration is with the PlayerHUD block:

See the author’s Moodle Plugins Directory profile for the full PlayerGames family.

📦 Requirements

Component Version
Moodle 4.5+
PHP 8.1+

🛠️ Installation & Configuration

  1. Download the .zip file or clone this repository.
  2. Extract the folder into your Moodle mod/ directory.
  3. Rename the folder to playerwords (if necessary). Final path: your-moodle/mod/playerwords/
  4. Visit Site administration > Notifications to complete installation.
  5. Add a PlayerWords activity to any course.

This plugin has no separate site-level settings to configure after installation — every setting is configured by the teacher when adding the activity to a course, as covered in Usage below.

📖 Usage

  1. Add a PlayerWords activity to your course.
  2. Configure:
    • Word length range and maximum attempts
    • Cooldown between rounds and round limit
    • Word mode (random or shared sequence)
    • Grading method and gradebook settings
    • Word sources (manual, Glossary, AI), Glossary source, and a stopword list to skip when splitting multi-word glossary concepts (all optional)
    • PlayerHUD item costs and win grant (optional, when PlayerHUD block is present)
  3. Open the Manage words page to add, generate with AI, approve, edit, or delete words.
  4. Students play directly from the activity page — guessing, revealing hints, and forfeiting rounds, with no page reload. The page’s own toolbar gives access to the rules (help), attempt history, and the ranking.
  5. Grades and ranking update automatically after each round.

🧮 Grading & Ranking

PlayerWords computes a grade and a ranking total from the same finished rounds, but the two are configured completely independently — a teacher can keep the grade simple while still rewarding efficient play in the ranking, or the other way around.

Both are entirely optional, and each is switched on or off on its own:

Turning one off never affects the other: an activity can be graded with no ranking, ranked with no grade, both, or neither.

Per-round scoring decides how much a single round is worth, chosen separately for the grade and for the ranking (Grade scoring / Ranking scoring settings, both default to Binary):

Mode A won round is worth… A lost, forfeited, or timed-out round
Binary (default) The full activity grade Zero
Linear Full credit on the first two attempts, then a share proportional to attempts spared: grade × (max_attempts − attempts_used + 1) / (max_attempts − 1) Zero

Linear gives full credit on the first two attempts — a confident second guess is not treated as less deserving than a first-try one, since this is a non-punitive educational game rather than a luck-based guessing contest — then scales the remaining attempts down proportionally, never fully zeroing out a win: even winning on the very last allowed attempt still earns a positive share. Example with a 100-point grade and 6 maximum attempts:

Attempts used Linear points
1 100.00
2 100.00
3 80.00
4 60.00
5 40.00
6 20.00
Not completed 0.00

With Maximum attempts set to 2 or fewer, Linear is numerically identical to Binary — every allowed attempt already falls within the full-credit plateau.

Combining several rounds into one final grade is a separate setting, Grading method (highest grade, average grade, first attempt, last attempt, or average over all required rounds). It works the same regardless of whether the per-round scoring above is Binary or Linear: it only ever aggregates whatever value each round already recorded.

The ranking is the sum of every finished round’s ranking points for a student (SUM), ordered highest first; ties are broken by fewer attempts used on average, then less time spent on average. It only appears when the teacher enables “Show ranking”, and never reveals a round still in progress.

Only the top 5 are shown — deliberately, not a bug: both the in-game ranking widget and the dedicated ranking page cap the list at 5 rows, to avoid publicly ranking every student in the class. A student ranked lower still sees exactly where they stand: an extra row, separated by “…”, shows their own real position and score, without exposing anyone else’s rank below 5th. Anyone who can manage the activity (editingteacher, manager) never appears in the ranking at all, even if they play the activity themselves — the same way their own attempts are excluded from the attempt report below.

“Show ranking” only controls visibility, not data collection: ranking points are computed and stored for every finished round regardless of whether the setting is on or off at the time. Turning it on after students have already played reveals the full total accumulated since the activity started, not just the points earned from that moment forward — nothing is lost, and nothing needs to be “recovered” by switching it off and back on.

Locked once graded: the moment the activity records a real grade for any student, Maximum attempts, Grade scoring and Ranking scoring all lock — the same way Moodle already locks a graded activity’s own “Maximum grade” field once real grades exist. This guarantees every round ever recorded for that activity was scored under the exact same rules, so the grade and the ranking total both stay internally consistent for the activity’s whole lifetime.

Attempt history: each student can review their own past rounds — word, attempts used, time, grade score and (when ranking is enabled) ranking points — from the toolbar’s attempt-history page. Whoever can manage the activity sees the same page turn into a report covering every student instead: one table, 30 rows per page, sortable by clicking any column header, and filterable to a single student. Like the ranking, it never includes a manager’s own attempts, even if they played the activity themselves.

🧪 Automated Tests

PlayerWords ships with a PHPUnit test suite covering business logic, repository queries, web services, and Privacy API compliance. Every CI push runs against the full matrix (Moodle 4.5 → 5.x, PostgreSQL & MariaDB).

PHPUnit — Core Tests

Test file Cases
backup_restore_test.php 5
cross_instance_security_test.php 4
lib_grant_potential_test.php 6
lib_reset_userdata_test.php 4
completion/custom_completion_test.php 7
privacy/provider_test.php 14
Subtotal 40

Local Business-Logic Tests (tests/local/)

Test file Cases
ai_word_generator_test.php 12
attempts_history_service_test.php 14
gameplay_service_test.php 19
hud_service_test.php 22
intro_service_test.php 5
ranking_service_test.php 6
round_presenter_test.php 35
round_service_test.php 30
view_page_service_test.php 16
word_normalizer_test.php 16
words_repository_test.php 56
Subtotal 231

Web Services Tests (tests/external/)

Test file Cases
count_eligible_words_test.php 5
count_glossary_candidates_test.php 4
end_round_test.php 4
new_round_test.php 3
reveal_hint_test.php 6
start_round_test.php 5
submit_guess_test.php 7
Subtotal 34
Grand Total 305
vendor/bin/phpunit --testsuite mod_playerwords

Overall line coverage (moodle-coverage, PHPUnit + Xdebug): 63%.

Full test-by-test breakdown and coverage table →

🔐 Security & Compliance

🔒 Third-party Service Disclosure

AI word generation is optional and disabled by default. When a teacher uses it, the activity topic (never student data or attempt records) is sent through local_aihub — using that user’s or the site’s own BYOK key, if the plugin is installed — or, as a fallback, through Moodle’s own core AI subsystem (core_ai), which routes to whatever provider the site administrator has configured. PlayerWords never contacts an AI provider directly; the request and its disclosure/consent are entirely owned by local_aihub or by core_ai. If neither is installed or configured, the AI word source is unavailable and every other feature keeps working normally.

📄 License

This project is licensed under the GNU General Public License v3 (GPLv3).

Copyright: 2026 Jean Lúcio