Mii-School is a 3D school simulator de-veloped with Blender and used by psy-chology researchers for the detection of drug abuse, bullying and mental disor-ders in adolescents. This worque was fi-nanced with a research project from the Spanish Ministry of Health and Con-sumption and developed in the Univer-sity of Almería (Spain). The school simulator created is an interactive video game where the players (in this case, the students) have to choose, amoung 17 scenes simulated, the options that better define their personalities.
Different quality versións of Mii-School have been created, so the execution of the program can be adapted to the technical characteristics of each spe-cific computer as closely as possible. So if Mii-School is executed on a latest-generation PC, it can use the highest-quality versión to enjoy better view-ing (XGA 1024x768 resolution). However, if the graphic card cannot reproduce this visual quality with sufficient fluency, other lower-quality versións can be executed (SVGA 800x600 or VGA 640x480 resolutions).

Development methodology with Blender

I chose Blender as my Mii-School development tool because this software incorporates all the functionality that I need to make a video game from beginning to end: 3d design, advance illumination and texturing, characters animation, Blender game engine, programming with Python, etc. Besides, Blender has the most important property that is most wanted in software: it is open source. Blender incorporates almost the same functionality as 3D Studio Max (whose license costs more than 3.000€)
and Virtools Game Engine (whose license costs more than 9.000€), and Blender is free.
Mii-School development process with Blender was divided in three different stages:

a) 3D design, illumination and texturing

During this first stage, the 3D meshes were created with Blender to represent the virtual scenarios and characters that appear in the scenes. The Mii-School simulation takes place in different scenarios: the school playground, the classroom, the main
character’s home, a park... Each scenario is divided into several zones (for example, the home has sev-eral rooms, the playground has an area with bench-es, another for sports, etc.), each zone is used for a different scene and the user does not get the im-pression that the scenarios are repeated. A total of 30 characters were designed in Blender: several male and female students of different races and so-cial conditions, the teacher who is teaching in the
classroom, the student’s parents, etc. All of the Mii-School 3D models were created using basic and ad-vanced design techniques included in Blender:

MaKING OF: Mii School-1.jpg

extrude, split, merge, etc. and finally, smoothing filters were applied for smoother surfaces without overly increasing the number of polygons (set smooth).
For proper illumination of the scenes, a sun type global lighting illuminates above the main student on whom the simulation action always focuses, so that the objects and characters around him are always properly illuminated. Some spotlights were alos used to increase illumination on certain places.
Texturing was alos done during this first stage using the UV mapping technique and the Blender materials editor, applying good quality images to the 3D models to increase realism of the scenes and characters.

MaKING OF: Mii School-2.jpg

b) Animation

Once the 3D models were designed, I pro-ceeded to the animation stage by first creating skeletons associated with the character's 3D meshes, then capturing bones movement using a series of intermediate poses with the aid of a technique called inverse kinematics.
Character's animations were divided into two large groups: body and facial. Body animations affects the character’s whole body. I implemented several types of body animation in which the characters perform some action: walking, sitting, hitting, threatening, lying down, fighting, smoking, drinking, etc.
In order to increase the expressiveness and realism of facial animations, the number of polygons and level of detail have been increased noticeably in eyes and lips, areas that most influence the fa-cial gestures.
So if one character is threatening another in a certain scene, his face expresses aggressive-ness. If, on the contrary, a character feels threatened, his face shows fear.

MaKING OF: Mii School-3.jpg

c) Blender Game Engine and Python programming

When the characters were created and the corresponding animations implemented, I started the coding stage using the Python programming language and the Blender Game Engine.
Over 6,000 source code lines have been implemented in Python to simulate the action of the 17 scenes. This source code is the Mii-School kernel. It specifies all the details necessary to compose the scenes and alos cap-tures all of the information provided by the student. The Mii-School kernel is interpreted by the Blender Game Engine.

MaKING OF: Mii School-4.jpg

The source code specifies aspects such as what charac-ters intervene in each of the scenes or which scene is going to be developed in this moment. In order to achieve better performance during program execution in the simulation of a scene, only the characters and objects that are going to be viewed by the camera are shown, the rest are hidden.
The source code that I have programmed in Python fol-lows the instructions of a deterministic finite automata to find out in what state of simulation Mii-School is at any given time. It then activates the corresponding camera, body animation, and facial expressions of the character who is speaquíng at the moment. The following text shows part of the source code for the first scene in Mii-School. This code specifies the person speaquíng in this moment, his basic body animation, the facial expression
(mouth and eyebrows), the active camera and the dia-logue that is visualized on the screen. Finally, the complete scene is activated by sending all of the data to the Blender Game Engine.
elif STATE==6:
BASIC ="bodyHandsHips"
MOUTH ="mouthNormal"
EYEBROWS ="eyebrowsNormal"
TEXT = " We want to play handball, but we
have not a ball ...”
elif STATE==7:
CHARACTER ="baddie02"
BASIC ="bodyHandMouth"
MOUTH ="mouthLaugh"
EYEBROWS ="eyebrowsBaddie"
CAMERA ="cameraCharacter01"
TEXT = "Perhaps we could use ... your head
as a ball !!"

