flutter3d_net 0.8.1 copy "flutter3d_net: ^0.8.1" to clipboard
flutter3d_net: ^0.8.1 copied to clipboard

Rollback netcode over `sim`: input frames per step, prediction, correction, and the transport behind an interface so a game never names WebRTC or a socket.

flutter3d_net #

Rollback netcode over flutter3d_sim, part of flutter3d. Peers exchange input frames every step, predict with the last frame that arrived, and roll back when a confirmation disagrees. The session also keeps a count of dropped corrections that a game can show without having to explain what a rollback is.

It is plain Dart. NetSession reads the caller's input through two callbacks and never names a genre, a widget or a socket. NetTransport is the only way out to a real network. LoopbackTransport stands in for it with a real fixed delay and a real, seeded loss rate, and the test suite drives two sessions through it instead of through a mock that cannot lie about timing. A real transport, such as a relay over WebSocket or WebRTC through flutter3d_net_webrtc, implements the same interface.

import 'package:flutter3d_net/flutter3d_net.dart';

final session = NetSession(
  transport: myTransport,
  captureLocalFrame: () => myLatestInput(),
  applyAndStep: (local, remote) => myGame.step(local, remote),
  save: () => myGame.snapshot(),
  restore: (snapshot) => myGame.restore(snapshot),
);

bin/relay.dart is the relay from net-02: one process, rooms identified by a short code in the URL path, and no accounts. Its role is limited to signalling and a WebSocket fallback for networks WebRTC cannot cross.

0
likes
150
points
649
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Rollback netcode over `sim`: input frames per step, prediction, correction, and the transport behind an interface so a game never names WebRTC or a socket.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#game-development #game-engine #networking #multiplayer

License

MIT (license)

Dependencies

flame_multiplayer, flutter3d_sim, web_socket_channel

More

Packages that depend on flutter3d_net