This repository aims to sum up the extent of the open-source project nx Gamepad which not only provides a Flutter plugin for utilizing platform-specific game controller inputs on an application. Inspired by the Wii U console, the library additionally aims to unlock the potential of using a smartphone in combination with a controller peripheral as a gamepad for your computer.
In order to showcase and explain this concept in more detail, the releases page lists all of the installable applications and mods of this project. The following sub respositories provide corresponding examples with comprehensive documentation on how to implement such functionality yourself:
- n Gamepad - Available Flutter plugin for game development
- tx Gamepad - Concrete implementation of the Flutter plugin
- rx Gamepad - Example for a specific game server application
The project's core is the Flutter plugin, with platform-specific implementations responsible for sending input events from a connected controller to a compatible game. It supports Android devices and has planned support for iPhones, the Steam Deck, and the Asus ROG Ally. New user interfaces and interactions are easily implemented for an application which serves as the gamepad, while games need to integrate to react and respond to the before mentioned events.
The following diagram illustrates important communication flows:
App
+-------------------------------------------------------+
| | - Android (working)
| +- Flutter --------+ +- Platform -------+ |
| | Client | ------- | Client | | - iOS (planned)
| +------------------+ +------------------+ | - Linux (planned)
| | ▲ | | - Windows (planned)
+-----------|--|-------------------------|--------------+
| | |
| | |
Mod | | |
+-----------|--|-----------+ |
| ▼ | | |
| +- Game -----------+ | |
| | Server | ◀---------------+
| +------------------+ |
| |
+--------------------------+
Input events are sent via UDP over the local network from either the Flutter or Platform Client to a Game Server. Flutter is able to communicate with a dedicated Platform integration via method channels to also receive input events or confirm that a connection has been established, but is mainly focused on managing custom interactions with its user interface, which needs to be retrieved according to changes from the Game Server. This modular design ensures an easy addition of new platforms and allows to only need to integrate the client once.
For a detailed description of input events and the client-server communication please refer to the wiki page of this repository.
- User interface and interactions only need to be written once
- Available connection setup and communication with game servers
- Support for touch, gyro, button, dpad, joystick, and trigger input events
- Event channels for input events between platforms and Flutter
While Flutter provides a powerful toolset for 2D UI development, it still has limitations when it comes to 3D models and rendering. Furthermore, the project only focuses on using Wi-Fi for gamepad connections, as it offers higher bandwidth for streaming compared to Bluetooth. Lastly, it is well tested with the Razer Kishi v1 controller for Android but other gamepad peripherals may require additional development.
Fortunately, all those points are able to be worked on and should therefore be crossed off over time. Even Flutter is receiving a new rendering engine called Impeller, which looks very promising to fill in the gap for the 3D related shortcomings.
Planned developments for the nx Gamepad project include:
- Adding Linux and iOS platform support
- Implementing gyro controls with Flick Stick
- Support usage of multiple controllers
- Integrate shared preferences for settings
- Expanding gamepad peripheral compatibility
- Develop compatible Unity plugin for games
- Alternative connection options like Bluetooth
- Improve security and encryption for connection
- Additional mode to stream game contents
Community contributions are highly encouraged to make this project as accessible to game developers as possible.
To contribute to any of the previously mentioned repositories, please follow these steps:
- Fork the repository of your choice
- Create a new branch for your changes
- Commit your changes to your branch
- Push your changes to your fork
- Open a pull request to that repository
I will review your pull request and provide feedback or merge your changes as quickly as possible. If you have questions or need assistance, please do not hesitate to reach out. For problems with specific libraries, use the issue tracker of the respective repository. Feature suggestions can be discussed on the issues page of this one. Your input and help in improving this project are invaluable!