Game Development Community

dev|Pro Game Development Curriculum

Binary file transfer in Torque

by Claude-Alain Fournier · 10/05/2004 (8:09 pm) · 9 comments

Download Code File

This little FTP client/server app is written based on
GG ressource 5457, Torque Chat, from John W Vanderbeck

It's a sample application I put together to possibility integrate file transfer into our application. We plan to use this
technique to write a patch server for Adellion

REMARK : This has nothing to do with the real FTP protocol as known in the industry.
------------------------------------------------------------------------------------

How to install :

1) Extract the files to a directory of your choice. (let assume it's called ftpPrototype)

2) Apply engine modifications

To test this resource you will need to apply changes to TCPObject and FileObject. You find the
modified file in engineMod directory. You may copy the changed code or copy the files as is (not tested with 1_3_0 head).

I recommend you apply changes manually, cut and past the modified code, the changed code is always within these two tags :

// CAF
...
... Modified/added code
...
// ENDCAF

Of course you will backup the original file before applying these changes, no need to tell you to do so ;)

Recompile the engine.

3) Copy the engine .exe to the ftpPrototype directory.

4) Change ftpclient.bat and ftpserver.bat to reflect your engine .exe file name.

5) copy some files to the ftpserver/ftpfiles directory - these will be used for testing transfer.

6) run ftpserver.bat

7) run ftpclient.bat

8) login with client, use the following command : ftpConnect("localhost", 20010, "yournamehere") ;

- if you are not testing on local, use the ip address or url
- there is no authorization check, use what ever name in "yournamehere"


9) the client should now be connected.

10) Usage of the client :

The available commands are :

ftpLogout() : --> logout
ftpList() ; --> List the files available for download
ftpGet("") ; --> request a file to the server, example : ftpGet("logo.png") ;

With current configuration the downloaded file are created in ftpclient/ftpfiles


11) Possible issues :

- Once you logout you may not be able to login again, there is no interest on my side to manage that here, prototype was purely to test file download.

- If there are no files available in ftpserver/ftpfiles then no error is shown.

- each time you call ftpGet the file is opened and recreated even if it was already existing, no warning is given.

Here you are, feel free to modify this at will and please let me know if you find a bug.

#1
10/06/2004 (12:35 pm)
Ok I admit it - I'm biased...

But, check it out. If you are involved in creating a MMORPG one of your major headaches is periodic updates. You never know when your players are going to leave and rejoin your game. It also applies if you have RPG aspirations and want to be able to add new content to your game on a periodic basis.
#2
12/05/2004 (12:53 am)
Just for information, I have now used this ressource and implemented a patch server in Adellion. It's pretty neat and very easy to use.

Here is how it work :

- When the player login, the server check the client version and order the client to start the update client if necessary.
- Server send over to the client the list of files and CRC of the new version application files.
- Client build a list of it's own file with CRC and build a diff between it's own and server files.
- Client request files from the server. Client also show an update windows with progress bar.

Currently the update server does not update .dll and .exe only the art and scripts files. We can release .exe and dll as patch to be downloaded and that won't be very often, while scripts and art will be changed regularly. So we went for that "easy" solution, we may exetend the update script to tackle on the issue of updating executable files also. (but then you need to take in consideration operating system). Also the update server do some filtering on file type, or directories example it does not send over .cs files and configuration files or does not update player save directory.

The update client/server could be part of a mmorpg "development kit" we are planning to release at some point next year. Stay tune for more information on that.
#3
03/03/2005 (6:02 pm)
Hows that MMORPG development kit coming? I want and need this patch server :)
#4
03/04/2005 (11:41 am)
For the mmorpg kit be patient.... Working on it. See post about that in Terrain forum :

http://www.garagegames.com/mg/forums/result.thread.php?qt=24552
#5
03/06/2005 (3:06 am)
the update resource won't be released here for all for free?
#6
09/29/2008 (12:55 am)
Hi Alain,


I tried to change my code after changing your suggested files. But It is giving error on compiling saying gane/gameBase.h no such file or directory.


from where I will get gameBase.h file to include.


In your zip file, gameBase.h is not available.


thnaks
#7
01/23/2009 (10:57 am)
Can I use this for TGB? I was hoping to give it a try. Also, is this considered the best resource available to update a client with the latest files?
#8
08/24/2009 (6:35 am)
Hey guys.

I have a slightly odd problem with this. I have a local area network at my house connected to the internet by ADSL, and I have a server elsewhere. I place a (modified) version of this FTP server on the server, and then have two of the computers in my house connect to it. Unfortunately, all files sent, whether selected by the first computer or the second, always go to the second computer.

Claude (or anyone else) - do you have any idea what the problem might be?

Ian
#9
08/24/2009 (11:03 am)
Never mind - this was a problem in my code! What a surprise.