Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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.
Posted
Comments
DaveSm12 21-May-14 14:32pm    
I have a question of how did you have a class for player and hand, I am having issues with getting these to be setup correctly and wondered if you have an example I could look at.
wizard@sunflower.com thanks.

1 solution

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
 
Share this answer
 
Comments
Mum_M 29-Apr-14 12:02pm    
Thank you for the reply. Question using ASP.NET and HTML, JavaScript after the player has joined made a first move and now needs to send an update back to server which in turn will to notify other players I do not want the page to refresh is this possible using ASP.NET. Any examples would help. Any other technology? Dont want the page refresh and re-display when a players completes his turn and clicks submit. Also would this work as an application on Mobile device? as web browser in mobile device is too small would not display well, like it to work like a application on mobile device.

Can use ADO.NET million dollar question is it good to save so much data in the database? All games data like hand, deck etc whats the best practice.
Sergey Alexandrovich Kryukov 29-Apr-14 12:54pm    
It would take too much time to write an example for your. Try to search for "char SignalR", it will get you some examples of chat implementation, adequate enough to be a model of your problem.

Yes, ADO.NET. No doubt at all.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900