Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Multiplayer games, TCP connection that doesn't ask for a IP!

Author
Message
Skid
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United Kingdom
Posted: 18th Mar 2003 23:58 Edited at: 19th Mar 2003 00:02
Here is the code that will let you set up a TCP/IP net game and not have to worry about other people needing the IP or having to find it. The code itself is incomplete, its just the core or what you need to get the system working, you’ll need to added your own code to the top and bottom of each section. I am also providing a slightly change version of a script IanM created, however without this system wouldn’t work.

First things first, the host script is the easiest of the two scripts to setup, the first things the script does it gets the computer IP with that none of this will work. The IP it then stores in a text file along with the game name, the player name and the number of players, the file is then named gamename$ + “.game”. Once this file is created we then upload the file to an ftp director that contains all of the net games. The ftp directory should be checked for a game with the same name before you upload the file.

Now you know how to do that bit here the code for it:




Next you may have created the game but it useless unless you can connect to it, so first things first you will need to make an array that will contain all the information of the game currently active. Next you want to connect to the ftp directory and download all the .game files one by one. Every time you download a file save it then open the file get each of the 4 bit of data out and save it to the array, then close the file and delete it. Keep doing that until you have all the files then you will need to create a way to display and select the games *this bit I haven’t included in the code as you will want to make your own*. Once the user has select a game you then tell the game to connect to that IP address selected and then connect to the first game.

Now if you look at the example it should make more sense :





Now that you can do all of that here is the script that let you get the IP address:





Ok, I’ve only tried this one a few computer and it seems to work a treat, so if you have any problems ask me and I’ll see if I can fix them for you Once again thanks to IanM for is IP getting code.

Skid
PiratSS
21
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 23rd Mar 2003 21:51
I only like the last function which gets the IP.

Cheers.

1PH J00 C4|\| U|\|dER$T@|\||) +|-|I$, j00 |-|@\/3 4lR3Ady w0|\|! - p1r@T$$
Andy Igoe
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 24th Mar 2003 00:22
Solid performance I've toyed with the idea of using ftp space for a similar thing - a sort of 'play online' without using a paid up gaming service.

However I have one recommendation, and I know the multiplayer tutorial in DBPro overlooks this but the line:

if checklist string$(t) = "Internet TCP/IP Connection For DirectPlay"

May not work on a system running a foreign language, I would replace that with a search for the phrase "TCP" (I think under some languages TCP/IP is altered so TCP would be a safer bet).



Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
Skid
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United Kingdom
Posted: 27th Mar 2003 16:54
Pneumatic, good point You could change the code so that rather then looking for the hole thing it just looks for the "TCP/IP" or "Internet" bit of it. That should make it work on other languages

Skid
Eddie Gordo
21
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 16th Apr 2003 01:37
damn i just came up with this idea only to notice it had been created maybe i can add more to it. i do go more in depth with my tutorial that im writing. why do i make something to find that it was already invented. crap yet again.

Artifact Basic-5%
Epic Crossings RPG-25%
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Apr 2003 04:34
don't use the checklist string for gathering the connection type... mainly because of the point that Pneu made, but also because it is a waste of time.

there is a checklist of data which returns 1-4 which is the type of connection... far easier and quicker.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2024-04-19 15:55:27
Your offset time is: 2024-04-19 15:55:27