Environment Setup¶
This guide helps you set up TongSIM Lite locally and verify that the Unreal server and the Python SDK can communicate over gRPC.
What you’ll achieve
- Open and run the Unreal project:
unreal/TongSim_Lite.uproject - Install the Python SDK dependencies (via
uvorpip) - Connect from Python to the UE gRPC server (
127.0.0.1:5726)
Prerequisites¶
- Unreal Engine
5.6(Epic Games Launcher) - Visual Studio
2022with workloads:- Desktop development with C++
- Game development with C++
- Python
>= 3.12 - Git + Git LFS
- (Optional) NVIDIA driver / CUDA (only if your workflow requires it)
- Unreal Engine
5.6(Linux setup varies; follow Epic’s official guidance) - Python
>= 3.12 - Git + Git LFS
Path naming
Keep your project path free of spaces, non-ASCII characters, and overly long directory names to avoid Unreal build and asset issues.
Get the repository (Git + LFS)¶
git clone https://github.com/bigai-ai/tongsim
cd tongsim
git lfs install
git lfs pull
Why LFS matters
TongSIM assets are stored with Git LFS. If git lfs pull is skipped, the Unreal project may open with missing content.
Install TongSimGrpc gRPC dependencies (first-time)¶
The TongSimGrpc plugin depends on prebuilt gRPC binaries and tools. To keep the Git repository lightweight, these large files are distributed as a GitHub Release asset (download once after cloning).
TongSimGrpc_deps.zip: https://github.com/bigai-ai/tongsim/releases/download/tongsimgrpc-deps-v1.0/TongSimGrpc_deps.zipTongSimGrpc_deps.zip.sha256: https://github.com/bigai-ai/tongsim/releases/download/tongsimgrpc-deps-v1.0/TongSimGrpc_deps.zip.sha256
$base = "https://github.com/bigai-ai/tongsim/releases/download/tongsimgrpc-deps-v1.0"
Invoke-WebRequest "$base/TongSimGrpc_deps.zip" -OutFile TongSimGrpc_deps.zip
Invoke-WebRequest "$base/TongSimGrpc_deps.zip.sha256" -OutFile TongSimGrpc_deps.zip.sha256
# (Optional) Verify checksum
Get-FileHash .\TongSimGrpc_deps.zip -Algorithm SHA256
Get-Content .\TongSimGrpc_deps.zip.sha256
# Extract to repo root
Expand-Archive .\TongSimGrpc_deps.zip -DestinationPath . -Force
base="https://github.com/bigai-ai/tongsim/releases/download/tongsimgrpc-deps-v1.0"
curl -L -o TongSimGrpc_deps.zip "$base/TongSimGrpc_deps.zip"
curl -L -o TongSimGrpc_deps.zip.sha256 "$base/TongSimGrpc_deps.zip.sha256"
# (Optional) Verify checksum
sha256sum -c TongSimGrpc_deps.zip.sha256
# Extract to repo root
unzip -o TongSimGrpc_deps.zip
After extraction, ensure these folders exist:
unreal/Plugins/TongSimGrpc/DynamicLibrariesunreal/Plugins/TongSimGrpc/GrpcLibrariesunreal/Plugins/TongSimGrpc/GrpcPrograms
Third-party binaries
This bundle includes third-party components (e.g., gRPC/Protobuf). Their respective licenses apply.
Build & run the Unreal project¶
- Open
unreal/TongSim_Lite.uprojectin Unreal Engine 5.6. - If prompted, let Unreal generate project files and compile modules.
- (Windows, recommended) Build once in Visual Studio:
- Open
unreal/TongSim_Lite.sln - Configuration:
Development Editor - Platform:
Win64 - Build
- Open
- In the editor, ensure plugins are enabled:
TongSimCoreTongSimGrpc
gRPC endpoint & firewall
The UE server binds to 0.0.0.0:5726 by default (see unreal/Plugins/TongSimGrpc/Source/TongosGrpc/Private/TSGrpcSubsystem.cpp).
- On Windows, allow Unreal Editor through the firewall
- From the same machine, connect with
127.0.0.1:5726
Set up the Python SDK¶
uv venv
uv sync
Run examples (start Unreal first):
uv run python examples/quickstart_demo.py
uv run python examples/voxel.py
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .
Run an example:
python examples\quickstart_demo.py
Python version
TongSIM Lite requires Python >= 3.12 (see pyproject.toml).
(Optional) Regenerate protobuf stubs¶
Only needed when .proto files change or generated files are missing.
uv run python scripts/generate_pb2.py
Generated code is written to src/tongsim_lite_protobuf/.
Smoke test (Python ↔ UE)¶
- Start Unreal Editor and Play any map so the gRPC server is running.
- In a terminal at the repo root, run:
uv run python -c "from tongsim import TongSim; sim=TongSim('127.0.0.1:5726'); print('connected', sim.context.uuid); sim.close()"
uv run python -c "from tongsim import TongSim; sim=TongSim('127.0.0.1:5726'); print('connected', sim.context.uuid); sim.close()"
If it prints connected <id>, the connection is working.
Troubleshooting¶
Connection refused / timeout
- Confirm Unreal is running and
TongSimGrpcis enabled. - Check that port
5726is free and allowed through the firewall. - If you changed the server bind address, update your Python endpoint accordingly.
Protobuf / API mismatch
- Ensure your Unreal project and Python SDK come from the same revision.
- Re-run
uv run python scripts/generate_pb2.pyif.protofiles changed.
Next: First Simulation · How TongSIM Works