Solved

asp.net game architecture

Posted on 2011-09-21
3
290 Views
Last Modified: 2012-05-12
I want to create a simple game in asp.net. Javascript will call web methods from the asp.net page and using comet technology asp.net will notify users about various aspects of the game. I also have a WCF duplex service made using Windows Forms that acts as the game server. Basically, it contains a Dictionary<int /*id of the game'*, GameController>. The service implements a basic callback interface:

 
  [ServiceContract(CallbackContract = typeof(ITriviaCallback))]
    public interface ITrivia
    {
        [OperationContract(IsOneWay = true)]
        void RegisterPlayer(long gid, Guid pid);
    }

    public interface ITriviaCallback
    {
        [OperationContract(IsOneWay = true)]
        void OnUserRegistered(long gid, Guid pid, bool hasRegistered);
    }

Open in new window


When I call RegisterPlayer in a Win Forms, Console or WPF app, OnUserRegistered is trigger.
In the asp.net, on OnLoad, i do this:

   
InstanceContext context = new InstanceContext(this);
    triviaClient = new GameServer.TriviaClient(context);
    triviaClient.RegisterPlayer(107, Guid.Empty);

Open in new window


It won't work since the page disposes once the data is sent to the client and the callback comes after that.

What is the best approach to notify asp.net of different changed that occur in the game so that asp.net notifier through comet the client (Javascript)?
0
Comment
Question by:ovidiutudorache
3 Comments
 
LVL 18

Accepted Solution

by:
dj_alik earned 250 total points
ID: 36578202
try MVC ASP.NET

Creating the animals game using Asp.Net MVC, jQuery and jQueryUI
http://www.arrangeactassert.com/creating-the-animals-game-using-asp-net-mvc-jquery-and-jqueryui/

A *Basic* Asp.Net MVC + jQuery Game
http://www.squaredroot.com/2008/12/12/devpocalypse-basic-multiplayer-mvc-jquery-ajax-sample/

Web based strategy game using JQuery and ASP.NET MVC. Written in C#.
http://code.google.com/p/fleetcommander/




another threads:
Calling a WCF service from Javascript
http://dotnetbyexample.blogspot.com/2008/02/calling-wcf-service-from-javascript.html

Programming JSON with WCF in .NET Framework 3.5
http://channel9.msdn.com/Shows/The+EndPoint/Programming-JSON-with-WCF-in-NET-Framework-35

0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 37913946
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now