Home Game Development c# – Looking for tutorial for networking code (matchmaking server and client-to-client)

c# – Looking for tutorial for networking code (matchmaking server and client-to-client)

0
c# – Looking for tutorial for networking code (matchmaking server and client-to-client)

[ad_1]

About my sport:

It is written in C# MonoGame with DirectX targetting Windows desktop. This is a turn-based sport, max 16 gamers. Player 1 strikes a bit, then Player 2, and many others. Some gamers will be a pc, not human. Any given participant can finish in victory, defeat, or draw. There is a clock like in chess, so timing must be synced, and also you lose in the event you run out of time.

About my networking wants:

I desire a matchmaking server, however as soon as a sport begins, the shoppers themselves do all of the communication. This means I want networking code for client-to-client (CtC) in addition to client-to-server (CtS).

I do not need customers to register with a username/password and login. Anyone with the sport app can ping the server and get a listing of video games, or arrange their very own sport the place they’re the host, and let others be a part of.

I extremely doubt I’ll want a SQL database or SSL or internet certificates. I’m contemplating utilizing Node.JS or Go for the server. The shopper makes use of C# however I do not know whether or not to go together with SocketListener or TCPListener. I do not need UDP.

About my background:

Been programming for 20 years however virtually by no means any actual networking code. I do know primary JavaScript however virtually all the time used it as a purely client-side html file with embedded all the pieces, even base64-encoded sprites.

Now necessity has introduced me right here. I actually need to discover a tutorial for this form of factor, however have found that there are only a few server-coding tutorials. Almost all search outcomes are slowed down with “arrange your minecraft server” which isn’t a code tutorial. That’s an installer troubleshooter for a binary already coded by another person.

I’ve discovered some C# monogame tutorials demonstrating SocketListener and TCPListener however I am unable to get them to work proper, they all the time freeze this system apparently as a result of they’re on the principle thread? And these tutorials should not actually about networking structure and the best way to deal with speaking difficult issues.

Problems that must be addressed:

Can I select a single port for all the pieces? Can 16 shoppers and 1 server all use the identical port? (I’m getting conflicting information about ports, some say its purely 2-way communication, others say it may be used for multi-cast.)

What if a participant quits a sport in the midst of it. Does your complete sport throughout all different gamers additionally crash? How to keep away from that? And what if the host quits and its a centralized structure? How would you spawn off the sport to a brand new host?

How to deal with downloading of customized maps from the host shopper to different shoppers?

How to deal with timeouts for all kinds of requests, and a few primary DDoS safety?

How to verify each gamers’ clock keep in sync?



A guide advice can be tremendous. I actually need a tutorial to deal with these intermediate subjects, and never simply present the best way to setup a TcpListener and do a easy chat app.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here