Peer to peer benefits from not needing any server upkeep, which also means you can play the game online far into the future. Only issues are connection and security.
Yup, I went for p2p for a start and if there are too much problems (the hosts quits too much or w/e) I'll use a dedicated server, but implemented like it's already a dedicated server in case I have to migrate
@@captainnoyaux I think the word or definition p2p is used wrong here. If you mean a player can start a server in the and and clients connect to it (and cannot host in that time).. this is client server model. This is not p2p. And still if host leaves its a problem. Some network systems offers solution for this. But I like to offer both option. Like Source games. They have the option to use dedicated server or just quick start a server from the main menu. Nice to make quick session with a friend if it is small fun game ( for instance garrysmod ).
I think if the player becomes a server, but it does not change the gameplay for him, then its still p2p. I never heard about game with p2p where each player sends data to each other player.
I was just this week starting to learn about this and wanting to have online for my turn based games.. yiu couldn't have chosen a better topicman, great thanks!
Would love to see a breakdown of CCU calculations and how to go about cost calculations, maybe use a common platform such as Photon as an example? Outside of the scope of coding but it seems to be a factor that scares many developers.
For games where there is no competitive aspect and when there are mostly just 2 players in a session, P2P seems like a nice and simpler solution for sure. Epic and Steam offer those relay services for a p2p like network structure too, so you don't have to worry about connecting the peers on your own (which can be be a real hassle, can expose insecurities when peers setup to support directly connecting to others and a lot of times, you end up needing a separate server to relay packages between the peers or to connect them together either way).
I would like to add that maintenance is the biggest cost of dedicated servers, since hosting is not prohibitively expensive anymore. Most indie games can get away with lowest tier hosting.
Best way imo is a public server as a p2p client session broker. If it's competitive or hacking becomes a problem, train LLMs to analyze matches and memory states to look for anomalies, use UBA to auto flag suspicious users, efficiently collect telemetry on first launch for more reliable banning purposes (cpu/disk/mobo serial, public IP, MAC Address, etc.), and also anti-cheat post-gameplay telemetry to feed the LLM, with ML jobs to account for intentional disconnects vs latency But most ideally, we need decentralized P2P gaming. The gaming community in general is large enough at this point that to avoid putting server costs on small teams/devs, everyone can just spin up (i.e.) a Raspberry Pi node and share the burden. Decentralized, open source governance, anti-cheat rules, scalable, etc.
Imo community self moderation is my favorite option and usually very effective. Using a votekick and rejoin timeout or an automated block option to prevent being matched with the same player again by removing them from the match pool for players from the previous game theyd been ejected from This is my very unprofessional opinion, please tell me where im going wrong or if this is much harder than server client moderation
Yo I got a question, I'm making a multiplayer game that runs even if only one player is connected like minecraft world, but i want the host to move between the players depends on who connected first. Is that possible?
I'm curious of any security risks to the players peer-to-peer networking can open up and how to prevent them. I can't think of any, but the thought of someone directly connecting to another computer does make me wonder if there are any concerns I should prepare for.
And folks, when he says getting p2p clients to agree on stuff is possible but it’s complicated. He means graduate level distributed systems level difficult, it’s the same fundamental problem cryptocurrency networks are trying to solve.
Typically, but with some special considerations. There are some good common solutions for fighting game networking, lots of good gdc talks on it too. Local mp is definitely the best though for it. Apparently parsec is pretty popular for fighting games too (not netcode but a great free tool)
I dont like dedicated servers only. I think peer to peer is best for quickplay with the ability for players to create and host their own servers and those servers being listed in a server browser in-game. I think this would be the best process for bringing a battlefield type of game to the linux and foss crowd. Foss crowd doesnt really like dedicated servers and i dont have the cash or infrastructure to have dedicated servers for more than 10-20 people. I think having a votekick option and giving server owners the ability to permanently ban players is the best way to combat cheaters, abk cant even make an effective anticheat so theres no way i can make one, best to keep that tool in the hands of the players
I might be missing something. but unity's own peer to peer system unity relay, is not free. I haven't looked into the pricing too deeply and done any calculations. But it seems you still have upkeep costs even with peer to peer. Or again, am i missing something?
What about room based multiplayer games like LOL or Valorant? Most of services like Photon you have to create P2P connection for create room and let one of player rule it. So how we can connect that rooms with dedicated server for prevent cheating?
He sadly was not explaining p2p correctly. P2P actually means everybody is host and client at same time. Photon is not like that. You still connect to server and you receive the information from the server not from players directly. Photon has authority system and the server is just a cloud server. This means actually Photon is like AWS (amazon hosting service). But the main difference is you cannot do something on the serverside. Because of this some people try to use the masterclient ( the one who created the room ) to validate things.. but yea masterclient could cheat. I had to once write for customer custom authority system.. it was pain. While games like Lol, Dota are 100% cloud dedicated server but these games are using Matchmaking System. So they know what server are free which one they can use. Its really easy to write your own if you understand how this works. Start with basic and simplied version just to learn it. 1. Write a simple server in unity using mirror, netcode what ever. You don't even need to join. Everytime a server starts let it write(or update) to a "json" file just in any folder you want. Write into the file the player number and the ip + port. 2. Run 2 server with different port. 3. Write now the client part. Just a button "Auto join" and the logic to receive the json file and read the information. Now you already have information about 2 server. Now you can create your own logic.. do you want prio empty server or join a server with players? Of course with players hehe. Connect to the ip you received from json. 4. Voila, you are done and you wrote your first own (even if it is just json file) Matchmaking server. You even can use this information to make a server list. Don't use json for real games. Just for learning.
@@MaZyYTube I don't think JSON is inherently bad, right? Here's my idea to implement your idea. Utilize something like Firebase's Firestore (NoSQL JSON Database) or Supabase (PostgreSQL Relational Database) which has a table for currently active lobbies which is updated and queried as people "Host Game" and create lobbies. Querying that database even in SQL can be serialized into a simple Object for easy data access. If using Firestore, it's literally just a JSON file that's returned which you can iterate through like you stated.
Peer to peer benefits from not needing any server upkeep, which also means you can play the game online far into the future. Only issues are connection and security.
Yup, I went for p2p for a start and if there are too much problems (the hosts quits too much or w/e) I'll use a dedicated server, but implemented like it's already a dedicated server in case I have to migrate
@@captainnoyaux I think the word or definition p2p is used wrong here. If you mean a player can start a server in the and and clients connect to it (and cannot host in that time).. this is client server model. This is not p2p. And still if host leaves its a problem. Some network systems offers solution for this.
But I like to offer both option. Like Source games. They have the option to use dedicated server or just quick start a server from the main menu. Nice to make quick session with a friend if it is small fun game ( for instance garrysmod ).
@@MaZyYTubeyup it's unity's definition of P2P
If your game is competitive based, meaning you need tight control over the server to prevent cheaters and exploits, then a dedicated server is a must
I think if the player becomes a server, but it does not change the gameplay for him, then its still p2p.
I never heard about game with p2p where each player sends data to each other player.
I was just this week starting to learn about this and wanting to have online for my turn based games.. yiu couldn't have chosen a better topicman, great thanks!
Would love to see a breakdown of CCU calculations and how to go about cost calculations, maybe use a common platform such as Photon as an example? Outside of the scope of coding but it seems to be a factor that scares many developers.
Love the hoodie infront of the tropical background!
For games where there is no competitive aspect and when there are mostly just 2 players in a session, P2P seems like a nice and simpler solution for sure.
Epic and Steam offer those relay services for a p2p like network structure too, so you don't have to worry about connecting the peers on your own (which can be be a real hassle, can expose insecurities when peers setup to support directly connecting to others and a lot of times, you end up needing a separate server to relay packages between the peers or to connect them together either way).
I would like to add that maintenance is the biggest cost of dedicated servers, since hosting is not prohibitively expensive anymore. Most indie games can get away with lowest tier hosting.
You also should factor in that simply debugging peer to peer can be much harder so finding and fixing P2P issues can take much more time.
Best way imo is a public server as a p2p client session broker.
If it's competitive or hacking becomes a problem, train LLMs to analyze matches and memory states to look for anomalies, use UBA to auto flag suspicious users, efficiently collect telemetry on first launch for more reliable banning purposes (cpu/disk/mobo serial, public IP, MAC Address, etc.), and also anti-cheat post-gameplay telemetry to feed the LLM, with ML jobs to account for intentional disconnects vs latency
But most ideally, we need decentralized P2P gaming. The gaming community in general is large enough at this point that to avoid putting server costs on small teams/devs, everyone can just spin up (i.e.) a Raspberry Pi node and share the burden. Decentralized, open source governance, anti-cheat rules, scalable, etc.
I would say: "It depends on the game".
Imo community self moderation is my favorite option and usually very effective. Using a votekick and rejoin timeout or an automated block option to prevent being matched with the same player again by removing them from the match pool for players from the previous game theyd been ejected from
This is my very unprofessional opinion, please tell me where im going wrong or if this is much harder than server client moderation
Yo I got a question, I'm making a multiplayer game that runs even if only one player is connected like minecraft world, but i want the host to move between the players depends on who connected first. Is that possible?
I'm curious of any security risks to the players peer-to-peer networking can open up and how to prevent them. I can't think of any, but the thought of someone directly connecting to another computer does make me wonder if there are any concerns I should prepare for.
Of course there are, ddos is one. Probably non existant except if your game is a HIT
I’m trying to decide between relay and dedicated servers for my vr social streaming app and need help deciding. Any suggestions?
And folks, when he says getting p2p clients to agree on stuff is possible but it’s complicated. He means graduate level distributed systems level difficult, it’s the same fundamental problem cryptocurrency networks are trying to solve.
Some games it's a bit easier, but I think it's mostly 1v1 games that I can think of at least
@@Unity3dCollege yep. Turn based can also make it a lot easier because the delay is inconsequential.
So a “versus fighting” game will always be run on p2p architecture, is that right?
Typically, but with some special considerations. There are some good common solutions for fighting game networking, lots of good gdc talks on it too. Local mp is definitely the best though for it. Apparently parsec is pretty popular for fighting games too (not netcode but a great free tool)
any reccomendations for adding peer to peer into my games? like where i should look
I dont like dedicated servers only. I think peer to peer is best for quickplay with the ability for players to create and host their own servers and those servers being listed in a server browser in-game. I think this would be the best process for bringing a battlefield type of game to the linux and foss crowd. Foss crowd doesnt really like dedicated servers and i dont have the cash or infrastructure to have dedicated servers for more than 10-20 people. I think having a votekick option and giving server owners the ability to permanently ban players is the best way to combat cheaters, abk cant even make an effective anticheat so theres no way i can make one, best to keep that tool in the hands of the players
I might be missing something. but unity's own peer to peer system unity relay, is not free. I haven't looked into the pricing too deeply and done any calculations. But it seems you still have upkeep costs even with peer to peer. Or again, am i missing something?
Relay costs are a lot cheaper. Last I checked, steam also offered it for free for games hosted on there.
@@Unity3dCollege Oh yeah! I forgot steam offered this as well.
What about room based multiplayer games like LOL or Valorant? Most of services like Photon you have to create P2P connection for create room and let one of player rule it. So how we can connect that rooms with dedicated server for prevent cheating?
He sadly was not explaining p2p correctly. P2P actually means everybody is host and client at same time. Photon is not like that. You still connect to server and you receive the information from the server not from players directly.
Photon has authority system and the server is just a cloud server. This means actually Photon is like AWS (amazon hosting service). But the main difference is you cannot do something on the serverside. Because of this some people try to use the masterclient ( the one who created the room ) to validate things.. but yea masterclient could cheat. I had to once write for customer custom authority system.. it was pain.
While games like Lol, Dota are 100% cloud dedicated server but these games are using Matchmaking System. So they know what server are free which one they can use.
Its really easy to write your own if you understand how this works. Start with basic and simplied version just to learn it.
1. Write a simple server in unity using mirror, netcode what ever. You don't even need to join. Everytime a server starts let it write(or update) to a "json" file just in any folder you want. Write into the file the player number and the ip + port.
2. Run 2 server with different port.
3. Write now the client part. Just a button "Auto join" and the logic to receive the json file and read the information. Now you already have information about 2 server. Now you can create your own logic.. do you want prio empty server or join a server with players? Of course with players hehe. Connect to the ip you received from json.
4. Voila, you are done and you wrote your first own (even if it is just json file) Matchmaking server.
You even can use this information to make a server list.
Don't use json for real games. Just for learning.
Thanks for your detailed reply. Very helpful @@MaZyYTube
@@MaZyYTube I don't think JSON is inherently bad, right? Here's my idea to implement your idea. Utilize something like Firebase's Firestore (NoSQL JSON Database) or Supabase (PostgreSQL Relational Database) which has a table for currently active lobbies which is updated and queried as people "Host Game" and create lobbies. Querying that database even in SQL can be serialized into a simple Object for easy data access. If using Firestore, it's literally just a JSON file that's returned which you can iterate through like you stated.
yeeeee