# Probe: A Framework for Serious Games in Telecrabilitation
## Appendix A
### Server Application
The path can contain variables (in the example: name). The function arguments are the username, the user permissions, the data passed during the function call, and the parameters passed by the path. Conventionally, the function returns a JSON string, but any string is allowed. Script plugin. A Proteo standard plugin is the plugin that manages the sending of scripts to clients. The main access points it exposes are:  
```
[GET proteo/permissions]: which returns the permissions needed to access the individual scripts;
```
[GET proteo/script/script]: which checks whether the user has permission to access the script and if so, returns it encapsulated with JSON;  
```
[GET proteo/lib/:lib]: which returns the requested library to the client. Libraries are not handled with permissions, but there is an array in the script that identifies which libraries a client can request. Editor. There are three types of script files in Proteo: plugin, script, and lib. Every type of script is written in Lua and is stored in specific folders within the server root folder. Given the aim of making Proteo easy to program, in addition to being able to edit scripts manually, it is possible to act at a higher level of abstraction through visual programming. Using Blockly [28], it is possible, for instance, to translate the function in the previous figure (Figure A4) into a block in the following figure:

Proteo is equipped with an internal web-based editor to create or edit scripts and plugins. Through the endpoint [GET/admin], a user can authenticate (with editor permission) and can access the files for which he/she has reading/writing permissions. The script is immediately available once saved. To the contrary, saving a plugin restarts the server, so that it can be reloaded. Access and modification of script files is also managed by a server plugin. All API blocks have been implemented but, in order to optimize visual programming, the aim is to further abstract the programming level through the use of libraries. For example, to estimate the pose from a frame using the Blazepose algorithm [29], an appropriate library has been created, making the blocks extremely readable and easy to implement, as shown in Figure A5:

Even if Blockly is capable of reproducing each of the Lua language constructs, it is specifically intended for users with no development skills. In the context of telerehabilitation, we considered therapists or researchers that often need to set up task batteries (in the form of serious games), which is typically unfeasible without support from developers. With Blockly, starting from a serious game template, we give them the possibility to overcome technical skill barriers and to reach autonomy. In Section 2.2. we present some examples of the process of building a serious game starting from a template. API. Proteo API works as a general-purpose glue and wraps together several libraries comprising all parts of memory management, garbage collection, and data interconnections transparent to the developer. There are system functions for accessing the disk, using timers, etc., which we will not go into detail about here, but we will instead concentrate on listing the parts of the library related to the development of serious games. Net. Through the networking functions, it is possible to make REST calls to specific addresses, and it is also possible to carry atomic messages across TCP/UDP, with patterns like fan-out, pub-sub, and request-reply. To do this, Proteo incorporates the functionalities of the most popular networking libraries with a focus on portability: OpenSSL and ZeroMQ are just some of the libraries integrated into the Proteo API (Figure A6):

Communication between the client and the server is conventionally via JSON-encoded strings, even if this is not an implementation constraint. In the context of serious games for telerehabilitation, network support is crucial, for instance, for user authentication, multi-user support, and data collecting.