crystalorb icon indicating copy to clipboard operation
crystalorb copied to clipboard

Networked example needed

Open vilcans opened this issue 4 years ago • 3 comments

The example uses a mock connection, so when I tried to implement real networking, that took a while. It would be nice to have an example of a simple but more "real" project.

FWIW, here's what I made: https://github.com/vilcans/orbgame. It's maybe not simple enough to use as an example, and maybe I'm not doing things the right way either, as I'm new to Bevy and hence also crystalorb in Bevy. I haven't figured out how to get events for disconnects yet, so players never disappear.

vilcans avatar Jul 27 '21 17:07 vilcans

Nice! Thanks for sharing orbgame - I'm sure that'll be quite useful for others to look at. If I get time this weekend (or maybe the weekend after), I'll update the readme with links to some more examples, including yours.

I haven't figured out how to get events for disconnects yet, so players never disappear.

FYI, I had to either:

  • Add some kind of heartbeat messages and disconnecting players when they timeout, or,
  • Patch the transport layer library to expose WebRTC's disconnection events when making wasm builds, if that transport layer library doesn't already expose them.

ErnWong avatar Jul 28 '21 08:07 ErnWong

* Add some kind of heartbeat messages and disconnecting players when they timeout, or,

Yes, that should work, but I haven't figured out how to send messages to the server. I haven't seen if Crystalorb has functionality for sending messages from a client to the server or from the server to a specific client. Am I supposed to use bevy_networking_turbulence directly for that? I didn't figure out how to register my Heartbeat message types.

vilcans avatar Jul 28 '21 11:07 vilcans

Am I supposed to use bevy_networking_turbulence directly for that?

Sorry for the very late reply 😅 Yes, at the moment, any other kind of messaging would need use the transport layer directly.

ErnWong avatar Sep 25 '21 02:09 ErnWong