This is a powerful Godot plugin designed to handle multiple screens on Android handhelds like Ayn Thor, Retroid Pocket 5, and RG DS. It provides a low-latency Vulkan-based renderer to project a secondary viewport onto a physical second display.
The easiest way to build the plugin is using Docker. You don't need to install Android SDK, NDK, Python, or SCons manually.
- Docker
- Docker Compose
- Open your terminal in the
AynThor/directory. - Run the following command:
docker-compose up --build
- Once completed, the ready-to-use plugin will be in
AynThor/dist/AynThor. - Copy the
dist/AynThorfolder into your Godot project'saddons/directory.
Note: If you don't want to wait for the build process, you can find the pre-compiled binaries (for both Android and Windows) already available in the
AynThor/dist/AynThorfolder within this repository.
- Go to Project -> Install Android Build Template.
- In Project Settings, ensure Export -> Android -> Use Gradle Build is ENABLED. The plugin will not work without a Gradle build.
- Enable the
AynThorplugin in Project Settings -> Plugins.
- Create two
SubViewportContainernodes in your scene (one for the main screen, one for the secondary screen). - Add a
SubViewportas a child to each container. - Create an empty
Nodeand attach theAynThorManager.gdscript to it. - In the Inspector for the Manager node, assign the references to your ViewportContainers and SubViewports.
If you don't want to wrap your entire game into SubViewportContainers, you can use the plugin only for the secondary screen. Just create a viewport for the second display and leave the main game as is.
- Limitation: In this mode, you cannot use the swapping feature, as the plugin will not have control over the main window's rendering.
Plugin uses a hybrid architecture to bridge Godot's Rendering Device with Android's Presentation API:
- Android Layer (Kotlin): Detects secondary displays and creates a
Presentationwindow with aSurfaceView. - JNI Bridge (C++): Passes the native
ANativeWindowhandle from the Android Surface to the GDExtension. - Vulkan Renderer (C++/GDExtension):
- Creates a separate Vulkan Swapchain for the secondary display.
- Uses
vkCmdBlitImageto copy the frame from a GodotSubViewporttexture directly to the second screen's swapchain. - Supports hardware-level rotation and scaling.
- Godot Engine: 4.5+ (including 4.6.x)
- Architecture:
arm64-v8a(Android),x86_64(Windows Editor support) - Minimum Android API: 24 (Nougat)
CPP/: Native Vulkan implementation and JNI hooks.Kotlin/: Android Presentation and Activity lifecycle management.GDScript/: Godot-side manager (AynThorManager.gd) and editor export scripts.