Skip to content

Perception and runtime customization

Use this guide to select and run the new LiDAR, occupancy, capture, drone, animation, and external-scene workflows. For physics-policy integration see MuJoCo; for agent-facing runtime tools see Runtime MCP. Those workflows are separate from the examples below.

Choose a workflow and launch mode

Commands run from the unrealzoo-gym repository root, not this documentation repository. The audited baseline is gym 01f56d4180c8dba2f5ca65430a61cb59e76b2ba0 and UnrealCV 67d466a246c7bacffab5392312b0746191fa5c10. The v3.1 changelog is a development snapshot, not a promise that every downloaded package contains every endpoint.[1][2]

Goal Entry point under example/ Who starts Unreal? Main result
Player-controlled LiDAR mapping new_features/suburb_street_slam.py Gym launches and closes it RGB, scan diagnostics, pose-conditioned map
Inspect a LiDAR camera new_features/lidar_visualization.py You start binary/Editor PIE first Live plot or one PNG
GPU occupancy viewer new_features/realtime_scene_occupancy_gpu.py You start binary/PIE first Four GPU-instanced views
CPU occupancy preview/export new_features/realtime_scene_occupancy.py You start binary/PIE first Four projected views, optional PNG
Cycle a Gym drone's appearance new_features/drone_mesh_switch_demo.py Gym launches and closes it Appearance transitions, optional RGB window
Cycle already placed drones new_features/cycle_placed_drone_appearances.py You start binary/PIE first Changes on existing actors
Record a demonstration GIF new_features/record_feature_gif.py Window/screen or a running server GIF, optionally retained PNG frames
Social animation, navigation, external level UnrealCV commands below You start a compatible runtime first Actor action or loaded level

The matrix follows the actual scripts: despite a general statement in the changelog about attaching to PIE, street mapping and the Gym drone demo launch their own process. Do not run them on a port occupied by a manually started binary.[1][3]

Prerequisites and package boundaries

  • Install the matching gym checkout into the active environment with python -m pip install -e .. Its metadata requires Python 3.9+ and pins unrealcv==1.3.2; it also declares NumPy, Matplotlib, OpenCV, GLFW, and ModernGL. A dependency installation is not an Unreal package download.[7]
  • Obtain a platform-compatible package containing the required map, actors, cooked assets, and UnrealCV+ commands. The upstream quick start targets the v3.1 UE5.7 full package; feature demos were primarily verified on Windows. Do not infer Linux/macOS binary or feature availability from a Python flag.[1][2]
  • For Gym launch, set UnrealEnv to the parent directory of the configured environment folder. A registered ID such as UnrealNavigation-SuburbNeighborhood_Day-MixedColor-v0 selects Python task/configuration; it does not prove that the corresponding map or drone exists in your package. Inspect the generated configuration and installed package.[1][3]
  • For direct connection, start the binary or enter PIE, wait for the map and UnrealCV server, then use its actual host, port, and camera IDs. Local shared-memory readers need access to the same machine's mapping; a remote TCP connection alone cannot provide that access.[3][4]

Windows CMD setup (replace the directory):

python -m pip install -e .
set "UnrealEnv=D:\UnrealZoo"

For Bash use export UnrealEnv=/path/to/UnrealEnv. Shared Navigation launch options include --env-id, --binary, --map, --port, --width, --height, and --sleep-time. Here --port must be 1024–9999; --binary can override the configured executable. Prefer an explicit executable on non-Windows systems rather than assuming the helper's Windows executable discovery will work.[3]

1. LiDAR observations and pose-conditioned mapping

LiDAR street mapping demonstration
LiDAR street mapping demonstration
Player camera, sensor-local point scan and accumulated 2D voxel map
Player camera, sensor-local point scan and accumulated 2D voxel map

Launch the street-mapping dashboard

python example/new_features/suburb_street_slam.py --width 640 --height 360 --transport auto

Gym starts the Navigation environment, spawns a temporary player, and discovers its camera (normally camera 1; use the printed ID, not that assumption). The dashboard combines RGB, the current sensor-local scan, and an accumulated top-down voxel map. auto first tries shared memory and falls back to TCP NPY if the initial shared capture fails.[1][3]

Use I/K to move forward/back, J/L to turn, arrow keys to look, Space to jump, Ctrl to crouch, C to clear, and P to pause mapping. Exit by closing the dashboard, Esc, or Ctrl+C. Windows keyboard input is global. A bounded capture can replace the dashboard PNG each step:[1][3]

python example/new_features/suburb_street_slam.py --transport npy --max-steps 30 --no-show --save artifacts/street-map.png

Inspect an already running camera

