Repositório ISCTE-IUL

— This article presents a serious game framework developed using Unity 3D game engine and Kinect V2 sensor as a natural user interface. The developed serious games are used for objective evaluation of physical rehabilitation considering the Kinect V2 sensors for 3D motion detection of different body joints training and provide different types of data for physiotherapists and patients during the rehabilitation process. The framework provide data storage capability in a remote database thus patient’s biometric data, patients’ medical record, obtained scores during serious game based training and values of metrics such as the distance between feet during game, left right feet usage frequency and execution time for imposed movement associated with game mechanics. A general description and the involved technologies for a developed and tested serious game for lower limb rehabilitation are included in the paper together a set of experimental results.


INTRODUCTION
Physical therapy is a medical branch that focus on the rehabilitation of motor condition for patients after different types of accidents including stroke events.The physiotherapists also are assuming leadership roles on health maintenance, wellness and fitness of their patients.In order to increase the effectiveness of physiotherapy sessions the physiotherapists tend to engage their patients by knowing their physical condition but also using systems to perform tests and measurements of the patient motor condition in automated way that are stored and compared with historical data for evaluation of the patient motion capabilities [1] or to predict future motor behavior.Considering in particular the physical rehabilitation process for patients who suffered stroke events, it is characterized by long period of physical training associated with high costs for patients and society.The rehabilitation is strongly dependent to the frequency and effectiveness of the physical rehabilitation sessions, and in this conditions the remote physiotherapy selftraining at home represents a complementary a successful solution, that contribute for reduction of the rehabilitation period.Self-training based on classical rehabilitation processes always require professional supervision and the usage of equipment that doesn't provide any type of information regarding the rehabilitation process [2].In the last decade the physiotherapist community and the physiotherapy services users have been increased the interest for novel solution that apply information technologies in physical rehabilitation field.Thus, through the serious game initiative in 2002 [3] many definitions were proposed, but different authors refer that the usage of computer games for purpose other than pure entertainment actually represent the common accepted definition for serious games.Latest developments in the serious games field are expressed by the serious game for therapy (Theragames) that are reported in the literature including Kinect Theragames that refers the usage of Kinect sensor [4][5].
This type of game developments is linked to Kinect sensor (3D sensor) in 2010 and the release of the Software Development Kit(SDK) in 2011, a boom on natural user interface serious game took place, with serious contributions in all kinds of areas as the capture human motion in a nonintrusive way.With higher accuracy in human body detection appear Kinect v2 in 2015.Thus, the usage of Kinect v2 as a natural user interface for physical rehabilitation scenarios provide data associated with patient joints position that can be analyzed in correspondence with the applied rehabilitation game.The Kinect games provide training localization flexibility, the patients may train at home or at the physiotherapy and contribute to reduce the physiotherapist work, extending the capability to follow their patients everywhere recurring to mobile applications connected to Kinect serious game frameworks [6].
Other benefits this technology is the capability to increase the user motivation during the rehabilitation process based on trainings more innovative and enjoyable [7].
In this work, the Unity 3D game engine was used to develop different virtual reality scenarios well adapted to different types of patients.The interaction with the implemented VR environment is based on the usage of the Kinect v2 motion sensing sensor that allows to track the patients' motion, and to use the patient detected motion as game action.
The developed virtual reality scenario provides the possibility to the user under rehabilitation to make exercises that work by imitation of the action performed by an avatar, or to play a game that will train specific parts of the body.Depending on the type of rehabilitation.Considering the data recording functionality implemented on the level of implemented framework and data analysis of the stored data the evolution of the motor capabilities of the patients can be easily analyzed by physiotherapists.
This paper is organized such as: Section II presents the related work in the field of serious game and mobile applications for rehabilitation,; Section III, presents the framework architecture including hardware and software,; and Section IV presents the game description following by Section V that includes results and discussions.The last section of the paper include the conclusions and future works.

A. Physical rehabilitation assessment based on Smart Training Equipment and Mobile APPs
The latest developments in the field of new technology integration in the healthcare system, made possible the adoption of smart sensing systems solution to increase the quality of services in the field of physical rehabilitation.
As implementations reported in the literature can be mentioned the integration of sensors in the rehabilitation equipment like crutches and walkers.Considering the sensing capabilities of these instrumented equipment information like motor activity, gait pattern, center of mass trajectory and balance are retrieved [8] and used to evaluate the effectiveness of rehabilitation sessions based on appropriate feedback for the patients under rehabilitation process.At the same time the system permit objective evaluation performed by the physiotherapist taking the capability of such systems to store the date associated with rehabilitation sessions.The interaction with the data is carried out based on specific web site and mobile applications [9] Embedding sensors in the training equipment innovative physiotherapy training plan ca be implemented that may motivate and help the patient in higher level of safety conditions, so falls can be prevented during the physical rehabilitation period [10].

