modd-network 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,31 +11,30 @@ npm install modd-network
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
client.onInput((input) => {
|
|
29
|
-
console.log('Received input:', input);
|
|
14
|
+
import { modd } from 'modd-network';
|
|
15
|
+
|
|
16
|
+
// Connect to a room
|
|
17
|
+
const connection = await modd('my-room-id', {
|
|
18
|
+
appId: 'your-app-id',
|
|
19
|
+
onConnect: (snapshot, inputs) => {
|
|
20
|
+
console.log('Connected with snapshot:', snapshot);
|
|
21
|
+
},
|
|
22
|
+
onTick: (frame, inputs) => {
|
|
23
|
+
console.log('Tick:', frame, inputs);
|
|
24
|
+
},
|
|
25
|
+
onDisconnect: () => {
|
|
26
|
+
console.log('Disconnected');
|
|
27
|
+
}
|
|
30
28
|
});
|
|
31
29
|
|
|
32
30
|
// Send input
|
|
33
|
-
|
|
31
|
+
connection.send({ x: 10, y: 20 });
|
|
34
32
|
```
|
|
35
33
|
|
|
36
34
|
## Features
|
|
37
35
|
|
|
38
36
|
- Room creation and joining
|
|
39
|
-
- Real-time input synchronization
|
|
37
|
+
- Real-time input synchronization (Binary protocol)
|
|
40
38
|
- Snapshot state management
|
|
41
|
-
-
|
|
39
|
+
- Game engine utilities (Physics sync, Delta compression)
|
|
40
|
+
- Mesh network connectivity (Browser & Node.js)
|