Solved

asp.net game architecture

Posted on 2011-09-21
3
297 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

948 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

20 Experts available now in Live!

Get 1:1 Help Now