-
Notifications
You must be signed in to change notification settings - Fork 2
Tutorial ‐ Step 1
Create a new GAMA project, then copy inside in this project the folders "models" and "includes" from "Toy Models/Traffic" of the model library. In the "model" folder, delete all the models except "Traffic and Pollution.gaml". To make the test easier later, set "fullscreen" to false in the "carte" display of the "traffic" experiment.
Open the "Traffic and Pollution.gaml" model in the editor, then, select in the "Unity VR" menu "Model to VR". A Wizard should open.
This represents the minimum time between two simulation steps. As GAMA will be sending information to Unity at each simulation step, setting a minimum value for this variable ensures that the Unity client doesn't receive too much information too quickly.
In this tutorial, we will set the value to 0.1.
Name of the experiment, which will be extended to include a VR version.
In this tutorial, we will extend the only experiment defined: traffic.
Name of the display, which will be extended to include a VR version.
In this tutorial, only we will extend the only display defined: carte.
Displays that will not be displayed in the experiment.
In this tutorial, we don't want to have the carte display, so it must be checked.
An important step is to describe how the entities (agents, geometries) will be sent to Unity, in particular how they will be represented in Unity and how the player will be able to interact with them. In the same way as for "aspects" in GAMA, it will be possible to define sets of properties that can then be assigned to agent species: for each agent species, you will be able to choose a way of sending it to Unity.
Regarding the representation of entities, the tool allows them to be represented in 2 different ways: by their geometry (with optional 3D extrusion) and by a prefab already defined in Unity.
For interactions, it is possible to define whether the entity will have a physical existence in the world (collider), whether the player will be able to interact with it and how he or she will be able to interact: interaction by ray or possibility of catching the entity. Finally, it is possible to define whether Unity will send GAMA information on the entity's location (for example, if the player moves it).
In this tutorial, we want to send all building geometries to Unity without interaction. We therefore add a new property for this purpose. We have for that to fill the part Defining a Unity property: in the name field, write "building". As we don't want to interact with the buildings, leave all Interaction checkbox unchecked. For Aspect, as we want to represent building geometries and not use a prefab, leave has a prefab unchecked. We want to give them a height of 10m and show them in black. So we need to fill the height field with "10.0" and the color field with "black". We will not use a particular material for these agents, so we let the material field empty. Click then on the button "Add/Update".
In this tutorial, we want to send all road geometries to Unity with the possibility to interact with them (to let the player close roads by selecting them through the ray interactor). We therefore add a new property for this purpose. Similarly as for the building Unity properties, we have for that to fill the part Defining a Unity property: in the name field, write "road". We add a tag as well to facilitate the identification of this type of entity in Unity. For that, in the tag field, write "road". As we want to interact with the roads using the ray interaction, in Interaction check the box has a collider and is interactable. For Aspect, as we want to represent road geometries and not use a prefab, leave has a prefab unchecked. We want to give them a height of 1m and show them in gray. So we need to fill the height field with "1.0" and the color field with "gray". Click then on the button "Add/Update".
In this tutorial, we want to send to send the location of the people agents to Unity without any interaction with them. We therefore add a new property for this purpose. In Defining a Unity property, write "people" in the name field. As we want no interaction with the people entities, leave all the check box in Interaction unchecked. For Aspect, we want to represent people agents using a specific prefab called Car, we then have to check has a prefab. In Path to the Prefab, we have to specify the path to the Prefab. For reasons of Unity limitations, this prefab must absolutely be in the Resources directory of the Unity project. In this tutorial, we want to use the Car prefab located in folder "Assets/Resources/Prefabs/Visual Prefabs/City/Vehicles/", we then write in Path to the Prefab "Prefabs/Visual Prefabs/City/Vehicles/Car". We set the scale of the prefab to "30.0", the rotation coefficient to "-1.0", the rotation offset to "-90.0" and the offset along the Y-Axis to "1.1". Click then on the button "Add/Update".
This page lets you specify which agent species to send with which propriety. It also allows you to specify for each species whether agents will be sent only once at initialization (static) or at each time step under certain conditions.
In the case of this tutorial, we want to send roads and buildings only at initiation, and people agents at each time step. We therefore need to check these 3 species.
- For buildings, we want to use the "building" property and check the "Static" checkbox.
- For roads, we want to use the "road" property, adding a 2m buffer around the roads to represent them as surfaces rather than lines. To do this, we need to fill the buffer field with "2.0". Finally, as with buildings, we only want to send these roads at initialization, so we need to check the "Static" checkbox.
- Finally, for people agents, we want to use the "people" properties. As we want to send them at every time step, we can leave the "Static" checkbox unchecked and leave the default value in the when field (send agent list at every time step).
How many players are required to run the simulation.
In this tutorial, we'll set this to 1.
Does an unlimited number of players can connect to the game?
In this tutorial, we'll check this option.
If the model/game has a maximum number of players, what is this maximum number (it must be greater than 0).
In this tutorial, we'll set it to 1 to limit the number of players to one.
Sets the initial location of the players.
In this example, we'll set it to {1000,1000, 100}.
If this option is greater than 0.0, it filters the agents to be sent to Unity, sending only those agents that are at a distance less than or equal to the perception radius.
In this tutorial, we'll leave the default value (0.0) as we don't wish to filter the agents sent to Unity.
If greater than 0.0, this option filters the agents to be sent to Unity, so as to send only those agents that are too close (distance greater than this minimum distance).
In this tutorial, we'll leave the default value (0.0) as we don't wish to filter the agents sent to Unity.
Player display size in GAMA.
In this tutorial, we'll set it to 20.0.
Player display color in GAMA.
In this tutorial, we'll set it to #red.
You can then click on finish to generate a new file: "traffic and Pollution-VR.gaml", which will be used to launch the VR version of the model (experiment vr_xp). If the file does not appear, refresh the folder (right click on the folder, then "refresh").
You can now proceed to Step 2