01 Running a model game - project-SIMPLE/simple.toolchain GitHub Wiki

Preamble

In what follows, we assume that the user has a GAMA model adapted to VR and a Unity project with at least one scene containing the prefabs needed to connect to GAMA. See the tutorial for more information on designing this GAMA model and the Unity project.

General information

The model can be launched in two different ways: from a headset or directly from Unity in Play mode. In the following sections, we describe both options. In all cases, the middleware connected to GAMA must be running before starting the Unity application.

The middleware can be downloaded here. All the information about the running of the middleware can be found in the middleware wiki.

Note that when the SIMPLE tool generates a VR Gaml file, it also produces two additional files: settings.json, which contains information about the model to run and its execution conditions, and a .env file, which allows the modeler’s workspace to be added to the middleware. For this second file (which is hidden in the project folder), the user must copy it into the middleware folder.

Running the model/game

From Unity

To run the model/game from Unity, follow the following steps:

  1. Run GAMA

  2. Run the middleware: information about installing and running the middleware can be found here

Capture d’écran 2025-12-16 à 13 43 35
  1. Open the page: http://localhost:8000/
  2. Choose the game in the middleware interface

For example, to run the game of the tutorial (Traffic_model-VR.gaml), click on "traffic_model_VR".

Capture d’écran 2025-12-16 à 13 45 03

5. Push on the Unity Play button

Open the Scene that you want to run (it has to contain a Connection Manager and a Game manager). For example, in linked to the model "Send Static data.gaml" we will open in the "UnityVRTemplate" the Scene "Scenes/Code Examples/Receive Static Data". Then, clicks on the Play button.

Unity - Play

VR Player Simulation in Play Mode (Unity)

To simulate the behavior of a VR player directly in the Unity Editor when pressing Play, you can use the XR Device Simulator. This allows you to test movement and interactions without launching the game on a physical VR headset.

Setup
  1. In the Project Explorer, search for simulator.
Capture d’écran 2025-12-16 à 14 16 43
  1. Locate the prefab named XR Device Simulator.
  2. Drag and drop this prefab into your scene.
Capture d’écran 2025-12-16 à 14 17 03
Configuration

The movement speed of the virtual player can be adjusted in the XR Device Simulator inspector:

  • Modify the variables Keyboard X Translation, Keyboard Y Translation, and Keyboard Z Translation.

For example, setting these values to 20 provides faster movement. Capture d’écran 2025-12-16 à 14 18 02

Controls (Play Mode)

Once the game is running in Play Mode:

  • Movement (horizontal):
    • Z / S → forward / backward
    • Q / D → left / right
  • Vertical movement:
    • A / E → down / up
  • Head movement:
    • Use the mouse to rotate the head (look around)
  • Right controller simulation:
    • Press Y to select the right controller
    • Press G to activate the trigger
⚠️ Important Notice

Do not keep the XR Device Simulator in the scene when building the game for a real VR headset.
The simulator is intended only for editor testing and must be removed before compiling a VR build.

From a headset

Connecting a headset to GAMA is the same as running Unity with GAMA. The only difference is the need to set the correct IP and build and export the application on the headset.

Go to "Managers/Connection Manager" from the Scene and in the "Default IP" field, set the IP of the PC running GAMA (to replace "localhost"). Note that the headset and the PC must use the same WiFi network to work. Be sure as well that "Fixed Properties" is checked as it allows to use the IP defined in "Default IP".

In the File Menu, choose "Build Profiles".

Capture d’écran 2025-12-16 à 14 42 16

In this panel, select "Android" then click on "Switch platform".

Capture d’écran 2025-12-16 à 14 43 33

Click on "Open Scene List" to select the scenes that you want to export on the headset. For example, the scene "Scene/MainScene-tuto". If the Scene is not available, open the scene in Unity, then click on "Add Open Scenes".

Capture d’écran 2025-12-16 à 14 42 40

Then click on "Build and Run". You will need to select a file for the application. If your headset is not connected, a pop-up will appear. You will need to connect your headset and click on "Retry". To connect the headset, simply plug your headset to the computer using a USB-C cable and accept any authorization that appears. Note that the headset must be in "Developer Mode" to export the application to it.

Once the application is exported, it should start right on the headset if you have already set up a boundary. If you don't see the application running, just click on the "Meta" button on the right controller, quit the application, and run it again. To run the application, in the application panel of the headset, select applications from "Unknown source" and you should be able to find your application.

⚠️ **GitHub.com Fallback** ⚠️