Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Fri Jul 30, 2010 10:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Is it possible to send/get data thought HTTP ?
PostPosted: Wed Oct 08, 2008 4:02 pm 
Offline
picked up a pistol
User avatar

Joined: Fri Aug 22, 2008 11:54 pm
Posts: 53
Location: France
Does the Doom3 API offer functions to send/get data thought the HTTP protocol?

I've see the idFileSystem::BackgroundDownload function that seem to download files (HTTP and FTP like autodowload?). But do I need to add a library like libcurl to the game dll if I want to communicate with a webserver?

Do you know if there are some IdTech4 modifications around that have already dealt with something like that?
I've already see Quake1-2-3 mods that have this type of features (centralized rank system, message of the day, my own coopordie worldserver...).

_________________
Past project: COOP or DIE for Quake2 - My giant Imp for the Doom III Boss Contest
Current project: nothing (too busy IRL) Currently playing: nothing (too busy IRL)


Top
 Profile E-mail  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Wed Oct 08, 2008 10:06 pm 
Offline
found a secret
User avatar

Joined: Tue Feb 22, 2005 4:59 pm
Posts: 664
Location: In The Zone
Pat AfterMoon wrote:
Does the Doom3 API offer functions to send/get data thought the HTTP protocol?

I've see the idFileSystem::BackgroundDownload function that seem to download files (HTTP and FTP like autodowload?). But do I need to add a library like libcurl to the game dll if I want to communicate with a webserver?

Do you know if there are some IdTech4 modifications around that have already dealt with something like that?
I've already see Quake1-2-3 mods that have this type of features (centralized rank system, message of the day, my own coopordie worldserver...).


Yes. I have tried idFileSystem::BackgroundDownload() and found it to work ok, although I didn't do too much testing yet - just pulled a file from my web server. I don't know if it works on Linux/Mac - Timothee Besset at id said it wasn't tried from the gamecode so he couldn't be sure. But I'm assuming this is the same system that the core uses for its autodownload feature, so it should be ok.

I have plans to use this funtionality to submit to my web server in the next release of my mod to make the match results and ranking database easier to maintain.

_________________
http://www.the-emz.com/ - A Multiplayer Mod for Doom 3
http://www.the-emz.com/tutorials/pk4/assets/ - D3 PK4 file content
http://www.the-emz.com/tutorials/pk4/decls/ - D3 decl reference
http://www.the-emz.com/tutorials/vstudio/ - Compiling with Visual Studio


Top
 Profile  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Wed Oct 08, 2008 10:44 pm 
Offline
found a secret
User avatar

Joined: Tue Feb 22, 2005 4:59 pm
Posts: 664
Location: In The Zone
Here is a quick and dirty test with no status or error checking...

Add these to idGameLocal
Code:
int downloadState;
backgroundDownload_t bgd;
Put this in idGameLocal::idGameLocal()
Code:
   downloadState = 0;

Put this in idGameLocal::Draw()
Code:
   if ( downloadState == 0 ) {
      // blank out structures
      memset( &bgd, 0, sizeof( bgd ) );
      // prepare for http download to a local file ( will be created in fs_savepath by default)
      bgd.opcode = DLTYPE_URL;
      bgd.url.url = "http://www.the-emz.com/rss.xml";
      bgd.f = fileSystem->OpenFileWrite( "testfile.xml" );
      // GO!
      fileSystem->BackgroundDownload( &bgd );
      downloadState = 1;
   } else if ( downloadState == 1 ) {
      // Are we there yet?
      if ( bgd.completed ) {
         // Done! Close the file and clear down the idStr
         // so we dont blow up on leaving the game
         fileSystem->CloseFile( bgd.f );
         bgd.url.url.Clear();
         downloadState = 2;
      }
   }
Like I said, quick and dirty test. A couple of points. I added this in Draw() because the download is asynchronous and we need to check back to see if it has finished. The other thing is "bgd.url.url" - generally passing idStr instances from gamecode and core is normally "a bad thing" because they use different heaps but I think this should be safe enough as long as the core treats it as const; can't see why it wouldn't.

_________________
http://www.the-emz.com/ - A Multiplayer Mod for Doom 3
http://www.the-emz.com/tutorials/pk4/assets/ - D3 PK4 file content
http://www.the-emz.com/tutorials/pk4/decls/ - D3 decl reference
http://www.the-emz.com/tutorials/vstudio/ - Compiling with Visual Studio


Top
 Profile  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Wed Oct 08, 2008 11:02 pm 
Offline
found a secret
User avatar

Joined: Tue Feb 22, 2005 4:59 pm
Posts: 664
Location: In The Zone
Just to elaborate, the way I'll use this to communicate stuff is on the query string. For example.

