I’m talking about this project:
I learned from this tutorial and made my own multiplayer game. The problem is, we press Host button, it instantiates a server and a client. But the server must always be there and when I open the game I should connect to server not instantiate it. Am I wrong ?
If not, what should I do after that ? Buy a server ?
Just took a quick look, and not going to watch the whole tutorial series. Looks like the tutorial uses a simple TCP socket implementation where one player hosts the game and another player connects as a client. That works well for LAN games, and can work on the Internet if the host manually sets a port forwarding rule on their router so they can act as a server for this game.
That is generally not how modern games work though. Typically you’d have some dedicated server for matchmaking or as a public lobby which connects clients. Once connected you either use NAT hole punching or act as a relay for all the game’s network traffic. My understanding is that TCP hole punching is not that well supported by consumer routers as of a couple years ago, and I’d be surprised if that changed. Usually NAT hole punching for games is associated with UDP instead of TCP. For a game like checkers though, you’re probably fine bandwidth wise acting as a relay anyways as it is probably not a lot of data.
None of this appears covered by that tutorial series though, and will be a pretty big project on its own to design and implement for a networking code novice.
That’s what I wanted. Though I wasn’t expecting someone to do it.
I was searching for this answer for so long. Really thank you so much. Now I know that I must use something like Photon.
By the way, I searched for network solutions and saw DarkRift Networking 2 which offers unlimited users for free.
My game is something like this one: https://image.winudf.com/v2/image1/Y29tLmlkc3BlLnRhbmtzMl9zY3JlZW5fMF8xNTU0ODA3ODQ3XzA2MQ/screen-0.jpg?fakeurl=1&type=.jpg
Should I use DarkRift or Photon ?
DarkRift and Photon are fundamentally different. DarkRift is like an advanced version of what you are already using. It is a network library, and whatever servers you need for your game you will create yourself.
Photon is an all in one dedicated server solution in addition to their network library. Typically you’d use their cloud offerings so you don’t even need to rent a server to run a Photon server instance. With Photon though you’re paying to use the service, assuming you need more than the free tier at 20 concurrent users which is really just intended for while you are developing your game.
Switch to photon for a game like that. It’s easier than darkrift if you’re starting out with a networked game and has plenty of fast implemented features as far as connecting with a decent starting package of concurrent users.
And if you need a good starting point to learn it watch info gamers tutorials on YouTube.
Thanks for help. I will go on with Photon because this is my first multiplayer game
Can you create a multiplayer feature in the bob the robber game on hudgames? I really like this game