| … | … | @@ -4,28 +4,23 @@ A Godot plugin and example project for loading assets from the [hypercore-protoc |
| 4 | 4 | |
| 5 | 5 | *WIP:* This is a work an progress and isn't ready for use yet. Feel free to follow for progress, though. |
| 6 | 6 | |
| 7 | | ## Plans: |
| 8 | | |
| 9 | | - Create a node-js based gateway using the `hypercore-fetch` module listening on http://localhost/ |
| 10 | | - Use HTTPClient in GDScript to connect to the gateway |
| 11 | | - Spawn gateway from within Godot in a singleton |
| 12 | | - Intercept the resource loading code to support `hyper://`? |
| 13 | | |
| 14 | | ## Research: |
| 15 | | |
| 16 | | ### How to spawn the daemon |
| 17 | | |
| 18 | | - [Use pkg](https://www.npmjs.com/package/pkg) to compile [hyper-gateway](https://github.com/RangerMauve/hyper-gateway) |
| 19 | | - Bundle daemon binaries with the project |
| 20 | | - Use [OS.execute](https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-execute) with non-blocking mode enabled. |
| 21 | | - Ensure the process is killed before exiting? |
| 22 | | |
| 23 | | ### How to interface with resource loader |
| 24 | | |
| 25 | | - Would need to recompile godot to support protocols other than `res://` |
| 26 | | - Right now it renames `res://` to the resource_path |
| 27 | | - Then treats it like a regular file to load |
| 28 | | - Would need to instead add a set of protocols to load resources from (including hyper) |
| 7 | ## How It Works: |
| 8 | |
| 9 | - Puts all the hypercore-protocol handling into an HTTP [gateway](https://github.com/RangerMauve/hyper-gateway) |
| 10 | - Bundles platform-specific binaries for the gateway |
| 11 | - Subclasses HTTPRequest to auto-spawn gateway and translate `hyper://` requests to `http://127.0.0.1:4973/hyper/` |
| 12 | - Call `request()` as you normally would, but with `hyper://` URLs |
| 13 | |
| 14 | ## TODOs: |
| 15 | |
| 16 | - Folder sync (From `hyper://` to fs, from fs to `hyper://`) |
| 17 | - Reuse `HyperGateway` instance between `HyperRequest` objects |
| 18 | - Listen for download progress (EventSource) |
| 19 | - Listen for changes (EventSource) |
| 20 | - Listen for / Publish extension messages (EventSource) |
| 21 | - Example for saving data to hyper |
| 22 | - Examples for all the methods exposed by the gateway. |
| 23 | - Basic Multiplayer demo using extension messages |
| 29 | 24 | |
| 30 | 25 | ## Supported APIs: |
| 31 | 26 | |