(dont expect these to do anything, they're purely here to illustrate the point)
Code:
http://www.the-emz.com/online/?fetch=motd
http://www.the-emz.com/online/?winner=player1&loser=player2&score=10-4


Then some server-side magic at the other end! The result of the "download" would just be the http response which can be discarded in the case of a match result or parsed and displayed as needed for motd. I'm sure there could be a ton of uses for this once I get my thinking head on.

Of course if you want something more complex then you'll probably have to use external libs, but I'm pretty sure this will work fine for what I need.

_________________
http://www.the-emz.com/ - A Multiplayer Mod for Doom 3
http://www.the-emz.com/tutorials/pk4/assets/ - D3 PK4 file content
http://www.the-emz.com/tutorials/pk4/decls/ - D3 decl reference
http://www.the-emz.com/tutorials/vstudio/ - Compiling with Visual Studio


Top
 Profile  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Thu Oct 09, 2008 2:08 am 
Offline
picked up a pistol
User avatar

Joined: Fri Aug 22, 2008 11:54 pm
Posts: 53
Location: France
Thank you very much, I haven't expected a so quick and detailed answer ;)

I've toyed a little with that and it seem that I can do what I want. Here is a little example of a GUI script downloaded on the fly :
Image
Doom3 connect to my website and execute a PHP script that get the PlanetDoom RSS feed and generate a GUI file (an #include is used to reduce the size of the dynamic GUI part).

Hum, Doom3 make me more happy every day :P

_________________
Past project: COOP or DIE for Quake2 - My giant Imp for the Doom III Boss Contest
Current project: nothing (too busy IRL) Currently playing: nothing (too busy IRL)


Top
 Profile E-mail  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Thu Oct 09, 2008 9:57 am 
Offline
found a secret
User avatar

Joined: Tue Feb 22, 2005 4:59 pm
Posts: 664
Location: In The Zone
Nice work. Using dynamic generated #includes is also something I've been playing with. Always something new to be achieved with idTech4 :D

_________________
http://www.the-emz.com/ - A Multiplayer Mod for Doom 3
http://www.the-emz.com/tutorials/pk4/assets/ - D3 PK4 file content
http://www.the-emz.com/tutorials/pk4/decls/ - D3 decl reference
http://www.the-emz.com/tutorials/vstudio/ - Compiling with Visual Studio


Top
 Profile  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Thu Oct 09, 2008 10:43 am 
Offline
picked up a pistol
User avatar

Joined: Fri Aug 22, 2008 11:54 pm
Posts: 53
Location: France
simulation wrote:
Using dynamic generated #includes is also something I've been playing with.

Unfortunately the map file format doesn't allow include :(

I would like to modify maps this way. As far as I understand, adding entities doesn't require to redo dmap. So it won't be very hard to add some entities dynamically.
I think about features like the persistent dead body corpses on my previous modification:
Image
A little taste a community while playing a single player mission ;)

Like IdTech4 content files are mostly text based (maps, script...) I'm currently investigating the way of a diff/patch method generated by PHP:
Data from *.pk4 + small Patch from website = dynamic fresh content

A login/account system is also on my todo list.

_________________
Past project: COOP or DIE for Quake2 - My giant Imp for the Doom III Boss Contest
Current project: nothing (too busy IRL) Currently playing: nothing (too busy IRL)


Top
 Profile E-mail  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Thu Oct 09, 2008 4:16 pm 
Offline
The first 10 posts have been the best...
User avatar

Joined: Sun Apr 06, 2008 2:03 pm
Posts: 22
I nearly wet myself when I saw this thread (given the link by The Happy Friar). Awesome stuff, and thanks for testing it on Planet DOOM! To see my news IN the freaking game is really something. Thanks a ton, great work! :D

_________________
Pappy-R
Planet Quake - Site Director
Planet Wolfenstein - Site Director
Planet DOOM - Site Director
Planet Earth - Pain In The Ass!


Top
 Profile E-mail  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Fri Oct 10, 2008 4:05 pm 
Offline
picked up a pistol
User avatar

Joined: Fri Aug 22, 2008 11:54 pm
Posts: 53
Location: France
He he Pappy-R, thank you for the news and the Picture of the Day. In fact I've discovered your news ingame while testing other stuff :mrgreen:

I found this RSS feature funny and I plan to let it in my map when I will release a techdemo in a month or two.
I hope you will allow me to grab some logo and color scheme on the PlanetDoom website for a nicer GUI ;)

_________________
Past project: COOP or DIE for Quake2 - My giant Imp for the Doom III Boss Contest
Current project: nothing (too busy IRL) Currently playing: nothing (too busy IRL)


Top
 Profile E-mail  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Wed Oct 29, 2008 8:13 am 
Offline
is connecting to Doom3world.org

Joined: Mon Apr 03, 2006 4:52 am
Posts: 9
This is amazing information! Thank you so much for sharing! I hope to do some things with this and report back as well. Gtg!


Top
 Profile  
 
 Post subject: Re: Is it possible to send/get data thought HTTP ?
PostPosted: Wed Oct 29, 2008 10:14 pm 
Offline
picked up a pistol
User avatar

Joined: Fri Aug 22, 2008 11:54 pm
Posts: 53
Location: France
JCH321 wrote:
Thank you so much for sharing!

No problem, I am accustomed to free software and using the GPL Quake2 and Quake3 engines. All my works are planned to be open-source, including the PHP part.

I will probably release a techdemo with a nice planetDoom GUI. It will be integrated in a test map like the arcade consoles in the first Doom3 map.

I'm working on a "wmap" command that connect to the website (the worldserver), download some files (GUI, scripts...) and run the "map" command.

_________________
Past project: COOP or DIE for Quake2 - My giant Imp for the Doom III Boss Contest
Current project: nothing (too busy IRL) Currently playing: nothing (too busy IRL)


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Oneofthe8devilz and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group