0

我正在用java开发在线多人游戏。它将是一个可执行的 jar 文件。它是一个单服务器多客户端应用程序。服务器应该能够向客户端广播、多播和单播的地方。实现相同的最佳解决方案是什么。考虑到安全性是套接字最好的解决方案吗?

4

2 回答 2

0

If it's a game that is going on in realtime, then yes.

Alternatively, you could use JSON requests or similar to a webserver for less time critical data. Some games (such as some turnbased ones) base the client/server communication entirely on JSON requests.

A combination of the two is ofcourse possible, and might help shift some load away from your main server application.

For non-realtime stuff, i'm personally a big fan of running a lightweight webserver on some non-standard port (anything above 1024) dedicated to non-web stuff, such as games or other clientside applications pulling stuff out of CGI scripts via GET/POST requests. It's ugly, but it works fine, and it saves me a lot of hassle. The user doesn't really notice a difference.

于 2012-11-10T07:41:12.280 回答
0

如果您关心实时(快速)乘法,那么是的。

于 2012-11-10T07:09:59.640 回答