PDA

View Full Version : pascal networking equals >:( ?



mikade
07-07-2010, 04:07 PM
My experience with any kind of networking in any language is what I'd call "extremely limited". That said, I'd like to make a game that uses a bit of networking once before I die, and would be interested in what advice / help the community could give me.

From reading the posts in this section spread over the years, the general consensus seems to be pascal networking = >:(

It's a little discouraging, but I'd still like to give it a try. As mentioned somewhere, I'm working with Delphi 7 at the moment. My skillz aren't particularly l33t or anything. I don't really have any Lazarus / Freepascal etc. experience, either. Thus, from what I've read here, it sounds like I'd want to use something called Indy. Also sounds like Indy 10 isn't particularly user-friendly but that it IS linux compatible. I'm not sure where / how I can get whichever version of this I should attempt to familiarize myself with.

UDP vs TCP/IP? ::)

I don't really know what advice to follow, also, as some of the posts here are quite old, and some are pretty new. Would appreciate any starting links, pointers in the right direction, or general advice anyone could give me. :)

AthenaOfDelphi
07-07-2010, 04:48 PM
Hi mikade,

Now you've delurked so to speak, I'll start off with one of my posts about google :-)

You're looking for "Indy" in relation to "Delphi"... drop the search +"Indy" +"Delphi" into google and see what you get back.

Onto the subject of network in Pascal = :(

I would tend to disagree... it can be a real pain in the ass, but overall, it's not too complicated. Deciding what you want to send and when can be the trickiest part... too much data and the connection can get bogged down... too little and clients can get out of sync. Choice of protocol has a variety of impacts... UDP is not a guaranteed delivery mechanism whereas TCP is because TCP establishes a connection from client to server... UDP on the other hand just creates a packet and pushes it out onto the network.

My recommendation would be that you use Indy 9 as a starting point. There are a good range of demonstrations for it and the documentation is pretty much complete. Indy 9 is also Linux compatible btw, if you used Kylix.

If you want to get something working quickly, without too much hassle, one option you have for comms is to use classes that are descendants of TPersistent (IIRC) as this class provides mechanisms for streaming it's published properties allowing you to simply stream an object across the socket connection.

As I say, I would recommend you look at Indy 9 first, and have a look at the various demos. The one which may be of most interest to you is a simple chat server and client (IIRC - It's been a while since I looked).

Hope this helps get you kick started :-)

jdarling
07-07-2010, 05:45 PM
Indy 9 is definitely the way to go if your going with Indy. The Chat Client/Server demo isn't my best work, but it is a good starting point when working with Indy.

Yes, 10 is out, but there has been a REAL slow down on the work of 10 for the past several years. Most of us just aren't doing much with it. Heck, I don't even have a recent copy of Delphi to build the Demo apps for Indy on any more. There was talk of a C# port at one point in time, but that has now been dropped as well.

If you want cross platform and maintained, then look at Synapse. Bit more difficult to learn, but worth it if you want to run on Linux or Mac.

- Jeremy

PS: The official site for Project Indy is http://www.indyproject.org/index.en.aspx Indy 9 is at http://www.indyproject.org/sockets/Download/Files/Indy9.en.aspx

As both of those URL's can be a bit difficult to find LOL, and the Indy 9 page likes to move :)

arthurprs
07-07-2010, 07:11 PM
take a look at synapse http://www.ararat.cz/synapse/doku.php/start

if you need some kind of "reliable" udp take a look at ENET (there are pascal headers available).

Traveler
08-07-2010, 11:09 AM
Agreed, search for posts about eNet here on PGD. this (http://www.pascalgamedevelopment.com/forum/index.php?topic=4814.0) one for instance might help.

mikade
08-07-2010, 02:17 PM
Lots of links to investigate. ;)

Thanks for all the replies, everyone. I'll take a look-see and report back when I have more questions / feedback.

noeska
08-07-2010, 09:21 PM
Indy10 works great even under linux with fpc. I am currently writing a http server with it. Using remobjects pascalscript as scripting language.

AthenaOfDelphi
08-07-2010, 09:52 PM
Indy10 works great even under linux with fpc. I am currently writing a http server with it. Using remobjects pascalscript as scripting language.


This is something I have plenty of experience of as I wrote the web server for our game in a similar manner.... except it was Indy 9 and Delphi Web Script II (Pascal based script engine).

If you need any advice noeska, feel free to drop me a PM.