Voxel Game mini devlog - Multiplayer networking architecture

Поділитися
Вставка
  • Опубліковано 15 жов 2024
  • My voxel game's needs multiplayer networking, so I've been designing a relay lobby system that will allow players to play together.
    Through a peer to peer (p2p) like solution that masks ip adresses through a relay game server.
    The libraries I'm using for this specific networking solution:
    nanoid (GUID): crates.io/crat...
    might_sleep (cpu limiter): crates.io/crat...
    laminar (networking): crates.io/crat...
    I'm making a voxel game with Rust and Bevy, and you get to tag along in this video and see some stuff I've been implementing.
    Trying out a new video format :)
    My discord group:
    / discord
    Want to support me?
    Monero: 43Ktj1Bd4Nkaj4fdx6nPvBZkJewcPjxPB9nafnepM7SdGtcU6rhpxyLiV9w3k92rE1UqHTr4BNqe2ScsK1eEENvZDC3W1ur
    Resources (The tech I'm using)!
    bevy game engine: bevyengine.org/
    game_stat: github.com/Tan...
    physics (3D and 2D): github.com/dim...
    inspector ui (runtime tweaking): github.com/jak...
    hot reloading using dlls/so files: docs.rs/dlopen...
    benchmarking: github.com/bhe...
    world generation: my own custom implementation is not open source at the moment.
    other rust libraries, that I recommend:
    game engine: github.com/not...
    Graphics rendering api: wgpu.rs/
    multithreading: github.com/zes...
    profiling: crates.io/crat..., using Optick feature
    #tantan #voxel #gamedev

КОМЕНТАРІ • 45

  • @spacefishaviation276
    @spacefishaviation276 Рік тому +38

    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

  • @i_am_feenster
    @i_am_feenster Рік тому +21

    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?!

  • @Jianju69
    @Jianju69 Рік тому +5

    You are one of the best game developer channels out here! Thank you!

  • @karimdjemai5386
    @karimdjemai5386 Рік тому +4

    Super interesting! Thank your for this detailed channel!

  • @AlexMeesters
    @AlexMeesters Рік тому +2

    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.

  • @theseatoad
    @theseatoad Рік тому

    I have been thinking about the cost benefits of using p2p through relay as well. So cool to see this.

  • @xzippyzachx
    @xzippyzachx Рік тому +5

    Networking... "Its a big pain in the brain" -Tonton

  • @MalikEmmanuel
    @MalikEmmanuel 10 місяців тому

    Thanks for making this video. I found this looking for a solution to make online multiplayer Gauntlet Legends possible.

  • @jlebrech
    @jlebrech Рік тому +2

    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.

  • @Xeros08
    @Xeros08 27 днів тому

    We miss you TonTon :(

  • @pacadoidao8702
    @pacadoidao8702 Рік тому +2

    Wait what, I thought I would see 1 million subscribers..
    Loved ur accent btw..

  • @ArachnidAbby
    @ArachnidAbby Рік тому +2

    What if one user pretends to be someone else? Is this possible? If so, how do you handle it?

  • @arcanelore168
    @arcanelore168 7 місяців тому +1

    Would you recommend a book on client/server architecture for games?

  • @lixou
    @lixou Рік тому +4

    TANTANNN VIDOEOOO :D

  • @stephen9849
    @stephen9849 Рік тому +2

    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

  • @realderek
    @realderek Рік тому +2

    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.

  • @spik330
    @spik330 Рік тому +2

    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

  • @4rcant
    @4rcant Рік тому +4

    i love server 420

  • @zaixrx
    @zaixrx Рік тому +2

    Yaaaay

  • @hikingcrow4233
    @hikingcrow4233 Місяць тому

    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.

  • @AshtonSnapp
    @AshtonSnapp Рік тому

    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?

  • @heraclitoqsaldanha6133
    @heraclitoqsaldanha6133 Рік тому +1

    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?

    • @Tonton-fr5st
      @Tonton-fr5st  Рік тому +3

      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.

    • @DouglasDwyer
      @DouglasDwyer Рік тому +2

      @@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 :)

  • @alfredosuarez1430
    @alfredosuarez1430 11 місяців тому

    Would you be willing to share some beginner tutorial about this whole thing xD This sounds amazing

  • @laundmo
    @laundmo Рік тому +4

    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!

    • @Tonton-fr5st
      @Tonton-fr5st  Рік тому +6

      everything will be open sourced, except for my game specific networking code :)
      lobby, relay, client

  • @esben181
    @esben181 Рік тому +3

    ROBLOX has a network owner system, so that individual physics objects can be controlled by either the server or the player

  • @TechJolt3d
    @TechJolt3d Рік тому

    You might want to use a program tmux because you are running 3-4 terminals at once throughout your video.

  • @mysticrustacean4065
    @mysticrustacean4065 Рік тому +2

    First one to watch!

  • @RoamingAdhocrat
    @RoamingAdhocrat Рік тому +4

    shouldn't your second channel be TenTen? TonTon should be your fourth

  • @timwhite1783
    @timwhite1783 Рік тому

    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.

  • @Warmatx68
    @Warmatx68 Рік тому +1

    Your pending request system remind me promises from javascript

    • @AndrewBrownK
      @AndrewBrownK Рік тому +2

      Maybe tantan should be looking at rust async then?

  • @mysticrustacean4065
    @mysticrustacean4065 Рік тому +3

    @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.

  • @ChristianRoyUtah
    @ChristianRoyUtah Рік тому

  • @Xeros08
    @Xeros08 Рік тому

    First! ;)

  • @therealpeter2267
    @therealpeter2267 Рік тому

    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.

    • @erfer
      @erfer Рік тому

      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.

    • @therealpeter2267
      @therealpeter2267 Рік тому

      ​@@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

  • @briggsliceaga9257
    @briggsliceaga9257 Рік тому

    P𝐫O𝕞O𝓢m 😝