Defense Grid Run¶
Defense Grid Run is a Pac-Man-style military defense game that demonstrates the GVA external application interface while providing an entertaining stealth navigation experience for operator training and recreation.
Joystick Required
Defense Grid Run requires a joystick or gamepad to play due to its more complex controls (8-directional movement, EMP activation, pause menu navigation). The standard HMI soft keys provide limited functionality for this game.

Gameplay in action:

Overview¶
Defense Grid Run is a maze navigation game where players control a stealth drone to collect intel packets while avoiding autonomous defense bots. It showcases:
- External application registration
- Display rendering via Qt Quick vector graphics
- Soft key input handling
- Game state management
- AdLib sound synthesis integration
- GVA alarm system integration
Gameplay¶
Objective¶
Navigate the defense grid maze, collect all intel packets, and avoid detection by defense bots. Use EMP bursts strategically to stun enemies and create safe passage.
Controls¶
Keyboard Controls¶
| Key | Function |
|---|---|
| ↑ ↓ ← → | Move drone |
| W A S D | Move drone (alternate) |
| SPACE | Activate EMP burst |
| ESC / P | Pause game |
| ENTER | Start game / Select menu |
| F11 / F | Toggle fullscreen |
HMI Soft Key Controls¶
| Soft Key | Function |
|---|---|
| 1 (↑) | Move up |
| 2 (↓) | Move down |
| 3 (←) | Move left |
| 4 (→) | Move right |
| 5 | EMP burst |
| 6 | Pause / Exit |
Scoring¶
| Item | Points |
|---|---|
| Intel Packet | 100 |
| Level Bonus | Level × 500 |
Defense Bots¶
The game features three types of defense bots with different AI behaviors:
| Type | Appearance | Behavior |
|---|---|---|
| Patrol Bot | Red hexagon | Follows fixed patrol routes along corridors |
| Pursuit Bot | Orange hexagon | Actively chases player when detected within 150 pixels |
| Guard Bot | Yellow hexagon | Moves slowly toward player when they approach |
All bots can be temporarily stunned using EMP bursts.
Power-ups¶
- EMP Burst: Electromagnetic pulse that stuns all enemies temporarily (3 seconds)
- Limited charges - use wisely!
- Earn additional charges by completing levels (max 3)
Game Architecture¶
Application Flow¶
State Machine¶
Implementation Details¶
Maze Generation¶
The game uses a simple but effective maze generation algorithm:
- Initialize grid with walls (1s)
- Carve paths at odd coordinates (0s)
- Create random connections between paths
- Ensure starting area (top-left 3×3) is accessible
This creates a classic maze with corridors and intersections suitable for strategic navigation.
Enemy AI¶
Patrol Bot¶
// Follows directional movement (up/down/left/right)
// Changes direction on wall collision
// Speed: 80 pixels/second
// Predictable but constant threat
Pursuit Bot¶
// Detects player within 150 pixel radius
// Actively chases player using simple pathfinding
// Speed: 100 pixels/second
// Raises alert level when pursuing
Guard Bot¶
// Stationary until player approaches within 90 pixels
// Moves slowly toward player when detected
// Speed: 56 pixels/second (70% of patrol speed)
// Guards key areas and corridors
Vector Graphics¶
All game elements are rendered using Qt Quick Shapes for crisp, scalable graphics:
- Stealth Drone: Diamond shape with directional indicator and pulsing core
- Defense Bots: Hexagons with colored outlines and scanner eyes
- Intel Packets: Rotating squares with "I" symbol and pulsing glow
- Maze Walls: Rectangles with grid pattern and neon borders
- EMP Effect: Expanding circular pulse with cyan glow
HUD Layout¶
The HUD displays information in all four corners to keep the central playfield clear:
Top-Left:
- Current score (8-digit display)
- High score
- Current level
Top-Right:
- Lives remaining (drone icons)
- EMP charges (3 max)
Bottom-Left:
- Intel collected / total
Bottom-Right:
- Game timer (MM:SS format)
- Alert level bar (0-3 scale)
Top-Center:
- Radar pulse animation
- Sweeping radar arm
Sound Integration¶
Defense Grid Run uses the AdLib synthesizer for authentic retro sound effects:
| Sound Cue | Trigger | Description |
|---|---|---|
| Ambient music | Gameplay start | Continuous low-intensity background |
| Radar ping | Every 2 seconds | Brief electronic pulse |
| Intel pickup | Collectible obtained | Success chime |
| EMP burst | EMP activation | Sharp electronic blast |
| EMP fade | EMP expiring | Descending tone |
| Enemy stunned | Bot hit by EMP | Impact sound |
| Player detected | Bot pursuit starts | Warning alarm |
| Player hit | Collision with bot | Damage sound |
| Level complete | All intel collected | Victory fanfare |
| Game over | Lives depleted | Defeat tone |
Running the Game¶
From HMI¶
- Start GVA services:
- Navigate to Function Select in HMI
- Select "External Apps"
- Choose "Defense Grid Run"
- Press ENTER to start
Standalone (Development)¶
The game will start in fullscreen mode. Use F11 or F key to toggle fullscreen.
Building¶
Defense Grid Run is built as part of the LDM SDK:
Requirements¶
- Qt6 (Core, Gui, Qml, Quick, QuickControls2)
- C++17 compiler
- CMake 3.16+
- Optional: Qt6 Multimedia for enhanced sound
- Optional: ldm10 for DDS integration
Build Targets¶
Configuration¶
Game settings are optimized for 60 FPS gameplay:
| Setting | Value |
|---|---|
| Player Speed | 150 px/s |
| Patrol Bot Speed | 80 px/s |
| Pursuit Bot Speed | 100 px/s |
| Guard Bot Speed | 56 px/s |
| EMP Duration | 3 seconds |
| EMP Cooldown | 10 seconds |
| Detection Range | 150 pixels |
| Starting Lives | 3 |
| Starting EMP | 1 charge |
| Cell Size | 32 pixels |
| Radar Interval | 2 seconds |
Educational Value¶
Defense Grid Run demonstrates several GVA integration concepts:
- Registration - Proper LDM10 application lifecycle with resource ID allocation
- Display Rendering - Pure vector graphics using Qt Quick Shapes
- Input Handling - Dual input system (keyboard + HMI soft keys)
- State Management - Complex game state machine with pause/resume
- Sound Integration - AdLib synthesizer for retro sound effects
- Alarm System - GVA alarm raising for game events (player hit, score updates, game over)
- Resource Management - Clean shutdown with operational mode transitions
- AI Implementation - Three distinct enemy behavior patterns
- Collision Detection - Grid-based maze collision system
- Particle Effects - Dynamic particle system for visual feedback
Code Structure¶
Developers can learn from the modular architecture:
- GameController: Core game logic with fixed timestep (60 FPS)
- GameWindow: Qt Quick window with keyboard/mouse input
- RegistrationManager: DDS integration for HMI communication
- QML Components: Reusable vector graphics components
- MazeLogic.js: Maze generation and pathfinding utilities
Tips & Strategies¶
- Listen for radar pings to time your movements
- Use EMP strategically - charges are limited!
- Pursuit bots are fastest - avoid when possible
- Guard bots block corridors - plan your route
- Alert level rises when detected - enemies become more aggressive
- Collect all intel for maximum score and level bonus
- Corner camping can be effective but risks getting trapped
License¶
Copyright (c) 2025, Astute Systems PTY LTD
Licensed under the commercial licence provided in the root source directory.