Solved

asp.net game architecture

Posted on 2011-09-21
3
306 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

680 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