| … | … | @@ -1,6 +1,8 @@ |
| 1 | | # HyperswarmMultiplayerPeer — Godot 4 GDExtension |
| 1 | # hyperswarm-peer |
| 2 | 2 | |
| 3 | | A C++ GDExtension that implements Godot's `MultiplayerPeerExtension` using [libudx](https://github.com/holepunchto/libudx) for P2P UDP networking. Sub-5ms latency, NAT holepunching, reliable + unreliable transfer modes — all as a drop-in replacement for ENet. |
| 3 | `HyperswarmMultiplayerPeer` — a Godot 4 GDExtension. |
| 4 | |
| 5 | A C++ GDExtension that implements Godot's `MultiplayerPeerExtension` using [libudx](https://github.com/holepunchto/libudx) for P2P UDP networking. Reliable and unreliable transfer modes, DHT peer discovery and topic-based swarm join — a drop-in replacement for ENet. |
| 4 | 6 | |
| 5 | 7 | ## Architecture |
| 6 | 8 | |
| … | … | @@ -55,11 +57,16 @@ var peer = HyperswarmMultiplayerPeer.new() |
| 55 | 57 | peer.create_server(9514) |
| 56 | 58 | multiplayer.multiplayer_peer = peer |
| 57 | 59 | |
| 58 | | # Join a game |
| 60 | # Join a game by address |
| 59 | 61 | var peer = HyperswarmMultiplayerPeer.new() |
| 60 | 62 | peer.create_client("192.168.1.100", 9514) |
| 61 | 63 | multiplayer.multiplayer_peer = peer |
| 62 | 64 | |
| 65 | # Or find each other over the DHT, with no address at all |
| 66 | peer.join_dht() |
| 67 | peer.announce_topic(topic) # host |
| 68 | peer.lookup_topic(topic) # client, then connect_to_peer(...) |
| 69 | |
| 63 | 70 | # All standard Godot multiplayer works: |
| 64 | 71 | multiplayer.peer_connected.connect(func(id): print("Peer joined: ", id)) |
| 65 | 72 | |
| … | … | @@ -114,18 +121,27 @@ hyperswarm-peer/ |
| 114 | 121 | └── README.md |
| 115 | 122 | ``` |
| 116 | 123 | |
| 117 | | ## Current Status |
| 118 | | |
| 119 | | **Working:** |
| 120 | | - All 23 MultiplayerPeerExtension virtual methods implemented |
| 121 | | - Server/client connection model |
| 122 | | - Three transfer modes (reliable, unreliable, unreliable ordered) |
| 123 | | - Background threaded UDX with thread-safe packet queues |
| 124 | | - Proper cleanup and disconnection |
| 125 | | |
| 126 | | **TODO:** |
| 127 | | - DHT-based peer discovery (currently requires knowing the server address) |
| 128 | | - NAT holepunching via HyperDHT |
| 129 | | - P2P mesh mode (`create_mesh()`) |
| 130 | | - Noise encryption (secret-stream integration) |
| 131 | | - Multi-platform builds (macOS, Windows) |
| 124 | ## API surface |
| 125 | |
| 126 | 27 bound methods beyond the `MultiplayerPeerExtension` virtuals: |
| 127 | |
| 128 | | group | methods | |
| 129 | |---|---| |
| 130 | | connect | `create_server`, `create_client`, `create_server_with_keypair`, `create_client_with_key`, `connect_to_peer` | |
| 131 | | DHT | `join_dht`, `listen_on_dht`, `get_dht_status`, `dht_put`, `dht_get`, `dht_mutable_put`, `dht_mutable_get`, `generate_dht_keypair` | |
| 132 | | topics | `announce_topic`, `join_topic`, `leave_topic`, `lookup_topic` | |
| 133 | | swarm | `swarm_join`, `swarm_leave`, `swarm_join_peer`, `swarm_leave_peer` | |
| 134 | | keys | `generate_keypair`, `get_peer_public_key` | |
| 135 | | diagnostics | `get_stats`, `get_peer_rtt`, `get_swarm_status`, `get_connection_diagnostics` | |
| 136 | |
| 137 | 22 `MultiplayerPeerExtension` virtuals are implemented (`_poll`, `_put_packet`, `_get_packet`, |
| 138 | the transfer-mode and channel accessors, `_disconnect_peer`, `_close`, …). |
| 139 | |
| 140 | ## Documentation |
| 141 | |
| 142 | - [`docs/PARITY-hyperswarm.md`](docs/PARITY-hyperswarm.md) — where this extension stands |
| 143 | against the JS Hyperswarm stack. |
| 144 | |
| 145 | ## License |
| 146 | |
| 147 | Not yet declared. |