python example/new_features/lidar_visualization.py --host 127.0.0.1 --port 9000 --camera-id 1 --transport npy --once --no-show --save artifacts/lidar.png

This command does not launch Unreal. Choose a camera with LiDAR support. For a local server use --transport shared or --transport both to compare transports; this script accepts npy/shared/both, not the street demo's auto. Its default is shared.[3]

The raw observation endpoint is:

vget /camera/1/lidar npy

It returns an N x 4 float32 XYZI cloud. XYZ are sensor-local metres; Unreal camera/world positions are centimetres, with rotations [pitch, yaw, roll] in degrees. The demos check ray ordering, duplicate/range anomalies, before/after pose span, stationary consistency, and overlap. This is pose-conditioned mapping, not a demonstrated independent SLAM estimator with loop closure.[1][2][3]

Calibration limit: the shared LiDAR metadata does not include the LiDAR component's capture pose. Street mapping assumes identity camera-to-LiDAR extrinsics for its spawned camera. For a displaced/rotated sensor, apply calibrated extrinsics and convert centimetres to metres exactly once; do not treat a plausible plot as proof of correct calibration.[2][3]

2. Occupancy: observation contract versus visualization

Synchronized occupancy and panoramic depth observation
Synchronized occupancy and panoramic depth observation

A compatible runtime supplies dense boolean grids in C order with axes [x, y_up, z]. These grid axes are not the Unreal world XYZ convention. Query the specification before feeding a model:[1][2]

vget /scene/occupancy/spec lingo_vis mesh
vget /scene/occupancy npy lingo_vis mesh 0 0 0 0 0

The final five values are origin XYZ in world centimetres, yaw in degrees, and include_dynamic (0 here). Replace the origin for your task; the all-zero example is world-origin anchored, not automatically camera-relative.[1][2]

Profile Local bounds in metres (min → max) Shape Resolution
lingo_vis (-4, 0, -6) → (4, 2, 6) 400 x 100 x 600 2 cm
lingo_train (-3, 0, -4) → (3, 2, 4) 300 x 100 x 400 2 cm

bounds rasterizes visible component AABBs for a faster structural preview. mesh tests render/cooked collision triangles but can fall back to bounds when compatible CPU triangle data is unavailable. Collision enable state is not the visibility filter. Choose --include-dynamic only when dynamic actors should contribute.[1][2]

GPU viewer: local shared memory and an OpenGL display

Start the compatible runtime first:

python example/new_features/realtime_scene_occupancy_gpu.py --camera-id 0 --method mesh --extent-m 10 --voxel-size-m 0.3 --max-frames 30

This uses GLFW/ModernGL for GPU-instanced visualization; it does not establish GPU voxelization on the server. It requires a usable graphics context. Both viewers request /scene/occupancy_shared_region, not the fixed LINGO profile: their --extent-m and --voxel-size-m define a custom cube. The GPU defaults are 10 m and 0.3 m; the CPU defaults are 20 m and 0.05 m. Do not compare their timings as if the workloads were identical.[3]

CPU viewer: bounded PNG export without its display window

python example/new_features/realtime_scene_occupancy.py --camera-id 0 --method bounds --extent-m 10 --voxel-size-m 0.3 --max-frames 1 --no-display --output artifacts/occupancy.png

The CPU viewer uses NumPy/OpenCV projection instead of ModernGL. --no-display suppresses its OpenCV window, not Unreal rendering or the need for a working runtime. --output overwrites the latest visualization PNG; it is not a raw-grid dataset or MP4 recorder. --max-points limits plotted points, not the server's dense allocation.[3]

Both viewers follow camera location/yaw every frame unless --origin-cm X Y Z and/or --yaw-degrees override them. Their manual shared-memory readers implement Windows mappings and Linux /dev/shm; there is no TCP fallback in these viewers and no implemented macOS mapping path. Reduce extent or increase voxel size before requesting a large dense grid.[2][3]

3. Camera capture, transport, and recording

Cine Camera manual focus demonstration
Cine Camera manual focus demonstration
Cine Camera MQRC focus demonstration
Cine Camera MQRC focus demonstration

Use the capture transport reference and Python transport table for the full contract. Automatic transport selection belongs to the high-level API/version manager, not arbitrary raw Client.request strings.[4]

Need API behavior in the audited client source
RGB/normal/mask or depth arrays UnrealCv_API.get_image/get_depth select advertised shared commands, otherwise legacy TCP capture
Occupancy arrays UnrealCvPlusAPI.get_scene_occupancy/get_scene_occupancy_region can select shared or NPY fallback
Panoramic arrays get_camera_panoramic_frame and normal/mask/depth frame variants require the corresponding shared endpoint; no equivalent file-command fallback
Panoramic files capture_panoramic and normal/mask/depth variants write runtime-side files; they are not in-memory frame APIs
LiDAR frame helper get_camera_lidar_frame requires its shared command; use the demo's explicit NPY path when appropriate

