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
@Skaffa3 ай бұрын
i like the way you worded that
@Kane01233 ай бұрын
This is perfeft
@moonasha3 ай бұрын
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.
@hamm89343 ай бұрын
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..
@AG-ur1lj3 ай бұрын
@@moonashaI have vim shortcuts for all those things… project-wide grep, pinned files to jump to, jump to definition, jump to next reference, all of it
@Crcs-19973 ай бұрын
These video formats are my favorite. Love the content
@kaibe52413 ай бұрын
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 :)
@AlucardNoir3 ай бұрын
"[...]I think that's probably more than enough, than I need" You're just asking for trouble now.
@Exilum3 ай бұрын
That's what the version tag is for
@Moner-nt5td3 ай бұрын
I created my protocol 10 years ago, consider a short in the packet for routing, do not use a int for len unless you want recieve 2 gb packets, handle all connections and packets in a own async thread pool. the CPU has a fast array copy instruction, keep that in mind.
@TheScabbage3 ай бұрын
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.
@HobokerDev3 ай бұрын
Prime leveling his scope creep skills.
@kefpull66763 ай бұрын
"kinda FUN" (laughs in 9999 possible vulnerabilities)
@AstuteJoe3 ай бұрын
Kinda the only way to make profitable realtime* multiplayer games unfortunately though
@ahmednishaal94323 ай бұрын
Let's have Thor ethically hack his servers 😂😂😂
@manuel_g_g3 ай бұрын
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.
@AstuteJoe3 ай бұрын
@@manuel_g_g 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
@manuel_g_g3 ай бұрын
@@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.
@RedSpark_3 ай бұрын
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.
@AJMansfield13 ай бұрын
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.
@kernel0verflow9193 ай бұрын
Even though it’s some people thinks is depressing to see talented people code something, for me it’s motivating to work on my own skills and become better in what I’m doing. Thanks for the videos and sharing your progress prime 😇
@privacyvalued41343 ай бұрын
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.
@nexovec3 ай бұрын
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.
@uuu123433 ай бұрын
Everytime I see prime create something, I'm torn between watching or not watching the video because watching the video would risk me completely dying inside from the sheer impending feeling of being a failure and imposter hit
@TehKarmalizer3 ай бұрын
Why? Did his wife ask you to murder him and assume his identity?
@sskeptix3 ай бұрын
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.
@GlennLewis3 ай бұрын
Remember the Amiga IFF ("Interchange File Format")? This brings back lots of fond memories. 🙂 Thanks for sharing!
@Patterner3 ай бұрын
sometimes in my nightmares after i wake up screaming
@KvapuJanjalia3 ай бұрын
I've created my own protocol but with variable length integers in header, because it is more _fun._
@pixelfingers3 ай бұрын
Love these videos, you’re very good at describing and teaching, excellent ❤
@mickey205123 ай бұрын
More of these videos please! love these insights and learn heaps more then the react vidoes
@valentinrafael92013 ай бұрын
Dude, you are inspiring!
@regiondeltas3 ай бұрын
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
@vessbakalov89583 ай бұрын
This was really good.
@ericmackrodt94413 ай бұрын
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.
@wdavid31163 ай бұрын
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.
@kajika135bis3 ай бұрын
"if count == 5" should be "if count == BUF_COUNT", just sayin
@adriancruz28223 ай бұрын
All my homies hate magic numbers!
@_Gart_3 ай бұрын
I need the matrix so I can download programming knowledge like this guy. He's so fast
@hidoryy3 ай бұрын
what are the benefits of asserting in runtime rather than in unit tests? actually never seen assertions being used outside of test scope
@Jamo0083 ай бұрын
The last screen Run fund, WithCancel is a noop cancel isn’t cancelling outer
@ja31ya3 ай бұрын
When your content is over 9000 but your volume is -9000
@simplyblunder3 ай бұрын
Loving seeing prime using GO!
@barry_wastaken3 ай бұрын
Wait untill he finds out about event driven architectures, he will have no hair left.
@metaltyphoon3 ай бұрын
Lol with those asserts and break the world all it takes is non ECC memory to fail in the right place and it all falls apart.
@ra-dro3 ай бұрын
Amazing video!
@pdougall13 ай бұрын
Such a great experience in having a horrible time... my whole existence
@pedrosilva14373 ай бұрын
Back in the early to mid 90s, ASSERTs in C/C++ were a very common thing. It seemed to go out of style... we may have been smarter back then. 😉
@AshesWake-sf7uw3 ай бұрын
Man i wasn't even born back then, unfair!
@masterflitzer3 ай бұрын
11:32 wait prime is not raw dogging git cli?
@ErazerPT3 ай бұрын
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...
@cennarr3 ай бұрын
How did The Primeagen make that ascii diagram? Any tool he uses for that? Because it seems like hell to draw all those borders and such by hand
@bautistarescala3 ай бұрын
May i know how you type those sequence diagrams easily? I assume it's some Vim macro but i don't use Vim so i don't know but i'd like to learn. Seems pretty useful.
@reybontje23753 ай бұрын
Fixed-length encoding for the length header. Gigachad. I don't know if it was a conscious choice, but using variable-length integers for the length header drastically increases the complexity of parsing the header in a safe/secure way that doesn't open you up to DoS attacks that come from carefully engineered messages.
@aredrih67233 ай бұрын
The assert around 7:14 checking that the packet length is greater than 0 is a DoS waiting to happen (a message with no body will crash the server). As for using variable length integers in headers, beside overflows in naive parsing, I fail to see the issue with them. I agree more considerations and processing are required to handle variable length fields and their flexibility is really too useful but IMHO the difference between fixed size and variable size isn't that large and you can reuse the code elsewhere. Unless you plan to decode raw messages by hand (in this case, a decoding util is pretty good), I fail to see the difference.
@AshesWake-sf7uw3 ай бұрын
@@aredrih6723 Can you pls explain how is that vulnerable to DoS?
@aredrih67233 ай бұрын
@@AshesWake-sf7uw an assert failing is a program crash. If Prime goes "tiger style" (my understanding is that he is a fan of the work on tiger beetle, so likely) and includes the assert in the production code, a packet received triggering the assert will bring down the app. DoS is denial of service. Crashing an app counts as a denial of service. An "exploit" would be waiting for the server to start, open a TCP connection, send a packet with an empty body, and the assert would kill the server. It's a 10 seconds fix so not a big issue but still classify as DoS.
@moaxcp3 ай бұрын
Why don't you set up the version and encoding when the connection starts rather than in each message sent?
@lovesowing3 ай бұрын
when did prime switch to jetbrains mono? I thought he didn't care about fonts. next thing we know he'll be configuring hyprland
@gamemusicmeltingpot21923 ай бұрын
I worked on a game that had this type of special protocol
@niklaswojtkowiak33 ай бұрын
Was this supposed to be on the Vimagen?
@MrAbrazildo3 ай бұрын
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.
@ricky26293 ай бұрын
Am i missin something or wouldn't that assert for lenght of the message crash the server on any malformed request?
@kimberlycelaya18953 ай бұрын
Welcome💙 🔥🔥🔥
@TheDoppelganger293 ай бұрын
Just where do you find time after work??
@johnyewtube22863 ай бұрын
He no longer works at Netflix, he is full time e celeb.
@portal-jx5pu3 ай бұрын
Nice protocol
@jop06933 ай бұрын
Anyone knows how he did the markdown graphics?
@digiryde3 ай бұрын
As to creating your own packet structure.... Do you have to have succeeded for it to count?
@onegraham3 ай бұрын
Why do you need so many bits for version?
@kengreeff3 ай бұрын
It definitely is an idea 😅
@dennisloska3 ай бұрын
What's the fonts/plugin name which Prime is using here? The != and
@remains22463 ай бұрын
they are ligatures
@TheHeavenlyDemonSupreme3 ай бұрын
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.
@dennisloska3 ай бұрын
@@remains2246 I learned somethong new today, thanks man!
@dennisloska3 ай бұрын
@@TheHeavenlyDemonSupreme Thanks!
@bytebytecode3 ай бұрын
I didn't understand anything, but it was fun watching 😅
@hydrobolix33653 ай бұрын
🤘
@AndreanFranc3 ай бұрын
I think little-endian makes more sense (even though it's not the network byte order), just because most of the architectures are little-endian now anyway. Better pay a penalty for conversion only on the outlier architectures (big-endian, if they even exist as your clients), than pay for it everywhere in a wasteful manner.
@georgehelyar3 ай бұрын
I've done version, flags, opcode, data, where data might be length prefixed but it depends on the opcode whether it's variable length. Big endian is not really needed at the application level, you can just specify the endianness in the protocol. Protobuf pretty much means that you don't need to write your own protocol any more though, as it already does variable length numbers efficiently, backwards compatibility etc. You can save a few bytes here or there with a custom protocol but it's usually not worth it. Also multipart is surprisingly good if you want to do human readable, but most of the time you don't want to do human readable.
@HypeLevels3 ай бұрын
ligmuh (I am scared let's watch this 😂)
@ոakedsquirtle3 ай бұрын
okay but what is a framer
@Noober6663 ай бұрын
I already knew how to do this, just wasn’t gonna tell u 😏
@luizalbertolausdarosa68193 ай бұрын
Now do it with UDP, please!
@justanothercomment4163 ай бұрын
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.
@memory_leaps3 ай бұрын
how did u made the ascii tables
@ItzD3fW1sH3 ай бұрын
Plenty of online generators for it
@codingwithifeanyi53793 ай бұрын
it this go?
@bertram-raven3 ай бұрын
Naive in so many ways from the start. Does it get better? Where is the error correction? Where is the message resync?
@JohnLovell-FTW3 ай бұрын
You didn't use Mermaid in your Markdown? Shame! :)
@ashleigh.3 ай бұрын
Please, if you're going to do this, use QUIC
@Cdaprod3 ай бұрын
All the time.
@aajas3 ай бұрын
6c is lowercase, the thumbnail has uppercase L
@ThePrimeTimeagen3 ай бұрын
such facts, well observed
@milseq3 ай бұрын
Go is so damn beautiful I really need to learn it and find a project to use it on
@asmod4n3 ай бұрын
you can send empty packets for keep alive :)
@greyshopleskin23153 ай бұрын
The kernel should automatically send keep alive packets (assuming the socket type is tcp)
@asmod4n3 ай бұрын
Realtime communication protocols aren't tcp. I also believe you can restrict usage of tcp keep alive for apps on some operating systems.
@canofpulp3 ай бұрын
Microsoft recall is enabled by default in the latest Windows update!!!!!!!!! update 24H2
@Mraeth8n3 ай бұрын
why did you choose 8 bits for the version? Wouldn't like maybe even 4 be sufficient?
@chinoto13 ай бұрын
If you're careful, but if you run fast and break things constantly... Maybe he should have gone bigger 🤣
@Mraeth8n3 ай бұрын
@@chinoto1 haha 🤣
@NostraDavid23 ай бұрын
What? You've got a nice encoding-decoding setup going and you're NOT PBTing that shit? HAWK TUA ON THAT CODE! Slapping some Property-Based Testing on code that bijective code is the best you can do here!
@mitaskeledzija62693 ай бұрын
Kinda fun, is just coping because I don't have a job.. 🤣 commit to open source create a game create protocol bla bla.. still no job fuck this market
@iCrea7ive3 ай бұрын
Put down the crack pipe
@Haise-san3 ай бұрын
Is that csharp ?
@jonathan-._.-3 ай бұрын
tldr: always add version byte... (tes rest can be ignored 😌)
@thip17543 ай бұрын
Ligma
@blackCladLad3 ай бұрын
What’s Ligma
@Skaffa3 ай бұрын
ligma balls
@blackCladLad3 ай бұрын
no ty
@healord513 ай бұрын
this is not funny, I almost died of ligma a couple years ago
@midicine21143 ай бұрын
There's no money in creating a protocol for funsies therefore none of the new devs are going to do it.