コンテンツにスキップ

🖥️ UI & Camera API

This section provides endpoints for manipulating the in-game camera, opening game windows, and rendering visual overlays or images.

Camera Controller

Provides endpoints for controlling the user's view in the game. Allows external tools to pan the camera to specific coordinates or adjust the zoom level programmatically.


POST
/api/v1/camera/change/zoom

UI Camera

Adjusts the in-game camera's zoom level to a specified value, instantly changing the field of view. This allows for precise control over how close or far the camera is on the game map.

Example:

curl --request POST \
--url 'http://localhost:8765/api/v1/camera/change/zoom?zoom=15'

Response:

{
"success": true,
"errors": [],
"warnings": [],
"timestamp": "2025-12-09T19:16:06.4839322Z"
}


POST
/api/v1/camera/change/position

Instantly moves the in-game camera to the specified world coordinates on the current map.

Example:

curl --request POST \
--url 'http://localhost:8765/api/v1/camera/change/position?x=50&y=50'

Response:

{
    "success": true,
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-08T19:13:29.997162Z"
}


POST
/api/v1/camera/follow/pawn

UI Camera

Jumps the camera to the position of a pawn identified by their numeric ID. Useful for cinematic capture or tracking a specific colonist, animal, or enemy.

Example:

curl --request POST \
--url 'http://localhost:8765/api/v1/camera/follow/pawn?pawn_id=526'

Response:

{
"success": true,
"errors": [],
"warnings": [],
"timestamp": "2025-12-09T19:16:06.4839322Z"
}


POST
/api/v1/camera/screenshot

UI Camera

Captures the current game view as a base64-encoded JPEG. Supports optional width/height resizing — omit both to return the native resolution.

Example:

curl --request POST \
--url http://localhost:8765/api/v1/camera/screenshot \
--header 'content-type: application/json' \
--data '{"width": 1280, "height": 720}'

Request:

{
    "width": 1280,
    "height": 720
}

Response:

{
    "success": true,
    "data": {
        "image": "/9j/4AAQSkZJRgAB...",
        "width": 1280,
        "height": 720
    },
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-09T19:16:06.4839322Z"
}


POST
/api/v1/camera/screenshot/native

UI Camera

Moves the camera to the specified position and saves a full-quality screenshot directly to the host machine's hard drive using Unity's built-in capture.

Example:

curl --request POST \
--url http://localhost:8765/api/v1/camera/screenshot/native \
--header 'content-type: application/json' \
--data '{"x": 100, "z": 100, "path": "C:/screenshots/colony.png"}'

Request:

{
    "x": 100,
    "z": 100,
    "path": "C:/screenshots/colony.png"
}

Response:

{
    "success": true,
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-09T19:16:06.4839322Z"
}


POST
/api/v1/camera/stream/start

Starts a live video stream of the game's current camera view. This endpoint initiates a real-time broadcast of the rendered gameplay, capturing exactly what is visible in the player's main viewport.

Example:

curl --request POST \
--url 'http://localhost:8765/api/v1/camera/stream/start'

Response:

{
    "success": true,
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-08T19:13:29.997162Z"
}


POST
/api/v1/camera/stream/stop

Gracefully stops the active live video stream of the game's camera view.

Example:

curl --request POST \
--url 'http://localhost:8765/api/v1/camera/stream/stop'

Response:

{
    "success": true,
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-08T19:13:29.997162Z"
}


POST
/api/v1/camera/stream/setup

Configures the parameters and settings for the live video stream before starting it.

Example:

curl --request POST \
--url 'http://localhost:8765/api/v1/camera/stream/setup?ip=127.0.0.1&port=5007&frame_width=1920&frame_height=1080&fps=15&quality=30'

Request:

{
    "port": 8080,
    "address": "127.0.0.1",
    "frame_width": 1280,
    "frame_height": 720,
    "target_fps": 30,
    "jpeg_quality": 85
}

Response:

{
    "success": true,
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-08T19:13:29.997162Z"
}


GET
/api/v1/camera/stream/status

Returns the current status and configuration of the live camera stream.

Example:

curl --request GET \
--url 'http://localhost:8765/api/v1/camera/stream/status'

Response:

{
    "success": true,
    "data": {
        "is_streaming": false,
        "config": {
            "port": 5007,
            "address": "127.0.0.1",
            "frame_width": 1280,
            "frame_height": 720,
            "target_fps": 15,
            "jpeg_quality": 50
        }
    },
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-09T19:31:56.8297247Z"
}

Overlay Controller

The Overlay Controller is for drawing overlays on the screen.


POST
/api/v1/ui/announce

Image Controller

Provides endpoints for extracting visual assets and textures from the game. This is essential for external tools that need to render game maps or items visually by retrieving the actual textures used by RimWorld.


GET
/api/v1/terrain/image

Retrieves the texture image for a specific terrain definition in Base64 format. The name parameter corresponds to the defName of the terrain (e.g., Soil, WaterDeep, Sand).

Example:

curl --request GET \
--url "http://localhost:8765/api/v1/terrain/image?name=Soil"

Response:

{
    "success": true,
    "data": {
        "name": "Soil",
        "image_base64": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0..."
    },
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-14T14:15:30.000Z"
}


GET
/api/v1/item/image

Retrieves a base64-encoded image of a specific in-game item.

Example:

curl --request GET \
--url 'http://localhost:8765/api/v1/item/image?name=ComponentIndustrial'

Response:

{
    "success": true,
    "data": {
        "result": "success",
        "image_base64": "..."
    },
    "errors": [],
    "warnings": [],
    "timestamp": "2025-12-10T19:31:48.7480326Z"
}


POST
/api/v1/item/change/image

Uploads and applies a new custom texture to a specific in-game item or thing. Accepts base64-encoded image data along with various rendering properties like scale, directional facing, and masking.

Example:

curl --request POST \
--url http://localhost:8765/api/v1/item/change/image \
--header 'content-type: application/json' \
--data '{
    "Name": "WoodLog",
    "Image": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
    "Direction": "South",
    "Offset": "0,0,0",
    "Scale": "1.0",
    "ThingType": "Item",
    "IsStackable": "true",
    "MaskImage": "",
    "UpdateItemIndex": 0
}'

Request:

{
    "Name": "WoodLog",
    "Image": "<base64_encoded_string>",
    "Direction": "South",
    "Offset": "0,0,0",
    "Scale": "1.0",
    "ThingType": "Item",
    "IsStackable": "true",
    "MaskImage": "<optional_base64_mask>",
    "UpdateItemIndex": 0
}

Response:

{
    "success": true,
    "errors": [],
    "warnings": [],
    "timestamp": "2026-02-21T20:15:30.000Z"
}