Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

asp.net game architecture

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
ovidiutudorache
Asked:
ovidiutudorache
1 Solution
 
dj_alikCommented:
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
 
Amandeep Singh BhullarCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now