Custom Scenario Configurations

Holodeck worlds are meant to be configurable by changing out the scenario (see Scenarios). There are some scenarios included with Holodeck packages distributed as .json files, but Holodeck is intended to be used with user-created scenarios as well.

These can be created using a dictionary in a Python script or by creating a .json file. Both methods follow the same format, see Scenario File Format

Using a Dictionary for a Scenario Config

Create a dictionary in Python that matches the structure specified in Scenario File Format, and pass it in to holodeck.make().

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import holodeck

cfg = {
    "name": "test_rgb_camera",
    "world": "ExampleWorld",
    "package_name": "DefaultWorlds",
    "main_agent": "sphere0",
    "agents": [
        {
            "agent_name": "sphere0",
            "agent_type": "SphereAgent",
            "sensors": [
                {
                    "sensor_type": "RGBCamera",
                    "socket": "CameraSocket",
                    "configuration": {
                        "CaptureWidth": 512,
                        "CaptureHeight": 512
                    }
                }
            ],
           "control_scheme": 0,
            "location": [0, 0, 0]
        }
    ]
}

with holodeck.make(scenario_cfg=cfg) as env:
    env.tick()

Using a .json file for a Scenario Config

You can specify a custom scenario by creating a .json file that follows the format given in Scenario File Format and either:

  1. Placing it in Holodeck’s scenario search path

  2. Loading it yourself and parsing it into a dictionary, and then using that dictionary as described in Using a Dictionary for a Scenario Config

Holodeck’s Scenario Search Path

When you give a scenario name to holodeck.make(), Holodeck will search look each package folder (see Package Installation Location) until it finds a .json file that matches the scenario name.

So, you can place your custom scenario .json files in that folder and Holodeck will automatically find and use it.

Warning

If you remove and re-install a package, Holodeck will clear the contents of that folder