Accessing the internet from within AGS

Started by Dave Gilbert, Mon 16/04/2007 18:33:06

Previous topic - Next topic

Dave Gilbert

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

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

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

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

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

#5
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.

Dave Gilbert

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

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

#8
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.

GarageGothic

#9
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.

Menaze

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

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

You can also just add the option on the installer, since most have built-in support to download files.
Programmer looking for work

GarageGothic

Quote from: AGD2 on Thu 19/04/2007 23:54:16If 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

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

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

heh...

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

radiowaves

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

Quote from: Dave Gilbert on Wed 25/04/2007 20:40:40There'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

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.

SMF spam blocked by CleanTalk