多人回合制 silverlight 游戏的服务器端

发布于 2024-07-24 06:09:33 字数 481 浏览 3 评论 0原文

我目前正处于使用 silverlight 设计基于浏览器的游戏的早期阶段。 游戏将有很多 2-4 名玩家(甚至可能多达 8 名)的比赛,并且是回合制的。

前端是Silverlight 3.0,因为我在那里有一些经验。 我想弄清楚后端应该是什么。 由于游戏是回合制的,因此不需要像实时游戏那样频繁地轮询服务器。 服务器端将包括某种在客户端和后端之间进行通信的中间层。 后端将是基于 ac# 的 Windows 服务,它根据用户操作(攻击、防御、移动、技能、升级等)执行验证和计算。

Silverlight 3.0 客户端和服务器上的 c# windows 服务之间的中间通信层的以下优点和缺点是什么。

  1. 套接字
  2. WCF / WCF 双工服务
  3. .Net RIA 服务

目前我对上述三个选项一无所知,但是我过去创建过 ASP.Net Web 服务,并且在大学里我做过一些套接字编程,但我已经忘记了。

I am currently in the early stages of designing a browser based game using silverlight. The game is going to have many matches of 2-4 players (perhaps even up to 8) and will be turn based.

The Front end is Silverlight 3.0 since I have some experience there. I am trying to figure out what the back end should be. Since the game is turn based it will not need to poll the server as often as a real time game. The server end will include some sort of intermediary layer which communicates between the client and the back end. The back end is going to be a c# based Windows service which performs validation and calculations based on user actions (attack, defend, move, skills, leveling etc etc).

What are the pro's and cons of the following for middle communication layer between the Silverlight 3.0 Client and the c# windows service on the server.

  1. Sockets
  2. WCF / WCF Duplex Service
  3. .Net RIA Services

Currently I don't know anything about the three options above, however I have in the past created ASP.Net Web services and in university I did some socket programing that I have mostly forgotten.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回旧景 2024-07-31 06:09:33

这是我对事物的看法:

套接字:
好处是这可以表现得非常好。 缺点是它在客户端和服务器上的实现都有些脆弱且复杂。 我会避免这种情况,除非没有其他方法(例如,您需要非常高的性能)。

WCF / WCF 双工:
如果您只需花十分钟考虑要来回发送的内容,那么 WCF 非常容易实现。 性能好,部署简单。 这将是我在线游戏的首选。

WCF Duplex 稍微复杂一些。 有一些关于如何让它发挥作用的很好的教程,但我发现存在一些陷阱,可能不值得付出努力。 如果您不需要高轮询间隔,我会坚持使用普通 WCF。 据我所知,WCF Duplex 也进行轮询,因此它并不是真正的双工。

.NET RIA 服务:
我不确定这一点,但我认为当流量很大时,开销不是您所需要的。 另外从论坛问题中我了解到这个不太容易定制,而 WCF 更灵活。

结论:
除非有一些令人信服的理由不这样做,否则我会坚持使用 WCF。

Here is my view of things:

Sockets:
Upside is that this can perform really good. Downside is that it is somewhat fragile and complicated to implement both on the client and on the server. I would avoid this unless there is no other way (e.g. you need very high performance).

WCF / WCF Duplex:
WCF is very easy to implement if you just take ten minutes to think about what you want to send back and forth. Performance is good and deployment is easy. This would be my first choice for an online game.

WCF Duplex is somewhat more complex. There are some good tutorials as to how to get this to work, but I find there are some pitfalls that may not make this worth the effort. If you don't need high polling intervals I would stick with normal WCF. As far as I know WCF Duplex does polling as well so it's not really duplex.

.NET RIA Service:
I'm not sure about this one, but I figure the overhead is not what you need when having large volumes of traffic. Also from forum questions I learn that this one is not so easy to customize, whereas WCF is more flexible.

Conclusion:
Unless there is some compelling reason not to, I would stick to WCF.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文