02GeoQuest
Playable Map Studio — turn any QGIS vector layer into an educational quiz game • v1.3.2
1. Overview
02GeoQuest transforms QGIS vector layers into interactive geography games, educational quizzes, data-familiarisation tools, and public-engagement challenges. It features 9 game modes (including Compass Quest geodetic bearings), 3 difficulty levels, 3 joker types, Quest Pack import/export with starter packs, printable Achievement Certificates, a persistent leaderboard, a full class-mode with student profiles and CSV export, and a self-contained offline HTML game exporter. The entire system operates locally inside QGIS with zero external dependencies, no API keys, no accounts, and no pip-installed packages.
The plugin is a dock-based quiz studio with four pages: Play (the active game), Builder (configuration & quest packs), Scores (leaderboard & certificates), and Share (HTML export and class mode).
2. Game Modes
| Mode | Description | Requires | HTML Export |
|---|---|---|---|
| Map Hunt ("locate") | Click the named feature on the QGIS canvas | Any features | — |
| Value Duel ("bigger") | Two features: pick the one with the larger numeric value (the prompt names the field or its alias); without a numeric field, the larger area | Numeric field or polygons | Yes |
| Distance Guess ("distance") | Estimate the ground distance between two places, in metres for city-scale quests (widest pair under 20 km) and kilometres otherwise | Geographic centroids | Yes |
| Know the Shape ("silhouette") | Identify a polygon feature from its simplified outline | 4+ polygons | Yes |
| Attribute Guess ("attr_guess") | Estimate a numeric attribute via a slider | 2+ numeric values | Yes |
| Ranking ("ordering") | Order 3–4 features from highest to lowest value | 3+ distinct values | Yes |
| Nearest Neighbour ("nearest") | Identify which feature is closest to a reference | 4+ valid records | Yes |
| Blind Zoom ("blind_zoom") | Canvas zooms to a feature; name it. Point features get at least ~300 m of context | 2+ records with a known extent | — |
| Compass Quest ("direction") | Pick the 8-point compass direction from one place to another (forward geodetic azimuth). Pairs within 5° of a sector boundary are never asked | Geographic centroids | Yes |
Map Hunt and Blind Zoom are excluded from HTML export because they require QGIS canvas interaction.
3. Difficulty Levels
| Level | Timer | Choices | Tolerance |
|---|---|---|---|
| Easy | 60 s | 3 | 0.40 |
| Medium | 30 s | 4 | 0.25 |
| Hard | 15 s | 6 | 0.10 |
Tolerance governs the acceptable error for distance guesses and attribute slider estimates. For Distance Guess it is relative to the true distance (0.25 means within ±25%); for Attribute Guess it is relative to the value range of the quest, so zero and negative values are judged fairly. The distance input range comes from the widest pair in the quest and starts at zero, so it never reveals the answer. On Medium and Hard, Nearest Neighbour draws its wrong options from progressively closer neighbours.
4. Jokers
Three Joker Types, Each Usable Once Per Quest
- Eliminate: Removes up to 2 wrong multiple-choice options; at least one wrong option always stays. Offered only when two wrong options exist, so it is never spent on a two-way Value Duel. Available in: Silhouette, Nearest Neighbour, Blind Zoom, Compass Quest.
- Value Hint: Halves the input range to a window that always contains the answer, placed at a random offset. Available in: Attribute Guess, Distance Guess.
- Map Hint: Zooms the canvas to a window four times the feature's extent (at least ~1 km for points), off-centre so the target is inside but not in the middle. Available in: Map Hunt, Blind Zoom.
Default joker pool: 3 total (configurable 0–9).
5. Scoring Engine
Points are computed per answer as:
- Base: 500 points
- Speed bonus: max(0, 150 − elapsed_seconds × 8)
- Streak bonus: min(300, max(0, streak − 1) × 30)
- Closeness multiplier: clamped to [0.25, 1.0]; rewards near-misses for slider/distance modes
- Total: int((500 + speed_bonus + streak_bonus) × closeness)
Timed-out answers are automatically wrong regardless of correctness. The game ends when rounds are exhausted or lives reach zero. The session summary includes: total score, rounds played, correct count, accuracy percentage, best streak, lives remaining, and total duration.
6. Builder Controls
| Section | Control | Options |
|---|---|---|
| Source Layer | Layer picker, label field, numeric field | Single vector layer (layer A). Layers above 500 features are sampled evenly across the whole layer |
| Second Layer | Checkbox toggle, duplicate controls | Optional cross-layer play (layer B) |
| Challenge Mix | 9 checkboxes | Modes without suitable data are skipped at start, with the reason shown |
| Difficulty | Three toggle buttons (Easy / Medium / Hard) | Affects timer, choices, tolerance |
| Quest Rules | Title combo with presets, rounds (3–60), lives (1–10), jokers (0–9) | Preset titles: My Map Quest, City Explorer, Data Detective, etc. |
7. Workflow Guide
- Open the 02GeoQuest dock from the toolbar.
- On the Builder tab, select a vector layer. Optionally add a second layer for cross-layer play.
- Choose a label field (for display names) and an optional numeric field (for value-based modes).
- Select game modes from the 9 checkboxes. Modes lacking sufficient data are skipped when the quest starts, and the Builder says which and why.
- Set difficulty and quest rules (rounds, lives, jokers).
- Click Start the quest. The dock switches to the Play page.
- Questions appear in sequence with the appropriate input widget (multiple-choice buttons, slider, spinbox, or map pick).
- The timer bar changes colour at 50% (yellow) and 25% (red). Use jokers as needed. With the dock focused, keys 1–9 pick an answer and Enter submits or moves on.
- In Map Hunt, Pick on map re-activates the picking tool if you switched to pan or zoom. Overlapping features under the click all count.
- After the last round or when lives reach zero, the final score is saved to the leaderboard. Play again replays the same source: the loaded Quest Pack, or the Builder's layer.
8. Class Mode and Student Profiles
Teacher Tools
Student profiles: Create named profiles with emoji avatars (10 choices: map, cityscape, globe, compass, pin, mountain, wave, leaf, star, fire). Profiles are stored as JSON in QgsSettings.
Session tracking: Select an active profile before playing; each completed quest is logged with player name, avatar, quest title, difficulty, score, accuracy, best streak, correct count, rounds, duration, and date. Sessions persist across QGIS restarts (last 300 sessions retained).
CSV export: Export all sessions to a UTF-8 BOM CSV file for grading and record-keeping via standard csv.DictWriter.
9. Offline HTML Game Export
Self-Contained, Zero-Dependency HTML
Exports a single HTML file with an embedded JavaScript game engine that reimplements the question generation and uses the same scoring formula, difficulty (timer, choices, tolerance) and lives as the QGIS quest. Excludes Map Hunt and Blind Zoom. Each page load is seeded from the browser's random source, so replays differ. Features: balanced mode rotation, keyboard play (1–9, Enter), dark mode following the system setting with a toggle, responsive single-column layout below 560 px, proportional silhouettes, progress dots, ranking via Up/Down buttons, a results screen with best streak and a per-device personal best, and in-place replay. Embedded data cannot close the script element (</ is escaped), labels are inserted as text, and only label, value, area, centroid and outline leave QGIS. Zero CDN, zero network calls, zero tracking.
10. Technical Notes
- Pure-Python core: The game engine, question factory, scoring, Quest Packs and HTML exporter have zero QGIS imports and are tested with plain CPython; the profile manager only needs
QgsSettings. - LCG-based PRNG: A 32-bit linear congruential generator (Numerical Recipes constants, seeded from
time.time_ns()) avoids stdlibrandomto keep QGIS Hub Bandit B311 scans clean. Draws use the high bits, because the low bits of a power-of-two LCG repeat with a tiny period. - Layer data serialisation: Features are immediately serialised to plain dictionaries with no QGIS object references held, keeping memory predictable and enabling pure-Python tests.
- Question factory: Maintains an 8-deep short-term memory of recent feature combinations and pairs to avoid repeats; computes valid pairs, distance pairs and nearest-neighbour options once, on first use, and reuses them. Value Duel compares the numeric field whenever it has two different values and area only otherwise, never a mix of both.
- Starter packs: All populations come from one source and one definition — UN DESA, World Urbanization Prospects 2018, urban agglomeration population in 2018, rounded to the nearest thousand.
- Adaptive theme: All UI colours derive from the active Qt
QPalettewith WCAG 4.5:1 contrast compliance. Reapplies onPaletteChangeandApplicationPaletteChangeevents. - QGIS compatibility: 3.34 through 4.x. Dual Qt5/Qt6 support via try/except for
QActionimport location.
11. Literature
- Prensky, M. (2001). Digital Game-Based Learning. McGraw-Hill.
- Gee, J. P. (2003). What video games have to teach us about learning and literacy. Computers in Entertainment, 1(1), 20. DOI: 10.1145/950566.950595
- Hamari, J., Koivisto, J., & Sarsa, H. (2014). Does gamification work? — A literature review of empirical studies on gamification. Proceedings of the 47th Hawaii International Conference on System Sciences, 3025–3034. DOI: 10.1109/HICSS.2014.377
- Kapp, K. M. (2012). The Gamification of Learning and Instruction: Game-Based Methods and Strategies for Training and Education. Pfeiffer.