何发展完整的纸牌游戏C# [英] Ho to Develop a Full Playing Cards Game C#

查看:77
本文介绍了何发展完整的纸牌游戏C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.Net开发多人互联网卡游戏。每个玩家示例3个玩家将获得10张牌。然后玩家可以扔掉他们不需要的牌并从牌组中选择一张新牌。经过三轮比赛,最佳手牌获胜。



我已完成甲板课程,播放器课程,卡课程。我的问题是



1.创建前端表示层的最佳技术是什么?考虑到这需要成为一个可以在网络和移动设备上播放的跨平台(iOS和Android)



2.什么是最好的客户端服务器通信方式?插座? WebSockets的? WCF等在客户端和服务器之间进行通信?



3.在数据库示例中保存游戏数据(所有甲板数据,ALl玩家手数据,当前位置,游戏状态)以便游戏即使玩家断开连接也可以继续。

I am working on developing a multiplayer internet card game using .Net. A hand of 10 cards will be dealt each player example 3 players. Players can then throw a card they dont need and select a new card from deck. After three rounds player having best hand wins.

I have the Deck Class, Player Class, Card class done. The question I have is

1. what would be the best technology to create the front end presentation layer? Considering this needs to be a cross platform to be played on web and mobile (iOS and Android)

2. What would be the best client server communication way? sockets? websockets? WCF etc to communicate between client and server?

3. Would be good to save the game data (All Deck Data, ALl player Hand Data, Current Position, Game State) in a database example so that the game can continue even if a player gets disconnected.

推荐答案

你可以简单地使用ASP.NET: http://www.asp.net/get-started [ ^ ]。



前端将是任何启用了Javascript的Web浏览器,它解决了平台兼容性问题,通信将只是HTTP,没有别的。把事情简单化;纸牌游戏不是实时的,不需要任何花哨的东西。



最大的问题是需要服务器推送。您需要让玩家在移动时从另一端通过服务器获得通知,而不是发送定期的HTTP请求,因为它通常在所有这些愚蠢的业务系统中完成。请参阅:

http://en.wikipedia.org/wiki/Pull_technology [< a href =http://en.wikipedia.org/wiki/Pull_technologytarget =_ blanktitle =New Window> ^ ],

http://en.wikipedia.org/wiki/Push_technology [ ^ ]。



所以,我还推荐SignalR:

http://en.wikipedia.org/wiki/SignalR [ ^ ],

http://www.asp.net/signalr [ ^ ]。



我在过去的答案中解释了这个关键方面,请仔细阅读:网站帐户的应用程序'仪表板 [ ^ ]。



现在,服务器端的持久性? ADO.NET:

http://en.wikipedia.org/wiki/ADO.NET [ ^ ],

http://msdn2.microsoft.com/en-us/library/aa286484.aspx [ ^ ]。



这篇优秀的CodeProject文章可以让您立刻开始使用:为初学者使用ADO.NET [ ^ ]。



如您所见,我以不同的顺序回答了您的所有问题;看起来这就是你所需要的。没有特殊的通信技术,没有特殊的客户端或服务器端平台,只有主流。



-SA
You can simply use ASP.NET: http://www.asp.net/get-started[^].

The front end would be any Web browser with enabled Javascript, which solved the platform compatibility problem, the communication would be just HTTP, nothing else. Keep it simple; card games are not real-time, don't require anything fancy at all.

The big problem is the need for the server push. You need to have you players get notified on the move from the other side through the server, not sending periodic HTTP requests as it is typically done in all those stupid business systems. Please see:
http://en.wikipedia.org/wiki/Pull_technology[^],
http://en.wikipedia.org/wiki/Push_technology[^].

So, I would also recommend SignalR:
http://en.wikipedia.org/wiki/SignalR[^],
http://www.asp.net/signalr[^].

I explained this key aspect in my past answer, please read carefully: Application 'dashboard' for website accounts[^].

Now, persistence on the server side? ADO.NET:
http://en.wikipedia.org/wiki/ADO.NET[^],
http://msdn2.microsoft.com/en-us/library/aa286484.aspx[^].

This excellent CodeProject article can get you started in no time: Using ADO.NET for beginners[^].

As you can see, I answered all your questions in different order; it looks like this is all you need. No special communication technology, no special client-side or server-side platform, only the mainstream.

—SA


这篇关于何发展完整的纸牌游戏C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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