Solved

asp.net game architecture

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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 …

809 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