Jibble

Author Topic: Accessing the internet from within AGS  (Read 7097 times)

Dave Gilbert

  • Mittens Vassal
  • Posts: 2,641
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Accessing the internet from within AGS
« on: 16 Apr 2007, 18:33 »
In talking to various portals about distributing Blackwell, the main concern is the download size.  180MB is a bit too heavy for the casual market, and the agreement was to nix the voice pack (which takes up 140MB) but make it a seperate download. 

I thought it would be nice for the player to be able to click a button within the game labelled "Download Voice Pack" and then have the game access the internet and grab the file.  Is this possible to do? 

-Dave

Gregjazz

  • Posts: 1,914
    • I can help with making music
    • I can help with proof reading
    • I can help with scripting
    • I can help with voice acting
    • Gregjazz worked on a game that was nominated for an AGS Award!
      Gregjazz worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #1 on: 16 Apr 2007, 18:59 »
If someone was able to make a plugin that returns PHP output from the internet, I don't think it would be a stretch to return data into a file. Problem is, 140MB is a while for the game to download--you'd think people would want to just be able to download it off the web using download accelerators or whatnot.

scotch

  • Mittens Baronet
  • Posts: 2,091
Re: Accessing the internet from within AGS
« Reply #2 on: 16 Apr 2007, 19:01 »
Only if someone can write the plugin for you. Perhaps you can find someone to that.

How is your speech 140mb? that's something like 6 hours of decent quality ogg, are you using too high a bitrate? Speech doesn't need to be as high as music.

GarageGothic

  • Posts: 3,436
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
Re: Accessing the internet from within AGS
« Reply #3 on: 16 Apr 2007, 19:01 »
It might be possible using a plugin, but wouldn't it be far easier to create a launcher program where this is an option? The game won't recognize the addition of a voicepack anyway without restarting.

scotch

  • Mittens Baronet
  • Posts: 2,091
Re: Accessing the internet from within AGS
« Reply #4 on: 16 Apr 2007, 19:02 »
I don't think writing a launcher program is easier than writing a plugin, it'd be much the same code.
Probably right about the voice not being noticed before an update though, so it's a good idea.

GarageGothic

  • Posts: 3,436
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
Re: Accessing the internet from within AGS
« Reply #5 on: 16 Apr 2007, 19:08 »
A launcher program coded in Visual Basic or similar could just open the standard webbrowser and direct it to the right web address. It doesn't have to be a stand-alone download manager, but of course then you would need to tell the user where to save the file to. For the casual games market that may be a bit too demanding.

Edit: You could even customize the launcher for each distributor with their logo (change a resource file and recompile, takes 2 seconds in VB), I'm sure they'd love that.
« Last Edit: 16 Apr 2007, 19:11 by GarageGothic »

Dave Gilbert

  • Mittens Vassal
  • Posts: 2,641
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #6 on: 16 Apr 2007, 19:11 »
I'm basing this model on Aveyond, which downloaded with a midi soundtrack but you had the option of downloading a full orchestral score.

The file you downloaded was an installer program, which automatically searched for the game folder.  I'd do the same thing with the speech.vox.

Dave Gilbert

  • Mittens Vassal
  • Posts: 2,641
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #7 on: 17 Apr 2007, 19:41 »
Hm.  In talking with others about this, it seems people might be misunderstanding my problem.  Maybe so, maybe not, but here's a simplified version.

Basically, all I want is to create a link button within my game. 

Hopefully that clears things up.  Any advice is appreciated. :-D

-Dave

scotch

  • Mittens Baronet
  • Posts: 2,091
Re: Accessing the internet from within AGS
« Reply #8 on: 17 Apr 2007, 19:52 »
So you want someone to be able to press a button in the game, the game to load an address in the user's web browser, and minimize or lose focus?
It could confuse some people I think, especially if they are running full screen, and as GarageGothic pointed out, even if they download the installer and install, then go back to the game, the sound won't work until they quit the game and start again.

I suppose the sensible way would be something like having a button that opens the installer link, and quits the game, and then add a checkbox (perhaps on by default) at the end of the installer process to run the game again.

That shouldn't be too difficult, as long as your installer software allows it, and it seems like most have something like that. It would need a pluign made but it'd be very basic.
« Last Edit: 17 Apr 2007, 20:00 by scotch »

GarageGothic

  • Posts: 3,436
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
Re: Accessing the internet from within AGS
« Reply #9 on: 17 Apr 2007, 19:57 »
You could even make a autosave right before quitting and restore the game when the game restarts (but probably a good idea to ask the user whether they want to resume the game first).

Edit: If you follow scotch's method, it would probably be better if the downloader doesn't  access the internet until the game is definitely closed. Otherwise the user's firewall program might come up with a warning, minimizing the AGS window and thus preventing the script to proceed.
« Last Edit: 17 Apr 2007, 20:01 by GarageGothic »

Menaze

  • Posts: 8
Re: Accessing the internet from within AGS
« Reply #10 on: 18 Apr 2007, 16:50 »
hi,

i'd try making a batch file. (read a batch tutorial first, to learn how to code it -it's easy)

-always start agsgame with this batch
_______________________
in ags:
-press download button
-save a variable xy to some .txt file
-ags_quit
_______________________

