Running the Model / Game
Prerequisites
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.
See the Tutorial: From GAMA to Virtual Universe for details on designing the GAMA model and Unity project.
Middleware Setup (Required)
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.
Option A: Running from Unity (Play Mode)
This method is best for development and testing.
Step 1: Start the Environment
- 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).
Ensure your .env file is correctly configured (either automatically via the generated file or manually using the EXTRA_LEARNING_PACKAGE_PATH variable).
Step 2: Play in Unity
- Open the relevant Scene in Unity (it must contain a Connection Manager and a Game Manager).
- Example:
Scenes/Code Examples/Receive Static Data.
- Click the ▶ Play button.
Using the XR Device Simulator
If you do not have a headset connected to the PC, you can simulate VR inputs using the keyboard and mouse.
1. Setup
- In the Project Explorer, search for
simulator.
- Drag and drop the XR Device Simulator prefab into your hierarchy.
2. Configuration
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.
3. Controls
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) |
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.
Option B: Running from a Headset (Standalone)
To run the simulation directly on a standalone headset (like a Meta Quest), follow these steps.
Step 1: Network Configuration
- Ensure your PC (running the WebPlatform) and your Headset are connected to the same Wi-Fi network.
- The WebPlatform IP is entered at runtime via the IP Menu that appears when the app launches on the headset — no build-time configuration is needed.
The IP Menu remembers the last address you entered. You only need to re-enter it if the WebPlatform moves to a different machine.
Step 2: Build and Export
- 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.
Step 3: Deploy to Headset
- 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.
Step 4: Launching on Headset
- 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.