Can players host a server individually on your game for free

Hi, I’m an armature at multiplayer concepts and coding, and I don’t quite understand multiplayer/online connectivity at all. I want to make my first online multiplayer game because I’ve been making a lot of single player games that just aren’t as fun, problem is, I have no money to pay for dedicated servers, my understanding is, is that paying for dedicated servers cost money for internet traffic, though could players use there computers as the server, and would it be free of charge for me and or the player, meaning players can host servers on my game and players can join the server, via a code or ipv4, or even a server list. So theoretically if i had say 100 people currently playing my game or even a 1000 if you will, they could all host a server and people could join, also is 20ccu 20 people max in a server hosted by someone or is it on the whole game, do i use this server method using photon or no, so many questions! Please awnser them.

That is indeed a lot of questions but let’s try out best:

Starting with the easiest: it is 20ccu so 20 concurrent users in your project. Meaning in total, over all open rooms. This leads to the more important part that you might have misunderstood: Judging from what you wrote i assume you are using Photons PUN. This is peer-to-peer. So there is no “hosting a server on your side” as the “server” as it is generally referred to is always on a clients PC. The only thing that Photon does is to host a central distribution station (the load balancer) that handles connecting, matchmaking and so on.

This - as you already noticed - will also cost you money. In general there is no way to create a multiplayer game without some running cost for some networking services if you want to get beyond the free few player tiers. (like 20 for PUN)

However this does not have to be expensive. You can rent basic VMs for ~5-10 bucks per month with unlimited network traffic (or at least by far more than you need to host a game)
Then you can host real server instances based on something like mirror or DarkRift2 (i can personally recommend the latter)

I guess this should be a base on which you can rethink your current approach. You should also consider that when building a multiplayer game you add a whole new level of complexity regarding programming and gamedesign which is a lot more difficult. You should also take into account what kind of game you want to make. peer-to-peer solutions like PUN are best for round-based games (CIV or XCOM for example) or for low player count action games (like any 4 player coop first person shooter for example). This is because PUN puts a hard limit on the amount of messages you can send in one room at 500 msg/second (which is a big issue once you want to go for more than 6 players with a position update every 10th of a second)
So please share what kind of game you want to create when you ask for advice on what kind of networking solution might be best for your case.

If you want to avoid all costs, there are game networking tools that are completely free to us, like Mirror or FishNetworking. Those tools are for games that don’t necessarily require a server, so you can build a peer-to-peer (P2P) game that way. What you’re talking about sounds more like a client-authoritative game, which is one of the implementations of P2P.

But like Captain_Pineapple was saying, if you want a server to control the player’s experience, you will have to spend some money on it. I would first have to ask you why you think it’d be necessary for your game. Client-authoritative networking should be fine in your case.

When you go above 20 players per match, it becomes almost impossible for P2P to work; there’d be too much stress on the network for a single home internet connection to handle. So, in that case, it’s imperative you have a server.