Heroic Games Launcher constantly expands it's feature set including new integrations and game stores support.
With more and more plans for new integrations the codebase becomes more and more bloated. This proposal showcases possible way of implementing plugin system based on TCP socket connection with well known and typed protocol.
Matter of discussion: whether the plugins should be python only to provide consitent execution environment (similarily to GOG Galaxy)
Plugin is a CLI application accepting positional arguments in order
- heroic version
- TCP connection port
Plugin defines the manifest file which describes basic metadata like
- name
- version
- issue report url
- author
- store id
Bits are in low endian order.
Integers are in variable-sized format initially introduced in Sfio library. The encoding treats an integer as a number with base 128.
Most significant bit represents if the number continues on next byte.
For example number 123456789
can be represented with four 7 bit digits with values:
58, 111, 26, 21. In order from most to least significant
+-------------------------------------------+
| 10111010 | 11101111 | 10011010 | 00010101 |
+-------------------------------------------+
MSB+58 MSB+111 MSB+26 0+21
Socket messages are endcoded with protocolbuffers. Message payload is like follows
message type - integer
request id - integer
payload size - integer
...proto payload
Proto definitions will be distributed on separate repository, to be included as git submodule.
After being spawned the plugin is expected to connect to server protocol, and idenfify itself with special request which should include:
- pid
- plugin status
(to be expanded)
Heroic may drop the connection on error or if plugin with same store id is already initialized. Plugin should exit on such error
Authorization is started always by Heroic. When plugin recieves auth request it should start the flow and return the URL that needs to be opened in webview for the user. Protobuf messagess will pass raw Headers, redirected URL and more that are required for plugin to properly authenticate the user.
Heroic will request list of internal app ids from each plugin and obtain common metadata from external endpoint like https://gamesdb.gog.com or custom equivelent.
Heroic shall not handle the detials of the games by itself.
Plugins will respond with list of capabilities possible for specific game like
LAUNCH
, INSTALL
, UNINSTALL
, MOVE
, VERIFY
and more (to be expanded)
If the plugin fails to initialize, fails to complete some request or encounters any other error it has to let the launcher know about that, in order to display appropriate error message to the user.