## 1 Introduction  
Therapeutic exergames enable patients to exercise by playing, thereby relieving the burden of repetitive tasks through the use of motivating and engaging game dynamics [1]. In this context, an exergame can be understood as a game that tries to mimic, within a virtual or augmented world, a physical exercise that is associated to a therapeutic treatment. When it comes to using technological tools, based on exergames, either for remote or face-to-face rehabilitation, the therapists assign routines, which are composed of rehabilitation exercises, to patients. These exergames, previously created, do not usually allow the therapists to customize or adapt them directly. This can be due to a number of factors, including the dependency that is introduced by the used rehabilitation systems, the complexity of the process, or the issues raised should therapists have to deal with the technical aspects of exergame development. In this context, this work addresses the automatic generation of personalized exergames for the physical rehabilitation of patients that are affected by stroke [2]. Although the proposal discussed in this work can be generalized to other neurological diseases, the focus is on stroke, which remains an unmet clinical need nowadays [3]. The incidence of this disease is increasing worldwide, especially in low- and middle-income countries [4]. Additionally, the ideas of personalized and universal access to telerehabilitation [5] are part of the core of the proposal, which aims at contributing to personalized healthcare technologies and improving the flexibility that is provided in terms of physical location, used hardware devices, interaction mechanisms, and multimedia content [6]. A formal language, named Personalized Exergames Language (PEL), has been designed and developed along with a software system thta is able to process PEL sentences. PEL allows for the specification of exergames, while the software system is capable of analyzing PEL sentences and generating exergames automatically. The use of PEL is based on a methodology that is also devised in this work. Such methodology is aligned to the idea of adapting the physical rehabilitation process for each patient. This methodology, which guides the workflow when using PEL to define exergames, consists in the following steps: (i) definition of an exercise from the therapist's point of view, (ii) definition of an interaction scheme on behalf of patients, (iii) definition of feedback mechanisms for guiding and keeping patients motivated when they make rehabilitation, and (iv) the definition of the metrics that the therapists use to monitor the patients' progress. All these definitions can be specified by means of PEL. Thus, the whole proposal aims at laying the foundations to build software systems that are able to automatically generate exergames and dynamically customize the patient's rehabilitation routine as they improve their performance. In order to implement PEL, the GL Transmission Format (gITF) specification [7] has been adopted. gIFT is an open standard, which is based on the JSON format, conceived to store and transmit 3D model information. gITF was chosen to its maturity level as an interoperable and extensible format when handling and integrating 3D contents. Its capacity to describe scenes with the JSON format and easily extend it were strong reasons for this decision. gITF syntax not only allows to define exergames, but it also enables interactions between the virtual nodes of an exergame that has been customized for rehabilitation. Additionally, the gITF extensions let properties, semantics, and even additional formats be added. On the other hand, the use of JSON messages allows for minimizing the size of 3D assets and the impact on the efficient transmission and loading of 3D models and scenes into applications. The use of PEL as the core component to define exergames is proposed in order to provide a resource that therapists can use to create exergames.