Tip: never use strings as keys in network messages, use constant numbers or enums, the equals or hashcode operation is much faster and it's a smaller packet to send, while still being readable in code
Great video! I have actually been developing my own multiplayer framework for a couple years now, except mine is for GameMaker and Node.js instead of Python and it uses classic messages and responses, but the shared objects approach sounds in fact very interesting! Thank you for your unique insight from a fellow multiplayer development enjoyer haha This sort of content is incredibly rare to come across on TH-cam
Very impressive and very informative. I am sure whenever you are ready to open source the code, the community will be there to assist with making it the best it can be. Plus it would be awesome to see what else can be done with your network framework. I work in python but have not done anything with sockets except for some book tutorials but you really do make python game design shine! Keep up the awesome work!
Now I'm not sure i understood correctly, but from what he explained, his net framework is not really that advanced and it uses a central server. Second thing from what he described he tried, csv-like-data or the json-data... it sounded like he just discovered the concept of IPC , in this case network IPC, maybe just my own interpretation of what he described he did. Anyway... as yourself said, good progress, nice looking game for 1 dev and made in python. it is pretty amazing.
Sorry , but i do not understand what you mean... by 5+ years ago, IPC as in network communication between 2 or more processes was invented in the 60's. Not 5 years ago. 2 processes communicating over the network is a form of IPC. At a high level like app layer you can create any "protocol" be it using existing http rules or your own csv or json or whatever else does not matter. Anyway, again does not really matter, even if it is clear to me you did not learn this in a structured way it is amazing that you did create all these games nonetheless which look very good. So, good job.
Honestly, this almost rivals MariokartDS even. The quality and camera control looks amazing. I can't wait to see when this releases. Thank you for the epic gamedev video!
I gotta say this game is really fun and the idea of making a networking engine in python sockets is just crazy I'm waiting for the next playtest and the game to be released, quick suggestion i like the trees in the field you should make palm trees too in the pirates docks map and the mushroom trees from drawn down abyss in the volcano map.
I always took multiplayer for granted simply because I learned game dev with Roblox Studio, but now I'm switching to Godot after 6 years and I plan to stay with Godot for at least 10 years since it's a direct upgrade from Roblox Studio and seems to pick up popularity for a reason. You are constantly inspiring me because I know how difficult it is to use code from scratch by making your own assets/libraries in order to abstract stuff. Every abstraction has to be well thought out or modified for every project.
Great video, and a cool game cooking up! Entirely unsolicited idea: Perhaps consider turning that "oil spill" power-up from a small puddle, into a line that your kart spills over the course of 1-2 seconds, that carries the kart's momentum. That'll require some driving skill from the player, but also be more rewarding to use if they choose to deploy the oil while drifting, to strategically cover more area behind them.
It is definitely easy to make multiplayer games if there are no high-level physics interactions and not a lot of units/npcs/projectiles and no fast-paced competitive games. Once you are making the next rocket league, valorant, or starcraft, you will be faced with a lot of pitfalls on current free technologies.
I have a solid carrer as a python data engineer, but every time I watch your videos I have the desire to retire and become a python / godot game developer XD. Keep going, your content is awesome.
Oh my... make a Lobby with all ppl riding the car just for the fun BUT all cars are ghosted so you can't bump into each other ... make a Lobby to have fun XD
I'm not sure I agree that 100 players per server is very scalable, but the game seems enjoyable. I'd consider possibly using native socket bindings or a library which does so. Even in python, however, 100 seems low. I suspect that attempting to generalize different patterns of sending and receiving has led to over-sending. It's either that or you could be over-sending a very frequent packet, possibly sending all players' positions to everyone every tick. If so, limiting what is sent to what can be seen by each player can help if the cost of that calculation is less than just iterating and sending to all players. A simple solution could be to subdivide the map and only send changes which occur in the regions surrounding the player. I'm also not sure that you fully explained the packet structure, but I noticed that you said updates are streamed as bytes, which is good to begin with. However, if the bottleneck is the server, and not via over-sending, then I would suggest stripping every packet to it's barest minimums and to try to be using the smallest data types for everything possible (e.g. sending floats over doubles, shorts or bytes over ints), however I'm not sure how possible that is in python. It's also worth noting that Python may be coaxing you into allocating much more than is necessary, as is the case with most languages, but it's probably possible to write it with less allocation without many sacrifices in code quality.
1. The servers are very cheap. Just a single core for processing. 2. Every player in a racing game lobby needs to know every other player's location for minimap updates, so 100 is a lot. It can be optimized, which is why I mentioned optimization. 3. As mentioned in the video, everything already is compressed down to the base datatypes since there's only a couple types of messages being sent. Overall, I'd say handling thousands of active players on less than $100/mo is pretty good. The same servers I'm using can't even run a Minecraft server with 2 people on it without the tickrate dropping. Keep in mind that renting even a low end VPS is quite expensive compared to running one yourself.
Wait why is TCP preferred? Doesn’t that incur a ton of bloated network handshaking? I would have expected UDP? But I’ve never built a networking framework.
As always, your projects are insane. I just wish I could get out of my coding burnout already. I guess I'll just have no choice but to try to force myself into working on my projects again, otherwise they'll never be finished. Although I'm kinda lost to be honest... I don't know if I want to make a game now, or if I want to do web development as my next project, or just some other thing like networking..... I'm not sure if you or anyone here can relate to that, but damm it sucks. I was so confident after finishing a computer science course, so happy, but now I can't bring myself to work on anything lol. But enough of my personal problems, this game looks so good. Will you ever make a video showcasing your networking stuff, or a basic tutorial on networking like you did with pygame + opengl?
Would you like to share some resources to learn these sort of networking optimizations, I am planing on building a game server with python but everyone keeps telling me its sloww.
It's mostly intuitive, I didn't use any resources for it. The main mistake people make is putting the netcode and the game code on the same thread, which is a hard bottleneck.
Neat! So clients actually push shared state updates in this system rather than having state changes being purely server-authoritative? (Presumably there's some kind of anti-cheat logic to prevent clients from pushing bogus updates?) Is server/client state desync ever a thing this system needs to deal with in that case, or does it just kinda trust TCP to do its thing correctly? (Or are all updates just purely idempotent in a manner such that that wouldn't actually matter in the long run?)
In optimal cases, the server is pretty much just forwarding the updates to clients authorized to see them. Anticheat would basically proofread the updates and block them if necessary. Clients work with whatever the latest data is. TCP should make it so updates aren't dropped (only sometimes delayed), but if it's really important, you can add in some extra steps to make 100% sure something was received.
@@DaFluffyPotato Cool stuff. I'm mostly curious because in my experience anti-cheat logic for dropping bogus packets that can contain arbitrary updates can sometimes get a little bit insane depending on the game lol. The engines I've been working with recently simplify that a little by only accepting forwarded I/O inputs from the client (rather than actual state updates), and having state updates only being computed on the server and pushed to the clients, but that kind of architecture leads to a whole bunch of other complications that you then need to design systems to compensate for... IMO having a shared state model is definitely the right move in any case!
Games that need a 100% server authoritative model base on IO are usually structured much differently overall, but yeah, the shared object abstraction could still be used for it.
@DaFluffyPotato I wanted to use my own computer as a host to play with my friend who lives in another neighborhood. I'm just afraid a hacker would be able to get access to my machine.
I believe I mentioned it in the video, but there's not much of an advantage. TCP mostly just causes slowdowns when packets are out of order or corrupted and need to be resent. If I want packets in order and guaranteed to be received, I'd just be writing that myself for UDP which would be more tedious and slower. If you watch the playtests, the networking performance is fine.
Tip: never use strings as keys in network messages, use constant numbers or enums, the equals or hashcode operation is much faster and it's a smaller packet to send, while still being readable in code
I did this at around 4:15.
It’s actually fun watching his amazing progression over the years! Good job man!
good to see you learning while also teaching us some useful stuff(I rarely see something this good about networking and games)
Great video! I have actually been developing my own multiplayer framework for a couple years now, except mine is for GameMaker and Node.js instead of Python and it uses classic messages and responses, but the shared objects approach sounds in fact very interesting!
Thank you for your unique insight from a fellow multiplayer development enjoyer haha
This sort of content is incredibly rare to come across on TH-cam
please create a full online game dev course
Very impressive and very informative. I am sure whenever you are ready to open source the code, the community will be there to assist with making it the best it can be. Plus it would be awesome to see what else can be done with your network framework.
I work in python but have not done anything with sockets except for some book tutorials but you really do make python game design shine! Keep up the awesome work!
Now I'm not sure i understood correctly, but from what he explained, his net framework is not really that advanced and it uses a central server.
Second thing from what he described he tried, csv-like-data or the json-data... it sounded like he just discovered the concept of IPC , in this case network IPC, maybe just my own interpretation of what he described he did.
Anyway... as yourself said, good progress, nice looking game for 1 dev and made in python. it is pretty amazing.
The earlier networking concepts were from 5+ years ago.
Sorry , but i do not understand what you mean... by 5+ years ago, IPC as in network communication between 2 or more processes was invented in the 60's. Not 5 years ago.
2 processes communicating over the network is a form of IPC.
At a high level like app layer you can create any "protocol" be it using existing http rules or your own csv or json or whatever else does not matter.
Anyway, again does not really matter, even if it is clear to me you did not learn this in a structured way it is amazing that you did create all these games nonetheless which look very good. So, good job.
I was saying that the stuff you were complaining about was what I was making 5 years ago. lol
I have a lot more experience now.
Honestly, this almost rivals MariokartDS even. The quality and camera control looks amazing. I can't wait to see when this releases. Thank you for the epic gamedev video!
As an aspiring game dev,you and others like you inspire me a lot
And I hope I get to the same skill level as you one day.
I gotta say this game is really fun and the idea of making a networking engine in python sockets is just crazy I'm waiting for the next playtest and the game to be released, quick suggestion i like the trees in the field you should make palm trees too in the pirates docks map and the mushroom trees from drawn down abyss in the volcano map.
I always took multiplayer for granted simply because I learned game dev with Roblox Studio, but now I'm switching to Godot after 6 years and I plan to stay with Godot for at least 10 years since it's a direct upgrade from Roblox Studio and seems to pick up popularity for a reason.
You are constantly inspiring me because I know how difficult it is to use code from scratch by making your own assets/libraries in order to abstract stuff. Every abstraction has to be well thought out or modified for every project.
I plan on making a web based game and I was curious about the particulars. This is great information. Thanks for sharing.
Great video, and a cool game cooking up!
Entirely unsolicited idea: Perhaps consider turning that "oil spill" power-up from a small puddle, into a line that your kart spills over the course of 1-2 seconds, that carries the kart's momentum. That'll require some driving skill from the player, but also be more rewarding to use if they choose to deploy the oil while drifting, to strategically cover more area behind them.
I'll be keeping oil spills the same, but that could be an idea for a different item.
@@DaFluffyPotato Sweet! Variety is spice of life, as they say :D
Love the explanatory art! Makes it easy to understand what you are talking about somehow while being funny xD
I just can't wait for your network framework
Say it with me guys: "Release, Release, Release, Release, Release"! Nice work, keep it coming!
this dude is a genuine genius man
It is definitely easy to make multiplayer games if there are no high-level physics interactions and not a lot of units/npcs/projectiles and no fast-paced competitive games. Once you are making the next rocket league, valorant, or starcraft, you will be faced with a lot of pitfalls on current free technologies.
I have a solid carrer as a python data engineer, but every time I watch your videos I have the desire to retire and become a python / godot game developer XD. Keep going, your content is awesome.
I would never had imagine that you had dabbled with HLA, thats awesome! Best gamedev content on youtube!
Very cool! I've never used Python for multiplayer games, although I'm currently working on a small MMO in Dart :)
Nice choice of ports!
A True Pioneer.
currently im not programing but since i started with python, watching this channel motivated me to make games and continue with python...
The game is so beautiful! Wow
Is Pixkartz inspired by Circuit Breakers for the PlayStation by any chance? Man, what a fun game that was.
Nope, just MKWii.
can you make a new pygame shader tutorial / update the existing one to be adapted for Macs? Great video!
i love you so much
Oh my... make a Lobby with all ppl riding the car just for the fun BUT all cars are ghosted so you can't bump into each other ... make a Lobby to have fun XD
I'm not sure I agree that 100 players per server is very scalable, but the game seems enjoyable. I'd consider possibly using native socket bindings or a library which does so. Even in python, however, 100 seems low. I suspect that attempting to generalize different patterns of sending and receiving has led to over-sending. It's either that or you could be over-sending a very frequent packet, possibly sending all players' positions to everyone every tick. If so, limiting what is sent to what can be seen by each player can help if the cost of that calculation is less than just iterating and sending to all players. A simple solution could be to subdivide the map and only send changes which occur in the regions surrounding the player. I'm also not sure that you fully explained the packet structure, but I noticed that you said updates are streamed as bytes, which is good to begin with. However, if the bottleneck is the server, and not via over-sending, then I would suggest stripping every packet to it's barest minimums and to try to be using the smallest data types for everything possible (e.g. sending floats over doubles, shorts or bytes over ints), however I'm not sure how possible that is in python. It's also worth noting that Python may be coaxing you into allocating much more than is necessary, as is the case with most languages, but it's probably possible to write it with less allocation without many sacrifices in code quality.
1. The servers are very cheap. Just a single core for processing. 2. Every player in a racing game lobby needs to know every other player's location for minimap updates, so 100 is a lot. It can be optimized, which is why I mentioned optimization. 3. As mentioned in the video, everything already is compressed down to the base datatypes since there's only a couple types of messages being sent. Overall, I'd say handling thousands of active players on less than $100/mo is pretty good. The same servers I'm using can't even run a Minecraft server with 2 people on it without the tickrate dropping. Keep in mind that renting even a low end VPS is quite expensive compared to running one yourself.
I had no idea you were in troy's videos lmaooo, GOAT
My friend and I were messing around with alts as Logan and Jake Paul and happened to end up in some of his games. lol
Dude great work
Wait why is TCP preferred? Doesn’t that incur a ton of bloated network handshaking? I would have expected UDP? But I’ve never built a networking framework.
TCP is fine in most cases. People overestimate the overhead.
@DaFluffyPotato is there any client side prediction and interpolation? Or all updates are just done by the server? Thanks!
There's interpolation, but no prediction. I prefer the simplicity of no prediction (it also looks cleaner).
@@DaFluffyPotato gotcha! Looks cleaner code wise, or racing wise?
This is very interesting! Looking forward to see how your game and framework take shape. Also, is that the GBA Bowser Castle map in your game 😳
maybe 😳
This is awesome and reminds me of Rock n' Roll Racing.
As always, your projects are insane.
I just wish I could get out of my coding burnout already. I guess I'll just have no choice but to try to force myself into working on my projects again, otherwise they'll never be finished.
Although I'm kinda lost to be honest... I don't know if I want to make a game now, or if I want to do web development as my next project, or just some other thing like networking..... I'm not sure if you or anyone here can relate to that, but damm it sucks. I was so confident after finishing a computer science course, so happy, but now I can't bring myself to work on anything lol.
But enough of my personal problems, this game looks so good. Will you ever make a video showcasing your networking stuff, or a basic tutorial on networking like you did with pygame + opengl?
I'll probably make a tutorial for my networking framework if/when I release it.
@@DaFluffyPotato Thanks.
@costelinha1867 are you Brazil costela? I passed through the same phrase as you, try to do something different like a sport, don't force it.
A new video🥹
Your networking solution sounds like you implemented your own rpc?
Can’t wait to see a release of this library :) oh and the game aldo
Have you considered using a free oracle server for it? I hear you can run a Minecraft modpack survival server on one
Would you like to share some resources to learn these sort of networking optimizations, I am planing on building a game server with python but everyone keeps telling me its sloww.
It's mostly intuitive, I didn't use any resources for it. The main mistake people make is putting the netcode and the game code on the same thread, which is a hard bottleneck.
@@DaFluffyPotato oh that's a nice advice, thanks
Neat! So clients actually push shared state updates in this system rather than having state changes being purely server-authoritative? (Presumably there's some kind of anti-cheat logic to prevent clients from pushing bogus updates?)
Is server/client state desync ever a thing this system needs to deal with in that case, or does it just kinda trust TCP to do its thing correctly? (Or are all updates just purely idempotent in a manner such that that wouldn't actually matter in the long run?)
In optimal cases, the server is pretty much just forwarding the updates to clients authorized to see them. Anticheat would basically proofread the updates and block them if necessary. Clients work with whatever the latest data is. TCP should make it so updates aren't dropped (only sometimes delayed), but if it's really important, you can add in some extra steps to make 100% sure something was received.
@@DaFluffyPotato Cool stuff. I'm mostly curious because in my experience anti-cheat logic for dropping bogus packets that can contain arbitrary updates can sometimes get a little bit insane depending on the game lol. The engines I've been working with recently simplify that a little by only accepting forwarded I/O inputs from the client (rather than actual state updates), and having state updates only being computed on the server and pushed to the clients, but that kind of architecture leads to a whole bunch of other complications that you then need to design systems to compensate for...
IMO having a shared state model is definitely the right move in any case!
Games that need a 100% server authoritative model base on IO are usually structured much differently overall, but yeah, the shared object abstraction could still be used for it.
What design patterns you use the most?
how do you deal with progamming burnout?
have my children
Please!
What if you run server in PyPy insteaf of Cpython? Wouldn't that significantly improve performance?
hello. how did u actually start game dev? did u do any cource or r u self taught
Why would you use TCP for a real-time game..
I didnt understand much... but it's been beautiful
Great video!
I've been wondering if you will do a tutorial series on Godot 4 game engine?
No because I don't have much experience with Godot at the moment.
Hi, did you rent a server, or did you use your own computer as the server?
Both work, but I rent
@DaFluffyPotato I wanted to use my own computer as a host to play with my friend who lives in another neighborhood. I'm just afraid a hacker would be able to get access to my machine.
Can u pls make a video on your planet shader
im not sure if th game is 2d or 3d
Do you host your own server or where is the server code running
I rent a VPS
Do you try to implement rollback netcode?
That would exist at a higher level than the framework.
Listen bro, You might change python multiplayer forever, as soon as you publish it pls drop some tutorials bro🙏
Sugoi
Gonk :D
Bonc a donc
if you can write in korean, please write korean subtitle.
But it isn't here, I will see your video because it is very useful for me
Did you not consider UDP even once?
I believe I mentioned it in the video, but there's not much of an advantage. TCP mostly just causes slowdowns when packets are out of order or corrupted and need to be resent. If I want packets in order and guaranteed to be received, I'd just be writing that myself for UDP which would be more tedious and slower.
If you watch the playtests, the networking performance is fine.
W rizz 🗿
:D
first
Second
5s ago lol
First comment
lol, python game dev
first