P2P网络游戏/应用程序:类似“战网"的匹配服务器的好选择 [英] P2P network games/apps: Good choice for a "battle.net"-like matching server

查看:21
本文介绍了P2P网络游戏/应用程序:类似“战网"的匹配服务器的好选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一款网络游戏 (1v1),在游戏中使用 p2p - 不需要游戏服务器.

但是,为了让玩家能够找到对方",而不需要在其他媒介中协调和输入 IP 地址(类似于现代网络游戏的时代),我需要一个协调/匹配服务器.

我不能使用常规的网络托管,因为:

  • 客户端将使用 UDP 进行通信.
  • 因此,我需要进行 UDP 打孔才能通过 NAT
  • 这需要服务器使用 UDP 通信并知道客户端的 IP 和端口
  • afaik 与常规网络托管 (php/etc) 我只能获取客户端的 IP 地址,并且只能通过 TCP (HTTP) 进行通信.

我目前正在考虑的选项:

  • 使用我的程序可以接受 UDP 连接的托管解决方案.(有什么建议吗?)

  • UDPonNAT 似乎可以这样做,但使用 GTalk 并要求每个客户端都有一个 GTalk 帐户(这可能使其成为不合适的解决方案)

有什么想法吗?谢谢:)

解决方案

首先,我说这超出了我的专业范围,但我发现自己很感兴趣,所以我一直在做一些搜索和阅读.

似乎最常用的 UDP NAT 穿越解决方案是使用 STUN服务器.我做了一些快速搜索,看看是否有任何公司会直接为您提供 STUN 托管解决方案,但如果有的话,它们会被埋在简单的网络托管的成堆广告中.

幸运的是,似乎有几个 STUN 服务器已经启动并运行并且免费供公众使用.voip-info.org 上有一个公共 STUN 服务器列表.

此外,如果您探索 SO 标记为nat"的问题,还可以获得更多信息.p>

I'm making a network game (1v1) where in-game its p2p - no need for a game server.

However, for players to be able to "find each other", without the need to coordinate in another medium and enter IP addresses (similar to the modem days of network games), I need to have a coordination/matching server.

I can't use regular web hosting because:

  • The clients will communicate in UDP.
  • Therefore I'll need to do UDP Hole Punching to be able to go through the NAT
  • That would require the server to talk in UDP and know the client's IP and port
  • afaik with regular web hosting (php/etc) I can only get the client's IP address and can only communicate in TCP (HTTP).

Options I am currently considering:

  • Use a hosting solution where my program can accept UDP connection. (any recommendations?)

  • UDPonNAT seems to do this but uses GTalk and requires each client to have a GTalk account for this (which probably makes it an unsuitable solution)

Any ideas? Thanks :)

解决方案

First, let me say that this is well out of my realm of expertise, but I found myself very interested, so I've been doing some searching and reading.

It seems that the most commonly prescribed solution for UDP NAT traversal is to use a STUN server. I did some quick searches to see if there are any companies that will just straight-up provide you with a STUN hosting solution, but if there even were any, they were buried in piles of ads for simple web hosting.

Fortunately, it seems there are several STUN servers that are already up and running and free for public use. There is a list of public STUN servers at voip-info.org.

In addition, there is plenty more information to be had if you explore SO questions tagged "nat".

这篇关于P2P网络游戏/应用程序:类似“战网"的匹配服务器的好选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