Comments (3)
There is an example named distributed that shows what I think you are searching for.
Anyway, from my knowledge, making a peer-to-peer game with more than two players (maybe even with two 😄 ) is more difficult than making a client-server architecture with a lot of clients. This is because you need to synchronize the state in some way among all the players, that is not trivial. On the other hand, using a client-server architecture facilitates the architecture, the synchronization and it scales better (adding a new player implies 0 costs).
I mean, I would start from the beginning with the client-server architecture. It is not harder than making by peer-to-peer (it's even simpler), and have a lot of more benefits.
And, if you trust in your clients, you can avoid sharing some computation among the server to the clients. i.e the own clients can check the collisions, there is no need to send the action to the server to ensure if the action is valid or not.
from message-io.
The article about https://medium.com/bumble-tech/webrtc-making-a-peer-to-peer-game-using-javascript-f7123aed769e is quite interesting. In that example, you are removing the need for a server by making use of STUN and ICE, that is integrated into the browser. Until I know, out of the browser, you are on your own. And these tools should be implemented/used according to your to needed. It is out of the message-io scope, which only now about messages, but you can use these message to build some behavior similar to ICE or STUN offers.
To clarify, I think that here there are 2 different concepts that maybe are mixed:
- The game network topology (In this case, client-server, or distributed peer-to-peer)
- And how you said, how to bypass port forwarding (that doesn't imply peer-to-peer).
The first is related to your network game architecture: how it works, how the state will be share, and things like that.
The second is about the network itself, out of your game: how an endpoint can know and reach the other.
For example, you could have a client-server architecture using ICE and STUN tools. One of the clients run the client and the server (transparently) on its side. It connects its client to its server directly because is in the same location, and by using ICE & STUN tools, the other client can connect to you. It seems to be peer-to-peer at the high level but remains client-server from the game view.
Maybe, is the latter what you are searching for?
from message-io.
I would start from the beginning with the client-server architecture. It is not harder than making by peer-to-peer (it's even simpler), and have a lot of more benefits.
Hmm you’re right, it’s the better option to start with. I’m still quite keen on p2p for my Shotcaller game further down the line though. Since it’s strictly 1v1, deterministic and turn-based (sort of), it should work well with p2p. It’s just nice to have a hosting option for the game that can actually scale infinitely, even if it’s not the best default.
This cleared up a few things about the application of p2p:
https://github.com/ValveSoftware/GameNetworkingSockets/blob/master/README_P2P.md
https://medium.com/bumble-tech/webrtc-making-a-peer-to-peer-game-using-javascript-f7123aed769e
I guess what’s actually most important to me is that it would be simple enough for players of my game to essentially do cargo run --example tcp server
from within the game’s UI so they could set themselves up as the host. Though they’d probably have to deal with port forwarding, which is very technical. p2p via WebRTC seems to bypass port forwarding entirely.
from message-io.
Related Issues (20)
- Unable to connect with FramedTcp HOT 1
- Release v0.15.0 HOT 8
- Add support for Bevy ECS HOT 3
- Error compiling with only tcp feature enabled HOT 3
- Release 0.16.0 HOT 2
- Buymeacoffee badge is misspelled ("bymeacoffee") HOT 1
- ws can not receive text HOT 10
- Is it possible to limit max packet size when using FramedTcp transport? HOT 1
- Is it possible to create an UART adapter? HOT 3
- Not compiling on linux (ubuntu 22.04) HOT 2
- Scaling of a application HOT 6
- is there any possibility for multiple thread mio eventloop? HOT 1
- Feature Request: Accept WebSocket URLs with parameters. HOT 3
- client don't try reconnect HOT 2
- Code very similar to the example does not work HOT 6
- Trait implementation of adapters that cannot accept a socket address? HOT 3
- Build error with Tungstenite 0.22.0+ HOT 1
- add set_reuse_port to tcp and framed_tcp HOT 1
- TCP, FramedTCP message send is not truly async HOT 3
- iOS target build complains undefined function bind_device in TCP protocol HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from message-io.