How to create a simple game with two players, communicating via the Internet, without any custom code on any server?

How can I create a simple game with two players that communicates over the Internet?

I need to solve the problems:

  • search or rendezvous - two players want to find each other.

  • current communications. Any player can initiate an action requiring the delivery of information to the other side, in a reasonably fast timeframe (delay in the IM type, and not a delay in the type of email).

In this regard, I believe this is equivalent to a two-way chat, where people want to find each other, and then also, after spam, communicate with each other.

Additional requirements:

  • Suppose the endpoints are Windows OS, relatively recently.

  • Assume that no end machine is directly accessible from the Internet. Suppose these are client machines hidden behind firewalls that block incoming requests. Machines can perform outgoing requests. (say over HTTP, but TCP is fine too)

  • communication must be confidential. For simplicity, let me say that a common secret already exists, and endpoints are capable of performing AES. I assume that I mean that any intermediary should not decrypt message packets. Decryption will only happen at the end points.

  • all user code should only run on client computers.

  • Suppose my computer does not have a server on the Internet.

  • I am pleased to use third-party servers to facilitate interaction, for example, with an IM server or something else, as long as it is free, and I do not need to install custom code on it.


What APIs are available to facilitate this design?

Can I do this using the IM API? WCF? Are there WCF feeds for Windows Messenger?

What are the protocols? HTTP? I have it marked as "peer-to-peer", but I mean it in practice; There is no strict requirement for the formal p2p protocol.

What message formats would you use?


EDIT

To clarify server requirements, I want NO MY SERVER under MY CONTROL. AND NO MY INDIVIDUAL CODE FOR ANY SERVER. This is not the same as No Server.

Think of it this way: I can send an email via SMTP using a special code that I write on the send and receive side. My user code can connect through the broker of a free SMTP server. This does not require code installation on the SMTP server. This is what I want, but SMTP is not acceptable due to latency.

EDIT2
I also found this: an instant messaging library like libpurple, but written in C #


ANSWER

I can do what I want using the libraries for IM frameworks. One easy way to do this with Windows Live Messenger is to use the Activity Activity SDK . This proves the concept, but is not really a general solution. But similar things can be done with IM libraries for various messaging systems like libpurple or using libs for IRC channels. In all of these cases, the instant messaging servers act as the communications infrastructure that penetrates the firewall.

+4
source share
7 answers

libpurple together with otr can provide you privacy for IM, such an application is required.

+1
source

Each two-player game must have some type of server environment, since the basic need is to communicate between two clients / players, at least. Keep in mind that each client / player can also act as its own server to communicate with other related clients. But the need to monitor all clients / players at any given time and the need to facilitate the search for other clients / players inherently requires the use of some kind of server environment.

+3
source

IM is the wrong tool. Use the IRC chat room instead.

Using IRC chat, your customers will “enter” the chat room and will be used for your “presence”. Anyone in the chat is “available” to play the game.

Once this is done, the game instance interacts with each other via chat. They can use the global channel or simply private IRC channels for game traffic.

Questions to be addressed:

  • First, all game states are shared on clients. Many games have done this (RTS, for example Age of Empires, RPG like Diablo). But client states are prone to hacking and tricking. This is just the simple truth. If the game is popular, it will be hacked.

  • Ping traffic. Basically, the stream you enter the room, your client is in the "available for playback" mode. He then pings EVERYONE ELSE to see if THEY is available for the game. This will happen when each client "enters" the chat room. Then you can use the public room for the broadcasts "Frank is ready for a new game," "Frank started the game with Joe," etc. This can help keep the games in sync and not chat, but when the client connects to the chat room, it’s going to go "Hi everyone, this is Bob, what are you all doing." So you need to do this.

  • The amount of traffic. IRC numbers can handle a lot of traffic, but not a lot of traffic. Most of them are designed to prevent "spam", "flood", etc. Thus, you can be limited in game speed. Not a problem for "Checkers", especially for "World of Warcraft" during a raid of 40 people. This is a game design issue.

  • Terms of Service. An IRC provider may well say, "No, you cannot do this with our service." I did not look at him, so I do not know, but it can be a problem.

Other than that, IRC is pretty good. A lot of IRC code of bots floating on the network, I never used it.

+2
source

You have many conflicting requirements. Both clients behind the firewall blocking incoming requests, to a large extent, mean that they cannot do peer-2-peer, since neither of them can act as a server, and you will need to have a transport server in the middle where the routing is messages to each client. What you are asking right now is pretty much impossible without a server requirement.

0
source

You can customize the message bar on one of the free bulletin board servers so that players can find each other. You will probably want to encourage them to use private messages to exchange IP addresses. Then use a protocol that connects using IP addresses. Good luck with that. Firewalls make it a pain.

Then, of course, one machine of the pair will need to act as a server, and the other as a client. Your software should contain both sets of code. I wrote such a game and I can say that the communication code is a bit confusing.

I can tell you right now that you would be much happier in life if you wrote a web service to facilitate communication. But then you need a server for this.

Good luck. You will need it.

OR, you could just write a game for an IM client, such as Microsoft Messenger. I have seen games for this, so I know that it can be done.

0
source

As someone said, perhaps this is not yet possible if you do not have an intermediary server between the two players. Since you are happy to use a third-party server, I suggest you create your system using Google App Engine + XMPP via HTTP. It works great over the Internet and behind a firewall. Still, it’s free (until your system grows out of the GAE quota).

0
source

Peer-to-peer connection is disabled due to your firewall restriction. In any case, this is not very convenient for directory services.

The next simple method I would use is to drop a very simple CGI server script on one of the many super cheap web hosting sites. It seems you do not want to go along this route. Is there any special reason? 100 lines of code and a super cheap server should give you everything you ask for and more.

I assume that you can connect to some third party. I don't know about current IM protocols, but a good old IRC and a separate channel for your game will work. You could even rake something together using FTP. BLOG comments on the free blog site will also work. The question is why?

These are all bedbugs. They do work in stupid, inelegant, and poorly scalable ways.

I urge you to reconsider your web server solution.

0
source

Source: https://habr.com/ru/post/1299507/


All Articles