HTTP, (Including Filez)
by Ricky Taylor · in Torque Game Builder · 12/22/2005 (4:46 pm) · 7 replies
Hey,
Has anyone considered sending files over HTTP, or FTP...?
I'm trying to implement an Auto-Updater, and I want to be able to read a file... Something like Files.TXT or Files.XML and parse it. Then get the appropriate files...
Also, can anyone think of a way of overriding the T2D.EXE file while its running? Or perhaps requiring a restart... It would be a bit annoying if I had to put a message like "Critical Update, please check the homepage.".
Thanks in advanced,
Ricky,
Has anyone considered sending files over HTTP, or FTP...?
I'm trying to implement an Auto-Updater, and I want to be able to read a file... Something like Files.TXT or Files.XML and parse it. Then get the appropriate files...
Also, can anyone think of a way of overriding the T2D.EXE file while its running? Or perhaps requiring a restart... It would be a bit annoying if I had to put a message like "Critical Update, please check the homepage.".
Thanks in advanced,
Ricky,
#2
For instance, let's say your game's executable is called "engine.exe". The in-game updater would download your new executable under the name "engine.upd", then tell the user that he must restart the application. The user clicks OK, and the application quits. The launcher, appearing to be the main executable, and being the file that the user clicks on, would do this:
1. Check for engine.upd
2. If not there, run engine.exe and end script. If there, rename engine.exe -> engine.old (deleting the previous engine.old if one already exists). Then rename engine.upd -> engine.exe.
3. Run engine.exe and end script.
This way, the update could happen completely in-game, and the game would automatically use the new exe when the game is relaunched. As a safety precaution, make sure that when the user updates from within the game, the game downloads the new executable LAST, under a DIFFERENT name than engine.upd, and renames it to engine.upd only when it's confirmed to have downloaded completely (or just downloads to a different location, then moves it to the right location in the end). That way the game doesn't attempt to run a half downloaded executable on the next launch.
Maybe T2D has something simpler than this. I really am not familiar with the engine (or programming) at a decent depth at all. But if I were in your situation, and couldn't figure out a way for Torque to do it, I'd do something like the above.
12/23/2005 (1:07 am)
Another idea I just had... maybe you could have a separate launcher executable. It would be the default executable that the start menu/desktop shortcut links to, and is the name of your game. It could search for a specific filename that you would call the update. Then it could back up the previous executable, then rename and launch the new executable. For instance, let's say your game's executable is called "engine.exe". The in-game updater would download your new executable under the name "engine.upd", then tell the user that he must restart the application. The user clicks OK, and the application quits. The launcher, appearing to be the main executable, and being the file that the user clicks on, would do this:
1. Check for engine.upd
2. If not there, run engine.exe and end script. If there, rename engine.exe -> engine.old (deleting the previous engine.old if one already exists). Then rename engine.upd -> engine.exe.
3. Run engine.exe and end script.
This way, the update could happen completely in-game, and the game would automatically use the new exe when the game is relaunched. As a safety precaution, make sure that when the user updates from within the game, the game downloads the new executable LAST, under a DIFFERENT name than engine.upd, and renames it to engine.upd only when it's confirmed to have downloaded completely (or just downloads to a different location, then moves it to the right location in the end). That way the game doesn't attempt to run a half downloaded executable on the next launch.
Maybe T2D has something simpler than this. I really am not familiar with the engine (or programming) at a decent depth at all. But if I were in your situation, and couldn't figure out a way for Torque to do it, I'd do something like the above.
#3
The easiest way to go is have a seperate executable to do the updating / launching (kinda how Dave mentioned above). There are still a bunch of annnoying tricks you have to do to be able to update the updater itself. MSDN has (or at least, it used to) some good information on this issue. If you're searching, look for info on writing uninstallers too, a lot of the tricks those use to delete the uninstaller.exe without reboooting are similar to what you'd need for an updater.
T.
12/23/2005 (1:43 am)
The problem with Windows is you cannot modify / delete / rename / etc a .exe that is currently running. This means that updaters have to jump through a load of hoops. Linux does not lock the executable, and since OS X is based on BSD I would assume that doesn't either.The easiest way to go is have a seperate executable to do the updating / launching (kinda how Dave mentioned above). There are still a bunch of annnoying tricks you have to do to be able to update the updater itself. MSDN has (or at least, it used to) some good information on this issue. If you're searching, look for info on writing uninstallers too, a lot of the tricks those use to delete the uninstaller.exe without reboooting are similar to what you'd need for an updater.
T.
#4
I had already come up with that solution, as I said in my first post.
I was mainly interested in sending files over HTTP.... No answers?
*Checks Notify Me*
- Ricky
02/12/2006 (8:43 am)
Crap, I forgot to press "Notify Me".I had already come up with that solution, as I said in my first post.
I was mainly interested in sending files over HTTP.... No answers?
*Checks Notify Me*
- Ricky
#5
If you couldn't tell, i really want to interact with web services, and do not like the current implementation of the object, but thats why having access to the source is so great :)
02/12/2006 (6:48 pm)
AFAIK (i was reading on this last week), there is an httpobject in toruqe and t2d. However, it is very very limited. As a web services programmer by day, the httpobject is a pain in the ass to even just get an XML and put the text in a variable, for example. A project I'm working on needs an HTTPObject that doesnt work in such a strange way, so if I make any updates to this, I can keep you updated.If you couldn't tell, i really want to interact with web services, and do not like the current implementation of the object, but thats why having access to the source is so great :)
#6
GG!!! You have a new goal...
Ive seen httpObject, and heard all of the problems... But no file transfer.... ='(
Thanks, Ill see if I can find something of interest.
02/20/2006 (8:29 am)
You cant send files over the network? OUCH!GG!!! You have a new goal...
Ive seen httpObject, and heard all of the problems... But no file transfer.... ='(
Thanks, Ill see if I can find something of interest.
#7
There is no facility for binary data by default however, so ubiquitous file transfer isn't quite as easy. There is a resource for adding this though. Produce Panic used a variant of it to fetch an image-of-the-day. There are several other resources for Updaters and file transfer functionality as well, though most are in TGE's domain so may not be viewable by T2D-only people.
02/20/2006 (11:53 am)
HttpObject can handle text files quite well, what problems have you had Ryan? I fetch text (XML, content, etc.) a lot and haven't had a problem yet. Sure, there is no XML parsing in the stock engine, but that's pretty easy to add.There is no facility for binary data by default however, so ubiquitous file transfer isn't quite as easy. There is a resource for adding this though. Produce Panic used a variant of it to fetch an image-of-the-day. There are several other resources for Updaters and file transfer functionality as well, though most are in TGE's domain so may not be viewable by T2D-only people.
Torque Owner Dave "Jellybit" Freeman