Skip to content

Tutorial ‐ Step 1

ptaillandier edited this page Feb 1, 2024 · 20 revisions

Step 1: generation of the GAMA VR model

Creation of the project

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".

Generation of the VR model

Open the "Traffic and Pollution.gaml" model in the editor, then, select in the "Unity VR" menu "Model to VR". A Wizard should open. ⚠️ The "Unity VR" menu only appears if you have the mouse cursor in the text editor of the model.

qs1

Page 1 - Define the general information to define the VR experiment

Minimum duration of a cycle (in s)

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.

Main experiment

Name of the experiment, which will be extended to include a VR version.

In this tutorial, we will extend the only experiment defined: traffic.

qs1

Page 2 - Define the information about the display

Main display

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.

Display to hide

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.

qs1

Page 3 - Define the agents and geometries to send

Species to be sent to Unity

Select the agent species to be sent to Unity at each simulation step. To be more precise, at each simulation step, the position of each agent of these species is sent to Unity. You can filter the list of agents to be sent, to ensure that only non-overlapping agents and those too far from the player are sent.

In this tutorial, we will only send mobile people agents (only check this species).

qs1

Page 4 - Define the information background geometries

Species to be sent to Unity as static geometries

Select the agent species to be sent to Unity as static geometries (sent only once at the start of the game). For each species to be sent, it is possible to define whether these geometries will have a collider, will be 3D or not, will be selectable (i.e. the possibility of defining an interaction with them), the buffer around the geometry, the height of the geometry (only for 3D geometries), a "Tag" to identify the current type of geometries in Unity, and finally a color used to display them in Unity.

In this tutorial, we'll send two static geometries:

  • the building species, with no collider, in 3D, non-selectable, with a buffer of 0.0, a height of 10m, no tag, and #black color.
  • the **road **species with a collider, in 3D, selectable, a buffer of 2.0, a height of 1m, for the tag "intractable", and #gray color.

qs1

Page 5 - Define the information about the player

Minimum number of players

How many players are required to run the simulation.

In this tutorial, we'll set this to 1.

Maximum number of players

Does an unlimited number of players can connect to the game?

In this tutorial, we'll check this option.

Maximum number of players

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.

Init location of the players

Sets the initial location of the players.

In this example, we'll set it to {1000,1000}.

Perception radius of player agent

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.

Minimum distance between agents to be sent

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 Size

Player display size in GAMA.

In this tutorial, we'll set it to 20.0.

Player color

Player display color in GAMA.

In this tutorial, we'll set it to #red.

qs1

Finalizing

You can then click on finish to generate a new file: "traffic_model_VR.gaml", which will be used to launch the VR version of the model (experiment vr_xp). If the experiment does not appear, simply close the file and reopen it for GAMA to validate the file.

Clone this wiki locally