C# Application With Web Pages

  • Thread starter Thread starter Clive Foley
  • Start date Start date
C

Clive Foley

Hey everyone.

i have written a simple server that accepts user connections. these
connections are made by a simple game which i also made. I would like
this game to be played across a network through my server inside of web
pages. The thing is the game is 2 player so i want peple to initiate the
start of the 2 player game. i.e. via html pages i double click your user
name. A message box comes up on your screen challenging you. if you
press ok then start the game and make all relevant network
connections,otherwise tell me you don't wanna play.

How would i go about initialising a "Game Session" thorugh web pages? I
have heard that ASP.net ties in very neatly to the framework but i'm
lost here. Can scripting control a server application? Has anyone done
anything like this before?

Any ideas are greatly appreciated.

Clive
 
I'm not 100% sure what you are looking for. Do you have a game (say a Windows
Forms game)
that you need to enable match-making for? Or is your game in ASP .NET and now
you are trying
to allow players to challenge one another?

Since you already have a separate server (not written in ASP .NET) then you
probably want your
client to be Windows Forms based. In this case the easiest way to enable
match-making is ot put
control into a web service and have each user poll the service to get lists of
user names and challenge
attempts. Then have the Windows Forms client connect to your back-end server.

If you want this all to be ASP .NET enabled, then rewrite your server to use a
database state or application
state to interact between the players. That way you keep it all within the web
server without having this
external server that the ASP .NET pages need to connect to (this is actually
hard to do, since you need to
establish sockets and then cache them in the user's session. Since ASP .NET
code only gets run while the
user is connected to the page, it becomes hard to manage the sockets if the
user isn't returning to the site
frequently).

Seems like you have a lot of questions going on in your head about game
programming and how this is all
going to fit together. While you've set up a plan of attack (good job on this!)
there are probably some better
design considerations that could make your game easier to implement with more
stability in the long term. Give
us a better hint of what you are doing and I'll do whatever I can to help. I am
working on a plug-in framework
right now that I'm publishing articles on, but I also have about 80 game
programming articles sitting on my desk
and I think some of them would apply if I knew more specifically what you were
doing.
 
Hey,

yes it is a windows forms game. This is how i'm hoping it would work.
You connect to my games server. This creates a socket for you, a network
stream and gets your IP Address. This info is all stored in a Player
object which in turn is stored in an array. After you connect to the
server you are presented with a web page(possibly an asp.net page) of
similarly connected users. You can selected to challenge one of these to
a 2 player game. They can accept or decline this challenge. The real
problem i'm having is when the challenge is accepted how to i match the
connections. I know i just search for the 2 Player objects whose IP
Addresses match but these Player objects are held on the server.

if i could match these Players i wish to launch my game in a web
page(this is achieved using Controls). I have the game all figured and
even the syncronisation between the clients via the games server.
games.yahoo.com have something very similar to this but after you
connect to their games server they launch a Java applet which contains
all the users name,etc. and when you accept the challenge it's this
applet that makes all the connections. I wish to do this all in .NET and
wish to stay away from JAVA(if possible).
You have suggested using web services. Since i've never used them before
could you suggest maybe where i would start getting info. on them.

Thanks for your help Justin,

Clive
 
Back
Top