Panoramic capture uses an equirectangular layout; normal, mask, and depth support depends on the runtime. See the panoramic reference.[2][4]

Record through the actual high-level API

The audited source defines recording methods on UnrealCvPlusAPI, not the socket unrealcv.Client. Some upstream recording/panoramic snippets show those methods on Client; do not copy that ownership assumption. A method present in source or an installed wheel still does not add the runtime endpoint.[5]

This example requires a client exposing unrealcv.plus_api.UnrealCvPlusAPI and a server advertising the recording commands. Replace camera 0 and the output directory; the directory is on the Unreal host, not necessarily the Python machine:

import time
from unrealcv.plus_api import UnrealCvPlusAPI

api = UnrealCvPlusAPI(port=9000, ip="127.0.0.1", resolution=(640, 360))
try:
    command = api.start_simple_recording(
        "0", "C:/recordings/scene01", 30, 5.0, ["lit", "mask"], return_cmd=True
    )
    if api.supports_command(command) is not True:
        raise RuntimeError("Recording command is unavailable or unverified")
    api.set_warmup_frames(10)
    api.start_simple_recording("0", "C:/recordings/scene01", 30, 5.0, ["lit", "mask"])
    deadline = time.monotonic() + 30
    while api.is_recording("0"):
        if time.monotonic() > deadline:
            api.stop_recording("0")
            raise TimeoutError("Recording exceeded the wait limit")
        time.sleep(0.5)
finally:
    api.client.disconnect()

Configure warm-up and other temporal settings before capture; inspect the runtime response and files afterward. A returned start acknowledgement is not proof of completed frames or a single encoded MP4. The source's example/DataRecording/VideoRecordingPipeline.py only configures values and prints a completion message—it does not call start_simple_recording; use the explicit calls above. See the recording reference for channels, pause/resume, viewport/movie-quality controls, and naming.[5]

For documentation media rather than a modality dataset, Pillow-based record_feature_gif.py is optional:

python example/new_features/record_feature_gif.py --source window --window-title "UnrealZoo" --duration 8 --fps 12 --output artifacts/feature.gif

--source window is Windows-only. screen needs a desktop capture backend; unrealcv needs a running server and valid camera. Install Pillow if PIL is missing; it is imported by this utility but not explicitly listed in gym's dependencies. Do not confuse a screen GIF with synchronized sensor recording.[3][7]

4. Drone appearance and 3D navigation

Runtime drone mesh switching
Runtime drone mesh switching
Drone flight: avoidance, climbing, turning and descending
Drone flight: avoidance, climbing, turning and descending

Change visuals without respawning the pawn

python example/new_features/drone_mesh_switch_demo.py --interval 2 --cycles 2 --render

This launches Gym Navigation with a customized drone. Without --render, it logs transitions only. It restores spy before closing unless --no-reset is set.[1][3]

set_app index Appearance Role
0 spy Animated model
1 fpv Animated model
2 police Animated model
3 template Customization template
4 baba Animated model
5 delivery Animated model

For an existing actor in a manually started runtime, replace the instance name:

python example/new_features/cycle_placed_drone_appearances.py --host 127.0.0.1 --port 9000 --actor bp_drone_customized_C_1 --appearances 0,1,2,3,4,5 --cycles 1

The placed-drone cycling utility also applies per-appearance actor scales (0.2 for indices 0 and 2, 1.0 otherwise); it is not a read-only inspector. Refresh navigation collision after such scale changes before submitting a new goal.[3]

vbp <actor> set_app 2 changes the live pawn's visuals while preserving controller, physics, camera, and task state. set_app_mesh_path accepts a compatible cooked Unreal object path, not a filesystem path; external content must already be loaded/mounted. A single imported Static Mesh does not acquire animated propellers automatically.[1][2]

Updating Python alone is insufficient. Use a package containing the v3.1.4 navigation feature and an actual BP_Drone_customized instance. With an already connected socket client:[1][2]

drone_id = "bp_drone_customized_C_1"
client.request(f"vbp {drone_id} set_phy 1")
print(client.request(f"vbp {drone_id} nav_update_collision"))
client.request(f"vbp {drone_id} nav_to_goal 1500 0 1500")
print(client.request(f"vbp {drone_id} get_nav_status"))

Before submitting the goal, inspect nav_update_collision: its JSON ReturnValue is the scaled envelope radius in world centimetres; -1 is failure. Finish reset-time scale/appearance changes first. Refreshing cancels active navigation. Goals are UE world centimetres (Z up); choose a reachable point, retain the original gravity-disabled physics flight mode, and ensure obstacles block its query channel. No ground NavMesh is required.[1]

