flutter_scene_net 0.2.1 copy "flutter_scene_net: ^0.2.1" to clipboard
flutter_scene_net: ^0.2.1 copied to clipboard

dashwire multiplayer for flutter_scene. Replica-to-node binding, interpolated transform sync, and in-app hosting.

example/README.md

flutter_scene_net example #

A full host-and-join demo lives in the flutter_scene repository as the "Multiplayer" example. The core wiring:

import 'package:dashwire/dashwire.dart';
import 'package:dashwire_replication/dashwire_replication.dart';
import 'package:flutter_scene/scene.dart';
import 'package:flutter_scene_net/flutter_scene_net.dart';

// A replicated pawn whose pose drives a scene node.
final class Pawn extends TransformReplica {
  @override
  String get typeKey => 'pawn';
}

Future<void> connectAndRender(WireConnection connection, Node sceneRoot) async {
  final registry = ReplicaRegistry()..register(Pawn.new);

  final session = await connectSession(
    connection,
    schemaHash: registry.schemaHash,
  );

  // Replicas spawned by the server become nodes under [sceneRoot]; those
  // backed by TransformReplica interpolate their poses automatically.
  SceneReplication(
    registry: registry,
    session: session,
    root: sceneRoot,
    builders: {'pawn': (replica) => Node()},
  );
}

To host from inside the app instead of connecting to a server, use SceneHost.

0
likes
160
points
168
downloads

Documentation

API reference

Publisher

verified publisherbdero.dev

Weekly Downloads

dashwire multiplayer for flutter_scene. Replica-to-node binding, interpolated transform sync, and in-app hosting.

Repository (GitHub)
View/report issues

Topics

#multiplayer #networking #gamedev #dashwire

License

MIT (license)

Dependencies

dashwire, dashwire_replication, flutter, flutter_scene, scene, vector_math

More

Packages that depend on flutter_scene_net