I'm surprised you advise against using peer-to-peer given that it seems like a great choice for indie developers creating co-op games. No need to have any sort of server costs, no need to worry about cheating (not a competitive game), and you can use Steam's API for hosting lobbies, creating a signalling server, match-making, etc. Also, the code ends up being all client-side. Would you argue that even for a co-op game, indie developers should still go the client-server route with one of the players hosting the server themselves as they play (rather than hosting or renting a dedicated server)? IMO, peer-to-peer still has it's place and seems like it would be the more sensible choice for indies making non-competitive games.
This is completely accurate for those pure P2P game styles! I think I mentioned very quickly that there is still a use case for it, but I’m glad you commented! Thank you!
Client authoritative, implied by peer-to-peer, works fine for smaller player groups where people know each other. Introduce a public server where other players are likely strangers and cheating becomes a problem.
This was a really nice primer, thanks a lot! Is there any chance you could go over how some netcode options work (delay based, rollback), and how we'd implement them if possible?
Just a heads up, the MultiplayerSynchronizer DOES NOT handle interpolation and client prediction. A lot pf tutorials for this node show it being used for player movement but it is NOT designed for this use case and while it looks like it works running locally due to virtually no latency, it will NOT work when the internet is in between the server and client
Yea I haven't found anything that says Godot provides interpolation out of the box with their synchronizer. If this was in reference to something I said, I may have been referring to Unity which does provide some default interpolation. I have ran this from a cloud service before and haven't noticed any lag issues, but that doesn't mean it won't need some interpolation to smooth things out once the game grows. I'll be sure to spend some time looking into this. If we are not to use the synchronizer for player movements which feature or implementation strategy should we be using? Thanks!
@@BatteryAcidDev i suggest looking into gabriel gambetta’s fantastic blog posts on the concepts of server reconciliation, entity interpolation, and client-side prediction. I’ve chatted with the lead network dev for godot about adding some hooks into MultiplayerSynchronizer to be able to add this logic to it, but until then, you’ll need to implement it yourself using rpcs and bespoke code.
@@-.-..._...-.-there are techniques for doing things smoothly like client-side prediction, entity interpolation, and server reconciliation. These are usually implemented on a per-game basis because they depend a lot on the individual game’s movement code, and how it can be optimized. Gabriel Gambetta has an excellent series of blog posts on the topic if you’re interested
Client-Server will not fully prevent cheating, it still takes a lot of resources. Hosting servers takes a lot of resources as well. In my (admittedly limited) experience, if you have a small team, competitive multiplayer isn't possible, especially if its your first time with multiplayer period.
Right, nothing will fully prevent cheating, it's about mitigation - what practices you can implement to reduce it or at least curtail it. I think resources really depends on the type of game. FPS, yea it's likely to be much more expensive than a card game. I would say if it's your first time making a FPS multiplayer game, it would definitely be challenging, maybe start with something easier and work your way towards that.
I’m doing a micro service architecture for my godot game with an express typescript server for authentication service and websocket connection for lobby service. I’m still not totally sure how it’s going to go but so far I have implemented my own custom gameroom lobby creation. I’ll lyk how it goes and maybe I’ll make a tutorial on it!
Quick question. So for a solo developer working on a game like valhiem, enshrouded, etc. Would it be ok to develop the game as Peer to peer where players create servers with 10 player slots and host, while others connect. Then later down the line change the networking solution to dedicated servers? Or would I have to go in and change every single multiplayer related line of code at that point?
You can create it p2p to start, where one person is the host, and then later switch to a typical remote-server setup. You won't have to rewrite your network logic. You'll likely have to refactor your matchmaking, as it's no longer though someone's IP, but hosted somewhere. You can even create a flag that toggles between server and host mode. Most of my demo code has this built into it, if you want to check.
When you say headless, you mean dedicated server builds? because I think it supports the major platforms... I've built them for linux and mac, but haven't tried windows, but it looks like the option is there? Maybe you could clarify this for me, thanks!
I just checked the docs again, and it looks like with godot 4, you indeed can export for headless server builds on any platform. I stand corrected. Sorry!
Not at all! Thanks for bringing it up! You never know, plus with different versions of docs along with releases, it's good to have clarification! Thanks for following up!
I want to make a party game. In involves sharing files between players(mp3, mp4, wav, tscn, webm, etc) and I want to add mobile support too. One of the client will be the host whom will store all of the files, distribute it, and control the flow of the game using RPCs. How do I make this work without paying a single cent? Can the AWS serverless multi-region websocket API be of benefit to me?
Hrm, that’s a tall order for a RUclips comment, and I think you just joined my discord, so let’s continue the convo there! I’m sure we can get you pointed in the right direction!
Sorry can someone explain the difference between a dedicated server and websockets? The video was talking about dedicated servers but suddenly advised against them in favor of serverless lambdas (I guess only for slow-paced games?)
Apologies for the lack of clarity there. Dedicated server builds are builds of your Godot (or Unity) project for deploying or using as a server, for your backend. You can use the high level built-in networking technologies like RPCs, SyncVars, NetworkTransforms, etc. If you want your players to have low downtime, you'll always have to have at least one instance of this server build running for them to connect to. This can be hosted anywhere that supports server builds. Because this can add up in costs, if your game doesn't need a full server build of your game, because it's slower paced, or doesn't need to simulate anything, or maybe you just want to add chat, lobby, or you just want to sync data, you can instead use a 'serverless' Lambda function with a WebSocket (or HTTP if that's all you require) and it only charges you for the time that it is active for that session. Once the game is over, it can shutdown and you're not going to be charged for those times while there's no game play happening. Serverless is generally cheaper and can handle ancillary functionalities, (as well as slower paced game play), that most games have. If you require game play simulation or environment collision detection, etc, you will not be using the serverless route, as it won't be a server build of your game, and you can't take advance of the server authority. Hope this helps, let me know if you have any more questions, plus you can always drop by the Discord!
@@BatteryAcidDev Thanks for the clarification, that makes a lot of sense! Yeah I guess if you only need a leaderboard or a bulletin board of some sorts it'll be a waste to host a dedicated server. Thanks for the valuable information.
WebRTC is useful if your game runs in the browser (HTML5 or javascript) and you want a low latency connection between peers. Game network traffic has similar requirements to voice or video chat :) (i.e. low latency, little bit of unreliability is acceptable, many small packets, etc)
Sad there isn't a peer to peer that does what it sounds like. A host can be a server and a client at the same time. So if a server is a class. Then make everyone a partial class to the whole class. Make everyone handle one part to distribute the workload.
@@GoblinArmyInYourWalls Is it a small game? Because he said "don't do it for big games", he didn't say "don't do it for 128 player match games or for mmorpgs" because I would have agreed with that.
Yet this is a video for beginners to understand game dev, most people will get the wrong idea when he says big, without any of those qualifiers you are imagining.
A Couple of things. First Photon is the Largest Multiplayer Game Service in the world. So I find it Strange you acted like you barley heard of it. Second Just make a Steam Listen Server game and then you don't need to pay for any servers.
Steam listen server is for when you're using Steam and want to host a game on your local machine, which could work for P2P applications. Photon is a powerhouse for multiplayer Unity applications but my experience is limited with them. Thanks for the feedback!
I'm surprised you advise against using peer-to-peer given that it seems like a great choice for indie developers creating co-op games. No need to have any sort of server costs, no need to worry about cheating (not a competitive game), and you can use Steam's API for hosting lobbies, creating a signalling server, match-making, etc. Also, the code ends up being all client-side.
Would you argue that even for a co-op game, indie developers should still go the client-server route with one of the players hosting the server themselves as they play (rather than hosting or renting a dedicated server)?
IMO, peer-to-peer still has it's place and seems like it would be the more sensible choice for indies making non-competitive games.
This is completely accurate for those pure P2P game styles! I think I mentioned very quickly that there is still a use case for it, but I’m glad you commented! Thank you!
Client authoritative, implied by peer-to-peer, works fine for smaller player groups where people know each other. Introduce a public server where other players are likely strangers and cheating becomes a problem.
Yeah, but what if I can't use steam networking, since I won't be releasing there?
You can use the lobby matchmaking system I’m detailing in my latest video
Doesn't Warframe use P2P for game lobbies?
Thank you for these multi-player series, Sensei.
Look forward to seeing more ❤
Thanks! Got a lot more on the way!
This was a really nice primer, thanks a lot! Is there any chance you could go over how some netcode options work (delay based, rollback), and how we'd implement them if possible?
I'm probably not going to doing any videos on Unity for the foreseeable future, I just don't have the bandwidth.
These videos are great. I would love to see chapters some day. Makes it easier to come back later and find what I need.
Chapters added! Thanks for giving me the nudge!
Just a heads up, the MultiplayerSynchronizer DOES NOT handle interpolation and client prediction. A lot pf tutorials for this node show it being used for player movement but it is NOT designed for this use case and while it looks like it works running locally due to virtually no latency, it will NOT work when the internet is in between the server and client
Yea I haven't found anything that says Godot provides interpolation out of the box with their synchronizer. If this was in reference to something I said, I may have been referring to Unity which does provide some default interpolation. I have ran this from a cloud service before and haven't noticed any lag issues, but that doesn't mean it won't need some interpolation to smooth things out once the game grows. I'll be sure to spend some time looking into this. If we are not to use the synchronizer for player movements which feature or implementation strategy should we be using? Thanks!
@@BatteryAcidDev i suggest looking into gabriel gambetta’s fantastic blog posts on the concepts of server reconciliation, entity interpolation, and client-side prediction.
I’ve chatted with the lead network dev for godot about adding some hooks into MultiplayerSynchronizer to be able to add this logic to it, but until then, you’ll need to implement it yourself using rpcs and bespoke code.
Interesting, I'll definitely check it out, thanks! Here's the link: www.gabrielgambetta.com/client-server-game-architecture.html
So does that mean to use rpc() instead of the multiplayer synchronizer or some other way?
@@-.-..._...-.-there are techniques for doing things smoothly like client-side prediction, entity interpolation, and server reconciliation. These are usually implemented on a per-game basis because they depend a lot on the individual game’s movement code, and how it can be optimized. Gabriel Gambetta has an excellent series of blog posts on the topic if you’re interested
Client-Server will not fully prevent cheating, it still takes a lot of resources. Hosting servers takes a lot of resources as well.
In my (admittedly limited) experience, if you have a small team, competitive multiplayer isn't possible, especially if its your first time with multiplayer period.
Right, nothing will fully prevent cheating, it's about mitigation - what practices you can implement to reduce it or at least curtail it.
I think resources really depends on the type of game. FPS, yea it's likely to be much more expensive than a card game.
I would say if it's your first time making a FPS multiplayer game, it would definitely be challenging, maybe start with something easier and work your way towards that.
incredible video for a beginner like myself. thank you so much for the hard work.
Thank you!
I’m doing a micro service architecture for my godot game with an express typescript server for authentication service and websocket connection for lobby service. I’m still not totally sure how it’s going to go but so far I have implemented my own custom gameroom lobby creation. I’ll lyk how it goes and maybe I’ll make a tutorial on it!
Sounds about right! Where are you hosting the express backend?
Amazing video series! Thanks a lot!
Thank you!
You should go over WarFrame style P2P, using upnp, it's pretty OP.
For sure! I’m planning a deeper dive into P2P setups, so stay tuned!
Quick question. So for a solo developer working on a game like valhiem, enshrouded, etc. Would it be ok to develop the game as Peer to peer where players create servers with 10 player slots and host, while others connect. Then later down the line change the networking solution to dedicated servers? Or would I have to go in and change every single multiplayer related line of code at that point?
You can create it p2p to start, where one person is the host, and then later switch to a typical remote-server setup. You won't have to rewrite your network logic. You'll likely have to refactor your matchmaking, as it's no longer though someone's IP, but hosted somewhere. You can even create a flag that toggles between server and host mode. Most of my demo code has this built into it, if you want to check.
@@BatteryAcidDev thanks! I just found your channel and love the content so far
Awesome! Let me know if there's anything you'd like me to focus on!
I use MACOS dedicated Servers what about those ones?
Also in regards to server builds of godot, headless server exports can only be deployed for linux
When you say headless, you mean dedicated server builds? because I think it supports the major platforms... I've built them for linux and mac, but haven't tried windows, but it looks like the option is there? Maybe you could clarify this for me, thanks!
I just checked the docs again, and it looks like with godot 4, you indeed can export for headless server builds on any platform. I stand corrected. Sorry!
Not at all! Thanks for bringing it up! You never know, plus with different versions of docs along with releases, it's good to have clarification! Thanks for following up!
so useful thank you
You're welcome! 😁
I want to make a party game. In involves sharing files between players(mp3, mp4, wav, tscn, webm, etc) and I want to add mobile support too. One of the client will be the host whom will store all of the files, distribute it, and control the flow of the game using RPCs. How do I make this work without paying a single cent? Can the AWS serverless multi-region websocket API be of benefit to me?
What would be the best architecture format considering an MMORPG or an MMORPG Maker?
Hrm, that’s a tall order for a RUclips comment, and I think you just joined my discord, so let’s continue the convo there! I’m sure we can get you pointed in the right direction!
Sorry can someone explain the difference between a dedicated server and websockets? The video was talking about dedicated servers but suddenly advised against them in favor of serverless lambdas (I guess only for slow-paced games?)
Apologies for the lack of clarity there. Dedicated server builds are builds of your Godot (or Unity) project for deploying or using as a server, for your backend. You can use the high level built-in networking technologies like RPCs, SyncVars, NetworkTransforms, etc. If you want your players to have low downtime, you'll always have to have at least one instance of this server build running for them to connect to. This can be hosted anywhere that supports server builds. Because this can add up in costs, if your game doesn't need a full server build of your game, because it's slower paced, or doesn't need to simulate anything, or maybe you just want to add chat, lobby, or you just want to sync data, you can instead use a 'serverless' Lambda function with a WebSocket (or HTTP if that's all you require) and it only charges you for the time that it is active for that session. Once the game is over, it can shutdown and you're not going to be charged for those times while there's no game play happening. Serverless is generally cheaper and can handle ancillary functionalities, (as well as slower paced game play), that most games have. If you require game play simulation or environment collision detection, etc, you will not be using the serverless route, as it won't be a server build of your game, and you can't take advance of the server authority. Hope this helps, let me know if you have any more questions, plus you can always drop by the Discord!
@@BatteryAcidDev Thanks for the clarification, that makes a lot of sense! Yeah I guess if you only need a leaderboard or a bulletin board of some sorts it'll be a waste to host a dedicated server. Thanks for the valuable information.
Anytime! Glad it helped!
WebRTC is useful if your game runs in the browser (HTML5 or javascript) and you want a low latency connection between peers. Game network traffic has similar requirements to voice or video chat :) (i.e. low latency, little bit of unreliability is acceptable, many small packets, etc)
Excellent summary! Thank you 🙏
What about for UE5?
it's a game engine
Yea of course you can use UE5, I don't have much experience with it so I didn't cover it. But you can totally use that engine!!
Sad there isn't a peer to peer that does what it sounds like.
A host can be a server and a client at the same time. So if a server is a class. Then make everyone a partial class to the whole class.
Make everyone handle one part to distribute the workload.
if everything is broken
cheating wont be fun
"Peer to peer bad for big games", looks at Warframe and Deep Rock Galactic in confusion.
There’s definitely a place for it!
Deep Rock is 4 players, though
@@GoblinArmyInYourWalls Is it a small game? Because he said "don't do it for big games", he didn't say "don't do it for 128 player match games or for mmorpgs" because I would have agreed with that.
@@gothiccrusader2582 you're arguing semantics for absolutely no reason. It's 4 players, which is "small" by networking standards.
Yet this is a video for beginners to understand game dev, most people will get the wrong idea when he says big, without any of those qualifiers you are imagining.
Please get rid of the glare in your glasses. Thank you!
Noted
A Couple of things. First Photon is the Largest Multiplayer Game Service in the world. So I find it Strange you acted like you barley heard of it. Second Just make a Steam Listen Server game and then you don't need to pay for any servers.
Steam listen server is for when you're using Steam and want to host a game on your local machine, which could work for P2P applications. Photon is a powerhouse for multiplayer Unity applications but my experience is limited with them. Thanks for the feedback!
*Get in touch* 👇
-----------------------------------------------------------------------------------------------------
*Discord* discord.gg/SFFW32FUgm
*X (Twitter)* twitter.com/BatteryAcidDev
*Mastodon* mastodon.gamedev.place/@BatteryAcidDev
*Instagram* instagram.com/batteryaciddev
*Threads* www.threads.net/@batteryaciddev