473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

writing a simple networking game

This is the first time I'm writing a network multiplayer card game.
And the model I have thought of :

The host creates a new thread and this thread listens for clients.

When a client is requesting for connection, the host creates another thread
to communicate with the client throughout the game.

Thus, the whole program has (n + 2) threads, for n clients.
(one for listening, and another one for the GUI)
The client only have to create one thread to communicate with the host.

So is there any built in classes that may be of any help beside the Socket
class.

Is there any other better models?
Nov 16 '05 #1
4 3816
You could use remoting which will handle all of the threading for you via the CLR thread pool

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<41********@news.starhub.net.sg>

This is the first time I'm writing a network multiplayer card game.
And the model I have thought of :

The host creates a new thread and this thread listens for clients.

When a client is requesting for connection, the host creates another thread
to communicate with the client throughout the game.

Thus, the whole program has (n + 2) threads, for n clients.
(one for listening, and another one for the GUI)
The client only have to create one thread to communicate with the host.

So is there any built in classes that may be of any help beside the Socket
class.

Is there any other better models?

Nov 16 '05 #2
I'm pretty sure you are going about this the correct way. The only thing left is
to
properly define your game engine to make the input process *easy*. I have a
number
of postings on this and did a web-cast back in July... You should be able to
access
the information by scanning through my blog, but here is a specific category
that
holds most of my card engine postings and considerations.

http://weblogs.asp.net/justin_rogers/category/7611.aspx
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

" Bern" <x@x.com> wrote in message news:41********@news.starhub.net.sg...
This is the first time I'm writing a network multiplayer card game.
And the model I have thought of :

The host creates a new thread and this thread listens for clients.

When a client is requesting for connection, the host creates another thread
to communicate with the client throughout the game.

Thus, the whole program has (n + 2) threads, for n clients.
(one for listening, and another one for the GUI)
The client only have to create one thread to communicate with the host.

So is there any built in classes that may be of any help beside the Socket
class.

Is there any other better models?

Nov 16 '05 #3
Hi Bern,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #4
Hi Bern,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: C-man | last post by:
Basically I want to create a battleship game that can be played by having two clients connect to it. I was wonder what the best networking principal would be. Basically I suppose I would have to...
46
by: H.A. Sujith | last post by:
Why doesn't the standard library provide (at least basic) networking facilities using TCP/IP ?
8
by: Martin Randall | last post by:
Hi, I'm trying to get a simple dataview test page working on my hosted site. The hosted site runs ASP.Net 2.0, no problem. The test page works on my development machine, no problem... but when I...
22
by: JoeC | last post by:
I am working on another game project and it is comming along. It is an improvment over a previous version I wrote. I am trying to write better programs and often wonder how to get better at...
14
by: harbintyler | last post by:
I was wondering if anyone knows how to write a tic tac toe game in c++?
1
by: Olmar | last post by:
Hi, I am trying to write a version of the Hears card game. I can't figue out what is the best way to detect clicks on the cards. Using the cards.dll interface as described in tutorials like...
1
by: HighBuddha | last post by:
Hello, i have a question about game trees. I've been given an assignment in class (highschool) and the assignment is to write a program the simulates The Game Of Eight. The game runs like this: ...
11
by: Krzysztof Retel | last post by:
Hi guys, I am struggling writing fast UDP server. It has to handle around 10000 UDP packets per second. I started building that with non blocking socket and threads. Unfortunately my approach...
1
by: crazycricket222 | last post by:
Hello, I have been working on a new project of a newtork game by this method: http://www.codeproject.com/KB/game/eatergame.aspx I was trying to create a trivia game including 4 answer and 15...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.