Giter Site home page Giter Site logo

roberts-pumpurs / bevy_networking_turbulence Goto Github PK

View Code? Open in Web Editor NEW

This project forked from billyb2/bevy_networking_turbulence

0.0 0.0 0.0 158 KB

Networking plugin for Bevy engine running on naia-socket and turbulence libraries

License: MIT License

Rust 99.77% HTML 0.23%

bevy_networking_turbulence's Introduction

bevy_networking_turbulence

Networking plugin for Bevy engine running on naia-socket and turbulence libraries.

Combination of naia-socket and turbulence allows for exchange of raw messages over UDP or UDP-like connection (over WebRTC), or building unreliable/reliable channels of structured messages over such UDP/UDP-like messages.

This plugin works both in native (Linux, Windows, MacOS) over UDP packets and in Browser/WASM over UDP-like messages in WebRTC channel.

Still unfinished, but main features are working. For details see Milestones.

Testing

Native

On one terminal run:

$ env RUST_LOG=debug cargo run --example simple -- --server

On other terminal run:

$ env RUST_LOG=debug cargo run --example simple -- --client

Observe PING/PONG exchange between server and client. You can run more clients in more terminals.

WASM

On one terminal run:

$ env RUST_LOG=debug cargo run --example simple --no-default-features --features use-webrtc -- --server

Change IP address in examples/simple.rs / startup() function to point to your local machine, and run:

$ cargo build --example simple --target wasm32-unknown-unknown --no-default-features --features use-webrtc
$ wasm-bindgen --out-dir target --target web target/wasm32-unknown-unknown/debug/examples/simple.wasm

Serve project directory over HTTP. For example (cargo install basic-http-server):

$ basic-http-server .

Open http://127.0.0.1:4000 and watch Browser's console in Developer Tools. You will see the same PING/PONG exchange as in the Native mode.

Channels

On one terminal run:

$ env RUST_LOG=debug cargo run --example channels --features use-udp,bevy/default -- --server

On second terminal run:

$ env RUST_LOG=warn cargo run --example channels --features use-udp,bevy/default -- --client

On third (and fourth, and more...) terminal run:

$ env RUST_LOG=warn cargo run --example channels --features use-udp,bevy/default -- --client

You can focus any of client windows and use Arrow-Left/Arrow-Right cursor keys to change "ball" trajectory. Observe your controlled ball gets synchronized to all other clients.

WASM with Graphics and Channels networking

Due to additional dependencies required, we've decided to keep the browser based graphical channels example in a separate repository. See https://github.com/ostwilkens/arugio project. It evolved a bit from the simple square balls example and may serve as a basis of your game.

client screenshot

bevy_networking_turbulence's People

Contributors

smokku avatar rj avatar billyb2 avatar phuocthanhdo avatar mvlabat avatar jcapucho avatar mgeist avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.