Damn, I take back me warning you for scope creep / shiny object syndrome the other day, because thanks to this video, multiplayer starts to appeal to me as well 😶 Tantan! What have you done to me?!
I'm also building my own Lobby/Relay server solution. Not in Rust though. How I'm approaching it right now is to have a "Lobby Server" reserve spots/rooms on a "Relay Server". But instead of relaying the entire connection from user->lobby->relay, I just let the user connect to the relay directly. So, in case the lobby goes down, the individual relay servers still keep on going. Meaning there isn't a single point of failure.
you could use quorum pattern for your p2p. use many clients to simulate physics and the general consensus is then distributed to everyone. you can also reduce wallhacks by having clients do visibility calculations of a zone they are far away from and then send that info to the players that are over there.
some note on p2p networking from this video 2:03 Wouldn't it be wonderful if we could have just peer-to-peer connections. But there's one big issue with this and that is that the players knows each other's IP addresses. If you remember when Dany released his game crap game, he was using steam's peer-to-peer networking solution and with that some big streamers got their IP addresses leaked which is a bad thing. So what did they do to resolve that, if changed from steam's peer-to-peer solution to their relay solution which doesn't let players connect to each other instead they do it through a relay. That is what I(the video poster) have been doing. I am not gonna use steam relay solution. I have built my own entire architecture for hosting relay servers.
6:34 you might want to read about condition variables, I don't know if the rust std library implements this, but I think that would be a better solution
If your server isn't authoritative, which client is the source of truth for things that are happening outside of the player control? E.g. mob aggro, a ball rolling, etc.
With these video's, I would love to see more on how you design and architecture your systems. I commonly watch these types of video's while at work (programming) and I feel it would be a huge boom to the community if we stared sharing how to got to a design and what the overall design is rather than just the changes that were made. Edit: also every developer i.kym-cdn.com/photos/images/newsfeed/001/617/650/91a.jpg
I’m guessing this would still work with games written with networking libraries other than laminar e.g. if I wanted to use renet/bevy-renet or some other library?
are lobby, relay and clientside networking code all going to be open source or just the relay server code itself? PS: you should post this to the bevy discord!
Never heard of it but it looks like a lot to read into to get the basics. The pro of making things from the ground up is the progressive knowledge I get to build up over time.
@@Tonton-fr5st Although the initial examples were indeed a bit intimidating, I decided to try WebRTC for peer-to-peer networking in my game engine. I actually found that it works quite well - you get the benefits of being able to run both client-client games and client-relay games (should you choose). The protocol takes care of client connections and the details of relay servers for you, but you still get to use your own "lobby" server and manage packet/byte streams yourself. I'd highly recommend it as a P2P solution - but implementing your own protocol is undoubtedly also a good way to learn, and allows you to tailor things to your game's needs :)
@tantan can you please start a mini series over ggez ? Like a playlist for beginners to follow and make games? Docs are confusing for beginners. Btw love your content.
This whole relay thing seems a bit insane to me, all this hassle and extra latency just so streamer's ips are protected. If someone thinks their ip location is important to keep secret, they should use a trusted VPN provider. The average player does not need this data protected. People have been joining random thrid-party hosted servers since the beggining of the internet, without even a second thought. Take for example minecraft servers, or just random websites on the web. All of them could get your ip if they wanted, but the thing is, they just don't care. The average user's ip address is not anything valuable, and if someone suspects their IP is, then they should be using a VPN in the first place. The latency penalty is just such an insane cost added to the average user's experience, and it's not even necessary.
I think the issue isn't with sharing IPs in general, it's sharing your IP with every other player in a lobby, something that Minecraft servers and websites do not do; only the server knows your IP and no one else. Nobody cares if a server has your IP because you want to use their service, but when there are 20+ players in a lobby with someone like a streamer it becomes very tempting to be malicious with that person's IP. I'm not sure what you mean by a latency issue since this handshake behavior is only done when the connection is being made. Afterwards it seems to behave just like a normal server. Although, I do agree it is a bit complex and it makes me wonder what would happen if the 'Lobby' was to get overloaded? Sounds like you would need to have another layer of relays.
@@erfer The "game server " here is just another relay, he explains at 5:17 why a player hosted game would have a lot of latency on physics, and any server authoritive code. Now, the first part of his multiplayer is totally fine, which is player specific information. Sure, you get hackers like this, but for a small party game you play with friends it's allright. The problem comes when you start to implement things like block breaking and attacking enemies. Where is the enemy data stored and logic executed? You either need a dedicated server, or make one of the clients become the host and move enemies around, and manage the world's terrain chunk data. Here you get double the latency as compared to a standard, dedicated server design. So take people minecraft servers with bad connections, and multiply block placing - breaking lag, and mob movement / getting damaged lag by 2
I've never thought of rust as a game dev language but now that I look at it it really is built for tasks like that
You are one of the best game developer channels out here! Thank you!
Damn, I take back me warning you for scope creep / shiny object syndrome the other day, because thanks to this video, multiplayer starts to appeal to me as well 😶 Tantan! What have you done to me?!
Super interesting! Thank your for this detailed channel!
I'm also building my own Lobby/Relay server solution. Not in Rust though.
How I'm approaching it right now is to have a "Lobby Server" reserve spots/rooms on a "Relay Server".
But instead of relaying the entire connection from user->lobby->relay, I just let the user connect to the relay directly.
So, in case the lobby goes down, the individual relay servers still keep on going. Meaning there isn't a single point of failure.
I have been thinking about the cost benefits of using p2p through relay as well. So cool to see this.
Networking... "Its a big pain in the brain" -Tonton
Thanks for making this video. I found this looking for a solution to make online multiplayer Gauntlet Legends possible.
Wait what, I thought I would see 1 million subscribers..
Loved ur accent btw..
Would you recommend a book on client/server architecture for games?
you could use quorum pattern for your p2p. use many clients to simulate physics and the general consensus is then distributed to everyone.
you can also reduce wallhacks by having clients do visibility calculations of a zone they are far away from and then send that info to the players that are over there.
some note on p2p networking from this video
2:03
Wouldn't it be wonderful if we could have just peer-to-peer connections. But there's one big issue with this and that is that the players knows each other's IP addresses. If you remember when Dany released his game crap game, he was using steam's peer-to-peer networking solution and with that some big streamers got their IP addresses leaked which is a bad thing. So what did they do to resolve that, if changed from steam's peer-to-peer solution to their relay solution which doesn't let players connect to each other instead they do it through a relay. That is what I(the video poster) have been doing. I am not gonna use steam relay solution. I have built my own entire architecture for hosting relay servers.
What if one user pretends to be someone else? Is this possible? If so, how do you handle it?
6:34 you might want to read about condition variables, I don't know if the rust std library implements this, but I think that would be a better solution
If your server isn't authoritative, which client is the source of truth for things that are happening outside of the player control? E.g. mob aggro, a ball rolling, etc.
TANTANNN VIDOEOOO :D
no this is tonton
With these video's, I would love to see more on how you design and architecture your systems. I commonly watch these types of video's while at work (programming) and I feel it would be a huge boom to the community if we stared sharing how to got to a design and what the overall design is rather than just the changes that were made.
Edit: also every developer i.kym-cdn.com/photos/images/newsfeed/001/617/650/91a.jpg
We miss you TonTon :(
i love server 420
Yaaaay
Would you be willing to share some beginner tutorial about this whole thing xD This sounds amazing
I’m guessing this would still work with games written with networking libraries other than laminar e.g. if I wanted to use renet/bevy-renet or some other library?
ROBLOX has a network owner system, so that individual physics objects can be controlled by either the server or the player
are lobby, relay and clientside networking code all going to be open source or just the relay server code itself?
PS: you should post this to the bevy discord!
everything will be open sourced, except for my game specific networking code :)
lobby, relay, client
i wanted to use webrtc for my game but webrtc is crazy (in a bad way), what do you think of webrtc for a p2p solution?
Never heard of it but it looks like a lot to read into to get the basics.
The pro of making things from the ground up is the progressive knowledge I get to build up over time.
@@Tonton-fr5st Although the initial examples were indeed a bit intimidating, I decided to try WebRTC for peer-to-peer networking in my game engine. I actually found that it works quite well - you get the benefits of being able to run both client-client games and client-relay games (should you choose). The protocol takes care of client connections and the details of relay servers for you, but you still get to use your own "lobby" server and manage packet/byte streams yourself. I'd highly recommend it as a P2P solution - but implementing your own protocol is undoubtedly also a good way to learn, and allows you to tailor things to your game's needs :)
You might want to use a program tmux because you are running 3-4 terminals at once throughout your video.
Your pending request system remind me promises from javascript
Maybe tantan should be looking at rust async then?
shouldn't your second channel be TenTen? TonTon should be your fourth
haha true!
@tantan can you please start a mini series over ggez ? Like a playlist for beginners to follow and make games? Docs are confusing for beginners.
Btw love your content.
Why not make it like Minecraft? Client/Server Architecture but your users have to host their own Servers or pay someone to host for them.
First one to watch!
First! ;)
This whole relay thing seems a bit insane to me, all this hassle and extra latency just so streamer's ips are protected. If someone thinks their ip location is important to keep secret, they should use a trusted VPN provider. The average player does not need this data protected. People have been joining random thrid-party hosted servers since the beggining of the internet, without even a second thought. Take for example minecraft servers, or just random websites on the web. All of them could get your ip if they wanted, but the thing is, they just don't care. The average user's ip address is not anything valuable, and if someone suspects their IP is, then they should be using a VPN in the first place. The latency penalty is just such an insane cost added to the average user's experience, and it's not even necessary.
I think the issue isn't with sharing IPs in general, it's sharing your IP with every other player in a lobby, something that Minecraft servers and websites do not do; only the server knows your IP and no one else. Nobody cares if a server has your IP because you want to use their service, but when there are 20+ players in a lobby with someone like a streamer it becomes very tempting to be malicious with that person's IP.
I'm not sure what you mean by a latency issue since this handshake behavior is only done when the connection is being made. Afterwards it seems to behave just like a normal server. Although, I do agree it is a bit complex and it makes me wonder what would happen if the 'Lobby' was to get overloaded? Sounds like you would need to have another layer of relays.
@@erfer The "game server " here is just another relay, he explains at 5:17 why a player hosted game would have a lot of latency on physics, and any server authoritive code. Now, the first part of his multiplayer is totally fine, which is player specific information. Sure, you get hackers like this, but for a small party game you play with friends it's allright. The problem comes when you start to implement things like block breaking and attacking enemies. Where is the enemy data stored and logic executed? You either need a dedicated server, or make one of the clients become the host and move enemies around, and manage the world's terrain chunk data. Here you get double the latency as compared to a standard, dedicated server design. So take people minecraft servers with bad connections, and multiply block placing - breaking lag, and mob movement / getting damaged lag by 2
P𝐫O𝕞O𝓢m 😝