Jump to content
  • Advertisement
Sign in to follow this  

Single Player Client-Server

This topic is 4519 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone! I'm currently programming a little turn based strategy game, and I've reached the point where I can implement some AI. I also want this game to be playable over a network, which brings me to my question. Is it beneficial to utilize a Client Server-type system for every kind of game( Human vs. AI, Human vs Human)? For example, in a single player match, the game creates a server on the same computer, and then the player and an AI program connect to the local server and play. I'm leaning towards this approach because if I could get that working, then it would be extremely easy to get the Human vs. Human games working, with little extra coding because the framework is already there. Sorry if I'm not making any sense, but I can't seem to explain this very well.

Share this post


Link to post
Share on other sites
Advertisement
@blackdot - Initially I was planning on having a separate AI program that would connect to the server, but in retrospect, it would probably be simpler just to run AI routines on the server itself.

@johnhattan - Alright then its settled [grin], I was just worried about any performance hits I might take by using this approach

Share this post


Link to post
Share on other sites
The amount of data you will send is trivial compared to the memory throughput of a modern machine. Even the cheapest machines have 1 GB/s (gigabyte) which is 8,000 Mb/s (megabit) memory bandwidth these days, and if you live really close to your DSL service center, you may get 6 Mb/s DSL service -- however, that's only if you're really lucky. It's more likely around 1.5 Mb/s, and the upstream of many connections is no more than 0.1 Mb/s.

Clearly, if your game will work on a network, it'll work in memory :-) If you're worried about the sockets still, then you can abstract them away using a memory queuing class that implements the same interface as your socket messaging class, and instantiate the right communication version for the kind of game you're setting up.

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
If you're worried about the sockets still, then you can abstract them away using a memory queuing class that implements the same interface as your socket messaging class, and instantiate the right communication version for the kind of game you're setting up.


Any hints, articles, or links that you can provide about creating that interprocess memory communication? (Preferably in .NET?) :) I have been thinking about doing this same thing but I don't know what the right approach is. I don't necessarily want to use remoting. I am considering named pipes, but I wonder if the UDP communication I use for remote clients will be sufficient for the local player in single player mode.

Share this post


Link to post
Share on other sites
> I'm currently programming a little turn based strategy game
> ...
> Any hints, articles, or links that you can provide about creating
> that interprocess memory communication? (Preferably in .NET?)

==== MS Message Queue ====

Microsoft Message Queuing (MSMQ) is a component of the Windows operating system that allows cooperating applications to send and receive messages to each other, even if the intended recipient application is not running or the computer on which the sender or recipient application is running is disconnected from the network. Messages are stored and forwarded by MSMQ until they reach the destination queue. Later, when a recipient application runs, it can retrieve the messages from the queue. MSMQ decouples sender and recipient applications so they do not need to run at the same time. Message Queuing provides built-in enhanced security, transaction support, and other features.

http://www.microsoft.com/windowsserver2003/techinfo/overview/msmqfaq.mspx ( Clicky )

Note 1: it comes with 2K and XP versions, so no need to add Server-specific components.
Note 2: Only useful for turn-based games.

==== Named Pipes ====

http://www.codeproject.com/csharp/DotNetNamedPipesPart1.asp ( Clicky )

-cb

Share this post


Link to post
Share on other sites
Take a game like Unreal Tournament 2003. How do you suppose they implemented the interaction between the local player and the server? Memory mapped files? Named pipes? I imagine that they created wrappers around their transport layers so it all interfaces the same way, but I am curious as to how a professional product such as that does IPC.

Share this post


Link to post
Share on other sites
Unreal has much higher network bandwidth requirements compared to turn-based games. The architecture is described Here. You can lookup this forum's FAQ for other engines.

-cb

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!