in .bat:
-check variable xy in .txt file
-if xy is != 0 then
-start download manager (check settings for your dm to access your website etc.)
________________________
in download manager (thats a part i don't know much about):
-maybe your download manager tells you when it has downloaded the file, use this information to return to the batch file (this might be difficult)
-if so start an install or patch maker from within the batch file.
-if not, try to start it from within the dm
________________________
a patchmaker (www.clickteam.com -it's freeware) should do the rest. (it's easy too...)



additional:
-hide ags.exe in windows, to make sure every user opens the batch
-use an batch_to_exe_tool to make your .bat file an .exe, you can also make an icon for it.
       


also, in ags you can use dorcan's filenet plugin, to download/upload SMALL files from/to
a website:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=28261.0

*menaze*

AGD2

  • Posts: 286
    • AGD2 worked on a game that was nominated for an AGS Award!
      AGD2 worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #11 on: 19 Apr 2007, 23:54 »
Seems that most people would probably look in a menu launcher for such a feature, rather than in the in-game options.

There's a menu creation program called "Auto Play Menu Studio" by Indigo Rose. Unfortunately, it's not free. But it's useful if you want to include a 'download file' option like this on your menu launcher. You can set your game (or menu) up so that a registry key is created if you install the version of the game which doesn't include the voice pack.

Whenever the launcher is loaded, it'll first check the system for the existence of this registry key. If it exists, then the launcher would show a new button saying "Download speech pack". (You'd point the button's scripting code at a specific URL where your speech pack resides).  Once the speech pack has been successfully installed, you'd have its installer delete the registry key, so that the next time the launcher menu is loaded, it'll know not to display the "download music" button again. (You'd have to remember to make the main game's un-installer be set up to remove the registry key too, if it exists, regardless of whether the speech pack was installed or not.)

If you don't want to mess with the Windows registry, I think the program also allows you to do the same thing by dumping a .dat file to the directory.

I'm not sure if there are any freeware menu building programs around that do the same thing, but I've used this one, so I can vouch that it works pretty well for this purpose.

SupSuper

  • Posts: 156
  • Beware the dancing llama!
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • I can help with web design
Re: Accessing the internet from within AGS
« Reply #12 on: 20 Apr 2007, 00:15 »
You can also just add the option on the installer, since most have built-in support to download files.
Programmer looking for work

GarageGothic

  • Posts: 3,436
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
Re: Accessing the internet from within AGS
« Reply #13 on: 20 Apr 2007, 10:44 »
If you don't want to mess with the Windows registry, I think the program also allows you to do the same thing by dumping a .dat file to the directory.

Or just check for the speech.vox file in the game dir instead.

voh

  • Posts: 1,204
  • Awww. Yeah.
    • I can help with play testing
    • I can help with proof reading
    • I can help with story design
    • I can help with translating
Re: Accessing the internet from within AGS
« Reply #14 on: 21 Apr 2007, 00:00 »
I was going to post the same as what AGD2 posted. I would opt for a game launcher as well, which could link to start game, setup, download voice pack, website, quit.

That would work best. I concur with the notion that doing it from the game would be a bad choice, as most people will run it full-screen (what with the high resolutions, and mucking about with configs concerning graphics filters isn't everyone's cup of tea) and it'd cause them to lose focus.
Still here.

Dave Gilbert

  • Mittens Vassal
  • Posts: 2,641
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #15 on: 25 Apr 2007, 20:40 »
Hi all,

Thanks for all the tips!  Still, while accessing the internet from the game itself might not be applicable to this particular problem, it still needs to be done for other reasons.  Mainly, one portal wants the game to open a browser window to the game's product page when the demo/trial version is complete. 

There's nothing equivilent to an OpenURL("www.blah.com") command?

Nikolas

  • Posts: 3,608
  • just me in awful resolution
Re: Accessing the internet from within AGS
« Reply #16 on: 25 Apr 2007, 20:53 »
heh...

www.blah.com is an actual site for S. America ;D

radiowaves

  • Posts: 511
    • I can help with backgrounds
    • I can help with characters
    • I can help with making music
    • I can help with voice acting
Re: Accessing the internet from within AGS
« Reply #17 on: 25 Apr 2007, 21:12 »
I'd still suggest you try cutting the size down a bit. If AGS can support mp3's, you could try vbr conversion. Just convert it to lowest quality of vbr and you can see what miracle the filesize is with same good quality. You can do this via lame + razorlame for easier use.
I am just a shallow stereotype, so you should take into consideration that my opinion has no great value to you.

Tracks

GarageGothic

  • Posts: 3,436
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
Re: Accessing the internet from within AGS
« Reply #18 on: 25 Apr 2007, 22:28 »
There's nothing equivilent to an OpenURL("www.blah.com") command?

Once again a launcher program is probably your best bet, since AGS script can only run other AGS games. The launcher would start  the game, then remain resident until the game exits and open the URL in a web browser when the game closes. Try asking someone who codes Visual Basic or similar, this shouldn't be difficult stuff. I'm myself learning bits of VB Express to make my own laucher program, and just after half an hour playing around with it, I can do about half of what you would need - sadly not enough to help you out, yet.

scotch

  • Mittens Baronet
  • Posts: 2,091
Re: Accessing the internet from within AGS
« Reply #19 on: 25 Apr 2007, 23:15 »
I made this in 4 minutes: http://www.caverider.com/temp/ags_shell.dll if you choose to do it from AGS. It lets you use the windows ShellExecute function. For example to open google.com:

ShellExecute("open", "rundll32.exe", "url.dll,FileProtocolHandler http://www.google.com")

anyway, I think a launcher is a good idea too, if you can find someone to make one.

I also think radiowaves is right... using low bitrage vbr ogg would be your best bet. I expect you could divide the filesize by three without anyone noticing the compression.