PDA

View Full Version : What lib is suitable for.



arthurprs
25-08-2007, 07:19 PM
What lib is suitable for 2 clients communicate with no server involved

Robert Kosek
25-08-2007, 07:26 PM
Indy or Synapse (http://www.ararat.cz/synapse/).

arthurprs
25-08-2007, 07:53 PM
Thanks for the quick reply, i should use tcp or udp ?

Robert Kosek
25-08-2007, 08:13 PM
UDP is faster, but packets can be lost. The call is yours. With UDP you kind of need a server I think. Someone else might know more.

WILL
25-08-2007, 08:51 PM
Like Robert said UDP is faster than TCP. However with TCP you don't have to worry about losing packets as all the code to manage this is inside the TCP protocol.

For UDP you'd have to manage all that stuff yourself. This can be a boon or a problem for your game depending on how exactly you want to send your data back and forth and what you want to send.

The ideal balance for network functionality is to send as little data as you can, maximizing the usefulness of what you are sending, while at the same time making sure that both sides are getting all the data they need to synchronize gameplay between all game clients involved.

arthurprs
25-08-2007, 08:57 PM
Don't worry about that but, what about servers, i can't have one :?

wich one will be best? the clients will conect directly

Traveler
25-08-2007, 09:40 PM
I'm not sure I understand, but if you have two pc's connected to eachother you can simply have one set up as server and the other as client (or the other way around), right?

Or, for testing purposes run one server program and one (or more) client(s) all on the same pc and let them connect to localhost.

WILL
26-08-2007, 04:51 AM
Well in networking there are 2 main categories: peer-to-peer and server-client.

However when you are working within an application's code you have to think a little differently.

You see if you have a single peer-to-peer between 2 clients, one will have to act as the server or master, yes. So they will usually setup 'the game' from which the other will connect to. There are lots of fancy ways to manage this, but this is the way that the TCP/UDP protocols work.

As for which is better. I cannot say, thats up to you to try and see which you prefer. Though I am more familiar with Indy and it does have a component suite for both Delphi and Lazarus if you ever wanted to go cross-platform.

Others that you can use include sdl_net which comes with the JEDI-SDL package. Dean Ellis wrote a few articles on how to work with it. Just take a look in the Article section for his small series.

If you wanted , you could also use DirectPlay, but I don't think it's used or supported anymore.

If you wanted to get all hardcore you can also just use one of the sockets units that come with either FPC or Delphi. But thats a bit low-level and you might not want to start off like that as almost everything would need to be done from scratch.

Don't really know of any others. Just take a look at those and try the demos/examples read up and see which you feel would be better to start with. You can always switch later so long as you code your project well enough.

LP
26-08-2007, 05:02 AM
Actually, the best place to look for these questions is here (http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15). It's a nice networking FAQ.

If you decide to go using UDP, then you don't need a particular library, WinSock is quite easy to use. I've wrote two wrappers myself (TNetCom and TNetExchange), which both provide guaranteed packets and the second one also assures correct packet ordering.

I'd also recommend against using Indy, as it has quite bad implementation IMHO and is not easier to use than WinSock itself.

P.S. Two clients can communicate with each other using Client-Server mechanism (so one client is server and another is client). In this case, "two clients" is a wrong way to say it; the correct term would be "two applications".

arthurprs
26-08-2007, 05:16 AM
Actually, the best place to look for these questions is here (http://www.gamedev.net/community/forums/showfaq.asp?forum_id=15). It's a nice networking FAQ.

If you decide to go using UDP, then you don't need a particular library, WinSock is quite easy to use. I've wrote two wrappers myself (TNetCom and TNetExchange), which both provide guaranteed packets and the second one also assures correct packet ordering.

I'd also recommend against using Indy, as it has quite bad implementation IMHO and is not easier to use than WinSock itself.

P.S. Two clients can communicate with each other using Client-Server mechanism (so one client is server and another is client). In this case, "two clients" is a wrong way to say it; the correct term would be "two applications".

Thx it helped a lot¬?

now i can say that i want peer to peer and TCP :)

Is there something simple to do that ?

savage
26-08-2007, 09:31 AM
Indy or Synapse both handle TCP. I've only used Indy and it worked fine for my needs, though it was for a business application.

arthurprs
27-08-2007, 12:32 AM
Indy or Synapse both handle TCP. I've only used Indy and it worked fine for my needs, though it was for a business application.

I have installed both, i will use the one that cost less kb on exe size :P

~Thx for all the replys