01 Running a model game - project-SIMPLE/simple.toolchain GitHub Wiki
Before starting, ensure you have:
- A GAMA model adapted for VR.
- A Unity project with a scene containing the necessary prefabs to connect to GAMA.
Tip
See the Tutorial: From GAMA to Virtual Universe for details on designing the GAMA model and Unity project.
Regardless of whether you run the game in the Editor or on a Headset, the middleware must be running before you start the Unity application.
- Download: Get the middleware here.
-
Configuration Files: The SIMPLE tool generates two files when creating a VR Gaml file:
-
settings.json: Model execution conditions. -
.env: Configuration for the modeler's workspace.
-
-
Installation:
- Copy the generated
.envfile (located in your project folder) into the root folder of the middleware. - For detailed installation instructions, refer to the Middleware Wiki.
- Copy the generated
This method is best for development and testing.
- Run GAMA.
-
Run the Middleware. (See Getting Started).
- Open your browser and go to: http://localhost:8000/.
-
Select the Game: Click on your project name in the web interface (e.g.,
traffic_model_VR).
Note
Ensure your .env file is correctly configured (either automatically via the generated file or manually using the EXTRA_LEARNING_PACKAGE_PATH variable).
- Open the relevant Scene in Unity (it must contain a Connection Manager and a Game Manager).
-
Example:
Scenes/Code Examples/Receive Static Data.
-
Example:
- Click the
▶️ Play button.

If you do not have a headset connected to the PC, you can simulate VR inputs using the keyboard and mouse.
- In the Project Explorer, search for
simulator.
- Drag and drop the XR Device Simulator prefab into your hierarchy.
To move faster in the scene, adjust the sensitivity in the Inspector:
- Look for Keyboard X / Y / Z Translate Speed.
- Set values to 20 for faster navigation.
Once inside Play Mode, use the following controls:
| Action | Controls |
|---|---|
| Move Horizontal |
W/A/S/D (or Z/Q/S/D depending on layout) |
| Move Vertical |
E (Up) / Q or A (Down) |
| Look Around | Hold Right Mouse Button + Move Mouse |
| Toggle Controller | Press Y to toggle the Right Controller |
| Trigger Action | Press G (while controller is active) |
Warning
Remove the Simulator before Building! The XR Device Simulator is for editor testing only. You must delete it from the scene before building the application for a real headset.
To run the simulation directly on a standalone headset (like a Meta Quest), follow these steps.
- Ensure your PC (running GAMA) and your Headset are connected to the same Wi-Fi network.
- In Unity, select the Manager / Connection Manager object.
- In the Inspector:
- Check Fixed Properties.
- In the Default IP field, replace
localhostwith your PC's Local IP Address (e.g.,192.168.1.x).
- Go to File > Build Profiles.
- Select Android and click Switch Platform (this may take a few minutes).
- Click Open Scene List and ensure your main scene is checked. If missing, open the scene and click Add Open Scenes.
- Connect your headset to the PC via USB-C.
- Accept any USB debugging authorizations inside the headset.
- Note: Your headset must be in Developer Mode.
- In Unity, click Build and Run.
- Select a folder to save the
.apkfile.
- If the app doesn't launch automatically:
- Put on the headset.
- Go to your App Library.
- Select the filter dropdown (usually says "All").
- Select Unknown Sources.
- Click on your application name.