Game Bridge Architecture
Learn how Immutable game SDKs work internally and how to adapt them for custom engines.This page is primarily for developers building custom engine integrations or wanting to understand the SDK architecture. If you’re using Unity or Unreal, refer to their respective SDK documentation.
Overview
The Unity and Unreal SDKs share a common architecture that bridges native game engines with TypeScript-based functionality. This design allows consistent behavior across platforms while leveraging platform-specific capabilities. The architecture has three main components: a game bridge for communication, an invisible WebView for executing TypeScript, and an in-app browser for secure authentication.Architecture Diagrams
High-Level Architecture
Communication Flow
How the game engine communicates with TypeScript SDK packages through JSON serialization:PKCE Authentication Flow
How authentication works using in-app browsers for security:Core Components
1. Game Bridge
The game bridge enables string-based communication between your game engine and the TypeScript SDK. How it works:- The
game-bridgepackage enables communication with TypeScript SDK packages - TypeScript packages are bundled into a single file loaded into an invisible WebView
- The game SDK sends JSON string messages to the WebView and receives responses
- Unity:
index.html - Unreal:
index.js
game-bridge package.
2. WebView
An invisible WebView loads the game bridge and executes TypeScript SDK functionality. Requirements:- HTML/JavaScript loading support
- Modern JavaScript (ES6+)
- Bidirectional native-JavaScript communication
- Hidden from user view (no UI rendering)
- Mobile: Native WebView components (Android/iOS)
- Desktop: May require embedded browser frameworks
- Windows: CEF 90+ required
3. In-App Browser
Authentication uses an in-app browser (not WebView) for security and SSO compatibility. Requirements:- Secure, isolated browser context
- Process isolation (runs separately from your app)
- Deep link callback handling
- System authentication session support
Adapting for Custom Engines
To adapt the SDK for your custom engine, you’ll need to modify three areas:1. Modify the Game Bridge
Keep the bundled TypeScript SDK but modify thecallbackToGame() function in game-bridge/index.ts to communicate with your engine.
After modification, rebuild the bundle following the game-bridge README.
2. Implement WebView Communication
Option A: Reuse our platform-native WebView implementations and adapt the communication layer Option B: Implement a custom WebView with bidirectional string communication and lifecycle management Reference implementation:- C# engines: Unity SDK
- C++ engines: Unreal SDK