nav_to_goal returning ok means the request started, not arrival. Poll get_nav_status until Succeeded, Failed, or Cancelled. nav_stop brakes before cancellation; use nav_release before manual set_move or policy control, noting that release preserves momentum.[1]

5. Character social animations

Runtime character social animations
Runtime character social animations

Use a compatible BP_Character and its cooked social-animation bundle—not the drone appearance system. Replace <actor> with the actual character instance:

vbp <actor> set_social_anim MakeJokes
vbp <actor> set_social_anim Reading
vbp <actor> set_social_anim SpeakOnPhone

The input is the case-sensitive suffix after AM_: AM_MakeJokes becomes MakeJokes. Names such as Selfy, DrinkCoffe, and DrinkCoffy are intentional identifiers, not spelling to normalize. Unknown or uncooked names are errors; generic Blueprint dispatch does not prove that this actor implements the function or has the animation. Use the complete upstream argument list rather than inventing names.[1][2]

6. External 3DGS and PAK content

External 3DGS environment loaded with a supported actor
External 3DGS environment loaded with a supported actor

Runtime loading consumes an already imported and cooked Gaussian-splat scene. It does not import raw PLY on each reset. Match the target UnrealZoo engine version, platform, plugin build, and content dependencies when cooking; the PAK tutorial's UE5.6 example is not a compatibility guarantee for a UE5.7 runtime.[1][2][6]

  1. Import the 3DGS asset and create the level in a compatible Editor project. Include its required plugins/materials/dependencies in the cooking workflow.
  2. Use a Primary Asset Label with a unique positive chunk ID; include levels/meshes and Blueprint assets appropriately. Enable Use Pak File and Generate Chunks, disable Use Io Store, and ensure the label is not Editor-only as described in the PAK workflow.[6]
  3. Cook/package for the same target platform. Copy the generated PAK into the application's Content/Paks/ before startup only if that application supports startup discovery; otherwise use supported runtime mount/scan commands.[6]
  4. Verify mounting and asset visibility, then load the cooked level. Example Windows host path and virtual content root:
vset /pak/mount D:/Paks/My3DGS_Windows.pak 0
vget /pak/mounted
vset /pak/scan /Game/3dgs 1
vget /pak/assets /Game/3dgs
vset /action/game/level /Game/3dgs/custom_3dgs

The /pak/* endpoints are optional UnrealZoo extensions, not guaranteed in open-source UnrealCV. Check the connected server's command/help surface before using them; a successful mount alone does not prove the level and dependencies are loadable. See the PAK command reference.[6]

Path kind Example Meaning
Runtime-host filesystem D:/Paks/My3DGS_Windows.pak Container to mount
Unreal level/package /Game/3dgs/custom_3dgs Cooked level to activate
Unreal object /Game/MyAssets/DroneMesh.DroneMesh Mesh object for an API expecting an object path

The loaded scene can reuse supported UnrealZoo actors, cameras, observations, and task APIs; it does not manufacture missing actors, collision geometry, navigation readiness, or task registrations. Verify those in the new level before an experiment. For ordinary asset import also see Import custom assets.[1][2]

Runtime checks

Verify package contents, sensor calibration, and recording outputs in the target runtime. If an endpoint is missing, use a compatible runtime or a documented fallback; updating Python does not add server capabilities.

Sources

[1] https://github.com/UnrealZoo/unrealzoo-gym/blob/01f56d4180c8dba2f5ca65430a61cb59e76b2ba0/example/new_features/README.md [2] https://github.com/UnrealZoo/unrealzoo-gym/blob/01f56d4180c8dba2f5ca65430a61cb59e76b2ba0/doc/CHANGELOG_v3.1.md [3] https://github.com/UnrealZoo/unrealzoo-gym/tree/01f56d4180c8dba2f5ca65430a61cb59e76b2ba0/example/new_features [4] https://github.com/unrealcv/unrealcv/blob/67d466a246c7bacffab5392312b0746191fa5c10/docs/reference/python_client_shared_transport.md [5] https://github.com/unrealcv/unrealcv/blob/67d466a246c7bacffab5392312b0746191fa5c10/client/python/unrealcv/plus_api.py [6] https://github.com/unrealcv/unrealcv/blob/67d466a246c7bacffab5392312b0746191fa5c10/docs/tutorials/pak-workflow.rst [7] https://github.com/UnrealZoo/unrealzoo-gym/blob/01f56d4180c8dba2f5ca65430a61cb59e76b2ba0/pyproject.toml