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.
Files changed (2) hide show
  1. package/README.md +18 -19
  2. 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 { MODD } from 'modd-network';
15
-
16
- // Initialize the client
17
- const client = new MODD('your-app-id', {
18
- centralServiceUrl: 'ws://your-central-service.com', // Optional
19
- });
20
-
21
- // Create a room
22
- await client.createRoom('my-room-id', { level: 1, score: 0 });
23
-
24
- // Or join a room
25
- await client.joinRoom('my-room-id');
26
-
27
- // Listen for inputs
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
- client.sendInput({ x: 10, y: 20 });
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 with sequencing
37
+ - Real-time input synchronization (Binary protocol)
40
38
  - Snapshot state management
41
- - Mesh network connectivity
39
+ - Game engine utilities (Physics sync, Delta compression)
40
+ - Mesh network connectivity (Browser & Node.js)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modd-network",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "SDK for connecting to mesh network for multiplayer applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",