Godot Iroh
by tipragot
Supported Platforms
Godot Iroh currently supports exports for the following platforms:
- Windows
- macOS
- Linux
- Android
Web (WASM) Export Status
Web export support (for browsers) is currently not supported. More information can be found in this issue.
Installation
Installation via Asset Library
The addon is accessible on the Godot Asset Library here.
Manual Installation
- Download the latest release from releases.
- Extract the archive in your Godot project folder.
- That's it! You're all set!
Build It Yourself
To build the library from source:
-
Compile the project in release mode
Open a terminal in the project directory and run:cargo build --release
-
Locate the compiled library
After building, the compiled library will be located in thetarget/release/
directory.
The file extension will depend on your operating system:- Linux:
.so
- Windows:
.dll
- macOS:
.dylib
- Linux:
-
Copy and rename the library
- Copy the compiled library to the
addons/godot_iroh/
directory. - Rename it to match the name specified in the
addons/godot_iroh/godot_iroh.gdextension
file.
- Copy the compiled library to the
-
Use it in your Godot project
- Copy the entire
addons/
folder into your Godot project. - The extension should now be ready to use.
- Copy the entire
Usage
This plugin allows you to establish peer-to-peer multiplayer connections in Godot without relying on a centralized server, leveraging the power of Iroh.
Starting a Server
To start a server and set it as the multiplayer peer:
var server := IrohServer.start()
multiplayer.multiplayer_peer = server
You can retrieve the connection string (used to connect to this server) using:
server.connection_string()
After initializing the peer, you can use the High-level multiplayer of Godot as normal.
Connecting as a Client
To connect to an existing server using the connection string:
var client = IrohClient.connect("CONNECTION_STRING")
multiplayer.multiplayer_peer = client
Replace "CONNECTION_STRING"
with the string provided by the client acting as the server.
After initializing the peer, you can use the High-level multiplayer as normal.
Handle Client Errors
To handle connection failures on the client side, you can connect to the connection_failed signal and get the error message with the connection_error
function:
multiplayer.connection_failed.connect(func():
print("Connection error: ", client.connection_error()))
This allows you to gracefully handle cases where the client cannot connect to the server.
Examples
For more examples, see the examples folder in this repository.
Contributing
Contributions are very welcome! If you find any issues, have ideas for improvements, or want to add new features, please feel free to open an issue or submit a pull request.
I would be delighted to review and merge your contributions to help make Godot Iroh even better. Whether it's bug fixes, documentation improvements, or new functionality, your help is greatly appreciated!
Thank you for helping to grow this project!
Download
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author