B. Kinect Serious Game
The interest and evolution of the serious game rehabilitation approach has been emerging in the last years, patients and general public are nowadays more motivated to use serious games for physical rehabilitation [11].In this way the work focusses in the usage of Kinect sensor that permit to retrieve the 3D human body joints values that are used to calculate trajectories of lower limb during the serious game activity.
Additional training values such as force or muscle activity can be obtained using wearable device that are used by the user during the training performed under the Kinect serious game training.Adding 3D IMU can be obtained values of angles between different body parts that can be used for validation purpose of the values obtained through Kinect sensor.

III. FRAMEWORK ARCHITECTURE
The implemented framework includes a hardware component expressed by Kinect V2 connected to a mini PC and that runs a serious game developed in Unity 3D.An appropriate display HDMI compatible is used to provide user semi immersion during the training based serious game activity.The serious game settings through a web interface or APPs, the setting values being stored on the server side (cloud).Using the implemented software on the level of miniPC (client) the settings from stored in the server database are automatically downloaded and used to setup the serious game according with training plan.In the fallowing paragraph elements of framework hardware and framework software are described.

A. Framework Hardware
The human joints capture are captured in unobtrusive way during the physical rehabilitation exercises using Microsoft Kinect sensor that allows the acquisition of 3D images It includes IR laser emitter that delivers infrared light beams and an infrared depth camera 512*424 pixels that allows the extraction of depth information using the IR speckle analysis of the IR beams reflected back to the sensor (Figure 1 In the case of Kinect V2 the number of skeleton joints is 25 providing better gesture recognition by comparison with Kinect v1 [14].

B. Framework software
The framework software includes different components such the serious game engine based on Unity 3D, mobile application, database Referring to game engine it consists in a cross-platform game engine mainly used to develop video games and simulations either for computers, consoles or mobile devices.It is able to support 2D and 3D makes graphics and support multiple languages like C#, JavaScript and Action Script 3. Can be associated with different computation platforms such as mobile (smart phone and tablets), PC and PS4 [15].
For data analysis visualization and for serious game setup according with physical therapy plan a mobile application was developed in Android studio that consists in an integrated development environment (IDE) for android platform.The application to keep track of sessions and their data, either for the patients as for the physiotherapists The data generated by game including scores but also the measured metrics associated with lower limbs serious game rehabilitation program a remote database was developed using MySQL.The implemented database permits to register a new user, requiring data like name, height, gender, age.The database will also contain data regarding the games and exercises done by the patient, like scores, repetitions made, number of times played and game customization parameters, that can be accessed both from the game or the mobile application and either from patient or physiotherapist.As specific metrics stored on the database are mentioned the distances between feet, movement duration, values that are calculated during game play, these values being accessed exclusively by the physiotherapists.

IV. GAME DESCRIPTION
The implemented serious game interface includes a simple menu that is used by patients or by physiotherapists to perform Login/Register in order to have their data tracked and stored on the game database.After the physiotherapy user record the physical therapy plan can be selected from two possible plans one for lower limb training and the other for upper limb training.The selection of the physical rehabilitation plan is carried out by the physiotherapist during the serious game configuration phase.
After the selection of the physical rehabilitation plan, two possible choices are presented, a voluntary interaction for physical rehabilitation purpose that means the rehabilitation through exercises where specific exercises are presented, and an involuntary interaction for physical rehabilitation that corresponds to Kinect serious game play round.The physiotherapist can act to customize the game choosing the type of exercises and the number of repetitions of the chosen exercises.

A. Lower limb training serious game-Step on the tile
The game objective is to train the balance through a scenario where the user is stepping on the tiles that will be spawned on the game.The user can perform the lateral movements Figure 2.a or front and back steps as shown below in Figure 2.b.The game is configured using a menu, where game duration, tiles spawn range (extended range will conduct to bigger angles between both legs), tiles speed, and even the score objective allowing the physiotherapist to impose the training plan.According with the patients' needs it is also possible to choose which leg motion will be trained.The game mechanic consists in stepping the tiles as they appear, reaching the objective score within the time limit imposed.By stepping on the tiles, the patients will train their lower limb mobility, while playing the game the objective is to increase the leg mobility by widening each step or get a faster reaction on stepping a tile.The game may also be used for cognitive rehabilitation, thus the user might select only the imposed tiles (e.g green tales) stepping the different color tales (e.g.red tales) will lead to losing points. Time between tale-on tale-off (times to step on the tile and return to initial position);  Average velocity of each movement;  Angle between legs when the step is performed;  Distance between feet when tile is stepped;  Number of steps for whole training period.Advanced processing of the database stored data can be carried out on the server side level.

B. Upper limb training serious game-Don't hit the wall
This game is meant to increase upper limb mobility while playing in different maps, starting on easier ones like the one shown in Figure 3.a., as the mobility increases advanced levels like shown in Figure 3.b will be presented requiring from the patient better control of the upper limbs.The game mechanics consists in a series of levels, where the patient starts by grabbing the game object, and moving it through the game map, where the objective is to reach the exit preserving other preserving as many lives as possible and within the defined game time constraints, touching the wall represents losing lives.

C. Upper limb training serious game-Infinite Runner
Was designed for upper limb training and include o menu for game customization by the physiotherapist (Figure 4).Using the menu can be imposed the number of spawning objects, the player number of lives, the player speed and also the score objective Along the game path, there will be objects that will give and take points and lives, so to win the player need to reach the score objective preserving minimum one life.In this game the collected data will be the one when an object is caught with the hands and in this case the angle of the arm according with position of the object is calculated and stored in the database.By analyzing the game results physiotherapist will be able to observe the upper limb mobility of the trained patients based on serious game, the mobility being dependent by the number of pick-up objects but also the values of arm angles associated with the objects.By playing the game, it is expected that in further sessions, the patient will be able to reach objects that was not been able to reach before, that means an increasing of the upper limb mobility. V.
RESULTS AND DISCUSSIONS The preliminary tests with the implemented serious game were carried out in the laboratory of IT-IUL with two young males' volunteers (23 year old, 26 year old), height (1.79m and 1.81m).
For the "Step on tile" game the obtained results are presented in the following table: In Figure 5 is represented the evolution between legs for successive steps during the step on tile game.The maximum angle reached during this training session was 37º. Figure 6 presents the step duration that corresponds with "step on the tile" and "step back to the original position" actions, while in Figure 7 is presented the average speed associated with step in, step out motion during the game.Based on data associated with serious game session the physiotherapist will be able to have a better insight in how patients are progressing during sessions performed at home or in clinics, and they can perform a better evaluation of motor capability status of their patients adapting the physical rehabilitation plan to the patient needs.
Referring to the infinite runner serious game in Table II are presented the data obtained from one game session.During the session a set of six objects were pick-up, five of them with left hand (joint_HandLT) and sixth with the right hand (joint_HandRT).Analyzing the values can be highlighted the high mobility of left arm, responsible for pick-up action corresponding with angles between 20º and 138º.Referring the right arm the number of pick-up object is reduced to one and correspond with 35º that may conduct to the information that the patient has a right hand reduced mobility.

VI. CONCLUSIONS AND FUTURE WORKS
This work presented a solution to improve the physical rehabilitation using the serious games.Using the Unity 3D different virtual reality game scenario were developed and tested different metrics being calculated.
For future work, we will develop the mobile application as part of the framework that permits to configure and to visualize the data obtained during the training using the implemented serious games.New games for lower limb rehabilitation and lower limb motion classifier will be considered.
.a).The operational distance between the camera and target (patient) is maximum 4.5 meters and minimum 0.5 m the field of view that characterize the Kinect v2 being expressed in Figure 1.b [12][13]. .a) b) Figure 1.Kinect V2 Sensor construction (a) and characteristics (b)

Figure 2 .
Lower limb rehabilitation serious game-step on tile During the training based serious game several metrics are calculated on-line calculated and stored in the database.Thus are mentioned:

Figure 3 .
Figure 3. Upper limb rehabilitation serious game -don't hit the wall

Figure 4 .
Figure 4. Upper limb rehabilitation serious game -don't hit the wall

Figure 5 .
Figure 5.The angle between lower limb during "step on tile" serious games session.

Figure 6 .Figure 7 .
Figure 6.The evolution of step duration for a session of the "step on tile" serious games

Table I :
The metrics values for "Step on tile" serious game

Table II
The evolution of the angles associated with pick-up action during the training session of "infinite runner" serious