i created my own protocol for my games...

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ต.ค. 2024
  • / theprimeagen
    Best Way To Support Me
    Become a backend engineer. Its my favorite site
    boot.dev/?prom...
    This is also the best way to support me is to support yourself becoming a better backend engineer.
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
    Have something for me to read or react to?: / theprimeagen
    Kinesis Advantage 360: bit.ly/Prime-K...
    Get production ready SQLite with Turso: turso.tech/dee...

ความคิดเห็น • 85

  • @notrealsaga
    @notrealsaga 6 ชั่วโมงที่ผ่านมา +104

    Watching people who are great at using vim is like watching people training at the gym: you find them sexy, you want to be like them, but you don't want to go through the effort

    • @Skaffa
      @Skaffa 6 ชั่วโมงที่ผ่านมา +12

      i like the way you worded that

    • @Kane0123
      @Kane0123 5 ชั่วโมงที่ผ่านมา +2

      This is perfeft

    • @moonasha
      @moonasha 4 ชั่วโมงที่ผ่านมา +2

      not even worth the effort for me. I spend maybe 5% of the time actually coding, the rest is switching between files, peeking at classes, debugging. All the shortcuts don't mean diddly squat for me. But visual studio's tab layout and ability to peek at stuff really quickly helps.

    • @hamm8934
      @hamm8934 4 ชั่วโมงที่ผ่านมา +2

      Vim speeds up switching files, peeking at classes, and debugging, and much more. Vim isnt just about the improved speed writing code. Vim speeds up window management, navigating files, moving window panes, etc..

    • @Testvvjnb-ci3zl
      @Testvvjnb-ci3zl 4 ชั่วโมงที่ผ่านมา +2

      @@moonasha hm really? I am working in a medium sized go project in lazyvim currently and few months ago used vs code. To me, all of the things you said feel much more comfortable in it. Debugging is basically on par (weird default shortcuts), but for me project navigation, or switching between files is much easier in vim.

  • @Crcs-1997
    @Crcs-1997 7 ชั่วโมงที่ผ่านมา +42

    These video formats are my favorite. Love the content

  • @AlucardNoir
    @AlucardNoir 7 ชั่วโมงที่ผ่านมา +35

    "[...]I think that's probably more than enough, than I need" You're just asking for trouble now.

    • @Exilum
      @Exilum 3 ชั่วโมงที่ผ่านมา +1

      That's what the version tag is for

  • @kaibe5241
    @kaibe5241 4 ชั่วโมงที่ผ่านมา +5

    Man, really wanna see more of these kinds of videos - your deep dive into this, showcasing also your knowledge of things like TCP protocol and websockets, is super interesting :)

  • @kefpull6676
    @kefpull6676 7 ชั่วโมงที่ผ่านมา +118

    "kinda FUN"
    (laughs in 9999 possible vulnerabilities)

    • @AstuteJoe
      @AstuteJoe 6 ชั่วโมงที่ผ่านมา +8

      Kinda the only way to make profitable realtime* multiplayer games unfortunately though

    • @ahmednishaal9432
      @ahmednishaal9432 6 ชั่วโมงที่ผ่านมา +2

      Let's have Thor ethically hack his servers 😂😂😂

    • @rusting_in_peace
      @rusting_in_peace 4 ชั่วโมงที่ผ่านมา +2

      first make shit work, then make it safe. Securing a protocol/channel is not an easy task, and you probably need the support of your Russian/Asian hacker friend to do it.

    • @AstuteJoe
      @AstuteJoe 4 ชั่วโมงที่ผ่านมา

      ​@@rusting_in_peace Not quite the case with multiplayer games too, if you don't plan the architecture ahead, and consider the gameplay implications of each architecture, you can end up with a networking model that will never be cheat proof, like making a peer to peer competitive shooter

    • @rusting_in_peace
      @rusting_in_peace 4 ชั่วโมงที่ผ่านมา

      @@AstuteJoe you have a point. And I think even now, hundreds of AAA game's middleware engineers must be working on it constantly to find an effective way...but the nature of the domain is what should be addressed on a case-by-case basis.

  • @privacyvalued4134
    @privacyvalued4134 5 ชั่วโมงที่ผ่านมา +4

    0:29 I've made so many protocols at this point, from binary to text protocols, that this is child's play for me. My recommendation for anyone's first network protocol: Two-way JSON separated by newlines. Is it efficient? Nope. JSON encoding/decoding performance is always terrible. Will it work surprisingly well? Yup! Can you easily interop fairly complex data across multiple languages and avoid a ton of bugs and security pitfalls? Sure. Can you alter it without worrying about its structure? Absolutely.

  • @nexovec
    @nexovec 7 ชั่วโมงที่ผ่านมา +8

    Yes, I did. Unfortunately it was written in lua, so as you can imagine, the moment I stopped sending string identifiers was the moment it kind of lost its ground.

  • @GlennLewis
    @GlennLewis ชั่วโมงที่ผ่านมา

    Remember the Amiga IFF ("Interchange File Format")? This brings back lots of fond memories. 🙂 Thanks for sharing!

  • @AJMansfield1
    @AJMansfield1 5 ชั่วโมงที่ผ่านมา +2

    I've built my own network format, it was horrible to debug because it was specifically designed to resist casual inspection -- using a hash-based addressing scheme where each station needed to use its cryptographic key to decide whether or not any given packet was addressed to and/or meant to be relayed by them.

  • @TheScabbage
    @TheScabbage ชั่วโมงที่ผ่านมา

    I've been using little-endian in my protocols for years, just because all the major architectures use it. It simplifies a lot of code and saves the small perf hit of having to convert back and forth constantly.

  • @KvapuJanjalia
    @KvapuJanjalia 6 ชั่วโมงที่ผ่านมา +3

    I've created my own protocol but with variable length integers in header, because it is more _fun._

  • @HypeLevels
    @HypeLevels 7 ชั่วโมงที่ผ่านมา +10

    ligmuh (I am scared let's watch this 😂)

  • @sskeptix
    @sskeptix 31 นาทีที่ผ่านมา

    I played with that stuff 2 years ago. I did almost the same except I didn't have an encoding flag but instead I had a packageId flag. You may have a situation when your client sends multiple packages and the server can spend a different amount of time handling them. Client sample sequence of events:
    Send1, send2, send3, receive response1, receive3, send4, receive2, receive4
    You may have 2 types of packages: notifications (fire and forget), request, and response.

  • @RedSpark_
    @RedSpark_ 6 ชั่วโมงที่ผ่านมา

    I love these videos, they're so inspiring. I started building a text based adventure game to learn about OOP and some design patterns, but now I'm thinking about how I could make it multiplayer.

  • @mickey20512
    @mickey20512 ชั่วโมงที่ผ่านมา

    More of these videos please! love these insights and learn heaps more then the react vidoes

  • @pdougall1
    @pdougall1 4 ชั่วโมงที่ผ่านมา

    Such a great experience in having a horrible time... my whole existence

  • @_Gart_
    @_Gart_ 7 ชั่วโมงที่ผ่านมา +1

    I need the matrix so I can download programming knowledge like this guy. He's so fast

  • @ericmackrodt9441
    @ericmackrodt9441 4 ชั่วโมงที่ผ่านมา

    That's very similar to the Napster protocol. I made a similar one to communicate with a Windows 3.11 chat app I'm building.
    The difference is that the actual values are sent in a specific order separated by spaces after the length.

  • @wdavid3116
    @wdavid3116 2 ชั่วโมงที่ผ่านมา

    If the packet is being sent via UDP you don't have to send the length because the UDP packet has a length associated with it and it will be received as a discrete message. If you send the packet via TCP (unlikely to be a good idea for real time game data,) you absolutely need a length to know where in the stream a particular message ends, or you have to do something ugly like a delimiter or fixed size messages or something.
    There isn't really any reason to use bigendian. Virtually all modern CPUs use little endian though it is pretty trivial to byteswap from big endian. The only potential advantage is that reading the data in hex format will be easier with bigendian but there isn't any reason to do that when you developed the protocol and clearly have code to parse it and present it to you in a readable fashion. It isn't very wasteful but unless you're doing raw sockets or something there is no reason to do big endian.
    Personally I really wish go had a c struct compatibility library similar to the python struct library. That would take care of all the padding and you could just use structures fill them with data and send them through sockets without serialising anything (as long as all the struct members are simple data types or structs composed of them with no pointers.) I think you can do this with unsafe go but then you lose a bunch of the benefits of using go. I settled on just using protobufs for my protocols in go. They aren't for a game but likely would be just fine for basically any game someone might write and I can generate code for all the other languages I use without doing anything. I almost went with CapNProto but it didn't support all the languages I jump between for my side projects.

  • @pixelfingers
    @pixelfingers 4 ชั่วโมงที่ผ่านมา

    Love these videos, you’re very good at describing and teaching, excellent ❤

  • @canofpulp
    @canofpulp 7 ชั่วโมงที่ผ่านมา +3

    Microsoft recall is enabled by default in the latest Windows update!!!!!!!!! update 24H2

  • @gamemusicmeltingpot2192
    @gamemusicmeltingpot2192 38 นาทีที่ผ่านมา

    I worked on a game that had this type of special protocol

  • @ErazerPT
    @ErazerPT 5 ชั่วโมงที่ผ่านมา

    Kinda wondering if just having packet[2]+packet[3]*256 (or packet[3]+packet[2]*256 depending on how you wrote it) would have any significant speed difference over a function call that basically does... just that. An optimizing compiler should inline it, but...

  • @w5nJMsMs
    @w5nJMsMs 7 ชั่วโมงที่ผ่านมา

    Questo video è la cosa migliore che sia mai capitata al mio gatto. Ora ha un nuovo idolo💕

  • @MrAbrazildo
    @MrAbrazildo 6 ชั่วโมงที่ผ่านมา

    4:05, if PACKET_ ... _SIZE is a constant, shouldn't this assert be 'n < PACKET...'?
    4:08, literal numbers... the most underestimated issue of all time! They should be MAX_TYPE_SIZE and ENCOD_SHIFT.
    6:36, couldn't it be bigger? In this case, your if would fail.

  • @bautistarescala
    @bautistarescala 7 ชั่วโมงที่ผ่านมา +1

    May i know how you type those sequence diagrams easily? I assume it's some Vim macro vut i don't use Vim so i don't know

  • @TheDoppelganger29
    @TheDoppelganger29 4 ชั่วโมงที่ผ่านมา +1

    Just where do you find time after work??

    • @johnyewtube2286
      @johnyewtube2286 ชั่วโมงที่ผ่านมา

      He no longer works at Netflix, he is full time e celeb.

  • @regiondeltas
    @regiondeltas 5 ชั่วโมงที่ผ่านมา

    This is my cup of tea. I'm not a developer by trade but I've been working on a Pico powered hobby project, in rust because of course. I've written an extensive low level TCP protocol for data transfer, super lightweight, extensible, variable packet sizes and data types etc and with a nice shared library so that I can use the same core code for both the server (again, in rust) and the pico client. You learn a LOT when implementing things at this level and its so satisfying when you get it working end to end. Got a simple UDP discovery protocol too, which was fun to do

  • @Noober666
    @Noober666 7 ชั่วโมงที่ผ่านมา

    I already knew how to do this, just wasn’t gonna tell u 😏

  • @kimberlycelaya1895
    @kimberlycelaya1895 6 ชั่วโมงที่ผ่านมา

    Welcome💙 🔥🔥🔥

  • @niklaswojtkowiak3
    @niklaswojtkowiak3 ชั่วโมงที่ผ่านมา

    Was this supposed to be on the Vimagen?

  • @johnlovell8299
    @johnlovell8299 5 ชั่วโมงที่ผ่านมา

    You didn't use Mermaid in your Markdown? Shame! :)

  • @Cdaprod
    @Cdaprod 4 ชั่วโมงที่ผ่านมา

    All the time.

  • @dennisloska
    @dennisloska 7 ชั่วโมงที่ผ่านมา

    What's the fonts/plugin name which Prime is using here? The != and

    • @benbrook469
      @benbrook469 7 ชั่วโมงที่ผ่านมา +1

      they are ligatures

    • @arashiryuu1624
      @arashiryuu1624 4 ชั่วโมงที่ผ่านมา

      The font is JetBrainsMono and those are ligatures as another commenter already mentioned. I'm not sure but I think this is the default font for Ghostty. It doesn't look like Prime has done much if any customization.

  • @jop0693
    @jop0693 6 ชั่วโมงที่ผ่านมา +1

    Anyone knows how he did the markdown graphics?

  • @luizalbertolausdarosa6819
    @luizalbertolausdarosa6819 5 ชั่วโมงที่ผ่านมา

    Now do it with UDP, please!

    • @justanothercomment416
      @justanothercomment416 5 ชั่วโมงที่ผ่านมา

      Basically the same thing. He can either fill a buffer with multiple packets and send that as a datagram (looping on read), or simply send/recv on packet per datagram. TCP is usually slightly more involved because you need to know how to parse the stream and to account for short reads and so on. Which requires lengths so as to know when the full packet (or plural) has arrived. He has lengths embedded in his packets so it's good.

    • @Testvvjnb-ci3zl
      @Testvvjnb-ci3zl 4 ชั่วโมงที่ผ่านมา

      @@justanothercomment416 udp gets fun when you need: Reliability Types, ACKs, NAKs, Ordering Channels, Split Packets, Priorities

  • @memory_leaps
    @memory_leaps 7 ชั่วโมงที่ผ่านมา +1

    how did u made the ascii tables

    • @ItzD3fW1sH
      @ItzD3fW1sH 7 ชั่วโมงที่ผ่านมา +1

      Plenty of online generators for it

  • @asmod4n
    @asmod4n 7 ชั่วโมงที่ผ่านมา

    you can send empty packets for keep alive :)

    • @greyshopleskin2315
      @greyshopleskin2315 2 ชั่วโมงที่ผ่านมา

      The kernel should automatically send keep alive packets (assuming the socket type is tcp)

  • @rusting_in_peace
    @rusting_in_peace 5 ชั่วโมงที่ผ่านมา

    good shit, im in

  • @codingwithifeanyi5379
    @codingwithifeanyi5379 ชั่วโมงที่ผ่านมา

    it this go?

  • @aajas
    @aajas 6 ชั่วโมงที่ผ่านมา +2

    6c is lowercase, the thumbnail has uppercase L

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  5 ชั่วโมงที่ผ่านมา

      such facts, well observed

  • @Tieno
    @Tieno 7 ชั่วโมงที่ผ่านมา

    13 secs and no views😢

  • @jonathan-._.-
    @jonathan-._.- 7 ชั่วโมงที่ผ่านมา +1

    tldr: always add version byte... (tes rest can be ignored 😌)

  • @bertram-raven
    @bertram-raven 5 ชั่วโมงที่ผ่านมา

    Naive in so many ways from the start. Does it get better? Where is the error correction? Where is the message resync?

  • @thip1754
    @thip1754 7 ชั่วโมงที่ผ่านมา

    Ligma

  • @Mraeth8n
    @Mraeth8n 6 ชั่วโมงที่ผ่านมา

    why did you choose 8 bits for the version? Wouldn't like maybe even 4 be sufficient?

    • @chinoto1
      @chinoto1 4 ชั่วโมงที่ผ่านมา +2

      If you're careful, but if you run fast and break things constantly... Maybe he should have gone bigger 🤣

    • @Mraeth8n
      @Mraeth8n 4 ชั่วโมงที่ผ่านมา

      @@chinoto1 haha 🤣

  • @tsgraphics1
    @tsgraphics1 7 ชั่วโมงที่ผ่านมา +1

    First

  • @midicine2114
    @midicine2114 7 ชั่วโมงที่ผ่านมา +1

    There's no money in creating a protocol for funsies therefore none of the new devs are going to do it.

  • @blackCladLad
    @blackCladLad 7 ชั่วโมงที่ผ่านมา

    What’s Ligma

    • @Skaffa
      @Skaffa 5 ชั่วโมงที่ผ่านมา

      ligma balls

  • @healord51
    @healord51 4 ชั่วโมงที่ผ่านมา

    this is not funny, I almost died of ligma a couple years ago

  • @mattbillenstein
    @mattbillenstein 5 ชั่วโมงที่ผ่านมา

    msgpack-rpc and yolo

  • @johnlovell8299
    @johnlovell8299 5 ชั่วโมงที่ผ่านมา

    binary.BigEndian FTW!

  • @jFyppzpz
    @jFyppzpz 7 ชั่วโมงที่ผ่านมา

    J'ai essayé une nouvelle position hier soir. Elle s'appelait "l'aspirateur". Il s'avère que c'est plus une question de nettoyage que d'amusement💖

  • @thetruth000
    @thetruth000 7 ชั่วโมงที่ผ่านมา +1

    first