# Design of Exergaming Platform for Upper Limb Rehabilitation Using Surface Electromyography
## 3 The Exergaming Platform  
In this section, we present the developed exergaming platform prototype. The platform consists of several essential elements, including the Myo armband and its accompanying software, the local intermediary application, the database, and the web application, which includes the game for the patient/players, the dashboard for the practitioners to monitor the gameplay, and an application programming interface (API) that allows for automatic data transfer between the game and the database. Player inputs captured by the Myo armband are transmitted to its accompanying software and then relayed to the local intermediary application, which interfaces with the player's browser. The browser communicates with the game and API modules of the web application on the server. Concurrently, health professionals access the system via a separate browser interface linked to the web application's dashboard module. Both the dashboard and the API modules interact with the central database. This architecture is illustrated in Figure 1.  
The game is structured around basic exercise rules that form the foundation upon which the gameplay is built. The five hand movements deemed critical for rehabilitation that have been selected are accurately detected by the Myo armband: wrist flexion, wrist extension, finger flexion, finger abduction, and pinching. Concisely, the daily exercise routine is divided into several sets, each consisting of a sequence of repetitions of a specific movement. For a movement to be considered valid, it must be held for a predetermined duration. Taking into account the needs of the patients, the routine includes rest periods between sequences of movements. The number of sets, the number of repetitions per set, and the duration of the holds and rests can be adjusted by healthcare professionals using the dashboard. The game is designed as an adventure game with a storyline to give players a sense of progression, similar to traditional commercial adventure games. The gameplay is divided into four virtual worlds, each containing up to seven levels, reflecting the number of daily exercise routines a therapist might prescribe for a week, supporting a maximum of twenty-eight consecutive days of exercise. To prevent repetitiveness, four home screens are used, one for each week, reflecting the current stage of the player's exercise plan. These screens feature platforms representing the daily schedule for that week, with the game's protagonist positioned on the platform corresponding to the current day's exercise. In addition, the game's title and introductory scene feature a countdown element linked to the story, showing the number of days left for the hero to reach the final goal, increasing the player's engagement with the game world. All these elements are illustrated in Figure 2.  
Figure 1: Architecture of the exergaming platform. Figure 2: Screenshots illustrating the storytelling elements of the game. (**a**) Title screen. (**b**) Frame from the introductory scene. (**c**) Home screen for the first week. (**d**) Home screen for the fourth week. In each level of the game (see Figure 3), the hero's (1) goal is to collect a magical gem (2), which is protected by an impenetrable shield that can only be neutralized by defeating enemies (3) with a weapon similar to the Myo device (4). Including a Myo-like weapon enhances immersion by integrating the real tool into the virtual world of the game and celebrates it as the source of the character's power, adding depth to the narrative and shifting the player's perception from wearing it due to weakness to wearing it for strength. The game integrates exercise by requiring the hero to approach enemies within a certain range, mirroring the physical movements, the exercises, that the player must perform. The corresponding exercise is shown through the hint circle (5). Enemies represent exercise sets, with their hit points reflecting the number of repetitions required. The remaining hit points are indicated by the health bar (6).