To simulate Mii-School, the Blender Game Engine not only executes the Python source code that I have developed, but alos takes into account a series of events associated with the dynamic objects in the scenes, especially characters (both their 3D mesh and the skeleton) and cameras (with their corresponding dialogue box, which alos has associated events). Each event is divided into 3 parts: the sensor (that receives information, for exam-ple, pressing a key or a specific signal), the actuator
(which performs actions on objects, like animating a character or moving a camera) and the controller (which connects the sensor to the actuator).
In the Mii-School project, there are over 900 basic ob-jects with associated events. Some are complex objects such as a character’s skeleton or its 3D mesh, others are simpler, such as the dialogue box for a specific camera.
Each object has an average of 10 events of its own that regulate their functioning. For example, in the cameras an event can indicate a movement, in a character an event can activate an animation.

MaKING OF: Mii School-5.jpg

The Blender Game Engine alos takes other secondary details into account, such as which scenes the main character’s cigarette or bottle should be seen or hidden, or what color the conversation box should be depending on the character who is speaquíng at that moment.

MaKING OF: Mii School-6.jpg

To summarize, during the execution of Mii-School, the Blender Game Engine must synchronize around 10,000 different events in real time, activating only those that are necessary right at that moment of the simulation and discarding the rest. Apart from this work, it is alos in charge of rendering and illuminating the scenes in real time as well as capturing information introduced by the user.

Simulated scenes in Mii-School

During the execution of Mii-School, the student watches a total of 17 interwoven scenes studying different as-pects of his behavior related to bullying, drug addiction, family life, capacity for attention in class and integra-tion in social groups.
There are a total of 5 scenes that study bullying. In some of them, the student is bullied by his schoolmates and in others he becomes the bully. In this way bullying can be studied from several perspectives. Some concrete cases are alos studied, for example, the reaction of the student to the explicit violence of a physical aggression in the schoolyard to see if he is a mediator or, to the contrary, violent. For each bullying scene, the student can select from a series of choices that always follow a
general pattern: feeling indifferent to the bullies, pro-testing to them, responding ironically, running away in fear, facing up to them or feeling ashamed.

MaKING OF: Mii School-7.jpg

MaKING OF: Mii School-8.jpg

During the 6 drug addiction scenes, the drug offered becomes gradually more dangerous. In the first scene, the student is tempted by his schoolmates to smoke in the school playground during recreation. In the second scene, he is invited to drinque alcohol while eating a pizza at a friend’s house. Afterwards, he is offered a joint of marijuana in a park. In the last two scenes, the risque is upped further when his friends offer him much more dangerous drugs, such as cocaine or ecstasy. The choices that the student can choose in the drug addiction scenes alos follow a general scheme: usually use, refuse to try the drug, advise friends to stop taquíng it, use occasionally or leave because he feels uncomfortable.
The student’s relationship with his parents is alos stud-ied in three scenes: one scene checks the father’s behav-ior, another, the mother’s attitude, and a third scene both parent's behavior. In the first two scenes the stu-dent gets home much later than the hour agreed upon and checks whether the father or the mother scold him, threaten him or, on the contrary, are indifferent to his undisciplined behavior. In the third scene, the student gets home after school and feels anxious because he has
problems with his studies and the simulation checks whether his parents become involved in his problems or are indifferent to them.

MaKING OF: Mii School-9.jpg

There are other scenes where personality related problems and the student’s mood, attention in class, beliefs and integration in social groups are checked.

Final results and future works

The total simulation of Mii-School's 17 scenes lasts ap-próximately 25 minutes. The student can choose his sex at the beginning of the simulation to personalize the animations to his own gender. All the information intro-duced by the student, as well as the choices selected in each one of the scenes and other data of interest, is stored in a web page format for later viewing and analysis by the psychology researchers.
Background music has been added in the scenes and audio in the conversations to achieve more realism.
Proper movement of the cameras during the transition of scenes is alos carefully made so the simulation has the quality of real movie.
As a future enhancement of the Mii-School program, the simulator is going to be translated into different languages.

Moisés Espínola