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

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • 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

    • 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
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.

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

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
  • AGS Baker
  • 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
  • AGS Baker
  • 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
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 »

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 »

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*

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

  • 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

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

  • 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
  • AGS Baker
  • 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

  • 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

    • 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

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

RickJ

  • fix'n one thing and break'n two ...
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • RickJ worked on a game that was nominated for an AGS Award!
Re: Accessing the internet from within AGS
« Reply #20 on: 24 Oct 2008, 20:14 »
Scotch,

Can your plug-in be used to run something from a command line like a batch file or
console program such as 7zip command line version?

For example can your plugin execute this  and if so how?

"7z -t7z c:\\Ags\\3.20\\Archive\\MyGame-V0000-003.7z  c:\\Ags\\3.20\\MyGame\\";

Moox

  • Losttraveler
Re: Accessing the internet from within AGS
« Reply #21 on: 26 Apr 2010, 17:12 »
My sincerest apologies for the bump, however, I was wondering if it is possible to populate fields from within the shell function?

For instance, if I wanted a GUI to craft invoices to be emailed to my clients I can currently get the mail application open with the mailto: function, however, I would have to manually fill in all the fields making it nothing more than a worthless launcher application. After realizing that there is no print functionality this was my fall back plan before loading up c++ and relearning that.

Moox

  • Losttraveler
Re: Accessing the internet from within AGS
« Reply #22 on: 26 Apr 2010, 17:16 »
Edit: Figured it out

Mailto allows for population through a body= code and a subject= code

Re: Accessing the internet from within AGS
« Reply #23 on: 07 May 2010, 03:50 »
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.  
-Dave


I bought Empire Total War and got that of the internet.
The download was 11,5 GB and took three days to complete with internet install.
I then had a std. 2 Mb ADSL connection.

Now I work from home and run fiberlan 100Mbps.

A 180 Mb dl would take me approx. 2-3 minutes.
I doubt personally you have a reason to worry.

But then again, if you can direct me to a good reference on writing plugins I can probably create something like that given a little time to learn this editor thing.

On a personal note using mailto: hrefs is never a good way to do anything email related.
To many prefer using hotmail or gmail accounts without a proper defined email application and then the link invocation fails by default as no defined settings exist and you end up loosing clients.
« Last Edit: 07 May 2010, 03:53 by 10e12 »

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • 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 #24 on: 07 May 2010, 12:10 »
You'd be surprised 10e12!  A big chunk of users are still on dial-up, and the portals that wanted to sell the game are very concerned about bandwidth usage.  An average game of theirs is around 40-50 MB max.  An 180 MB game was way too high. 

And wow, this thread is old.

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #25 on: 07 May 2010, 12:16 »
Yea, you have to remember Dave's primary audience are the casuals.. not gamers.

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • 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 #26 on: 07 May 2010, 12:24 »
It's funny that this thread resurfaces now, because the other day I unearthed it myself to make the Puzzle Bots demo.  It now has a sweet "BUY NOW!" button that takes you to the purchase page.

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: Accessing the internet from within AGS
« Reply #27 on: 07 May 2010, 12:25 »
You capitalist, you.

magintz

  • Mittens Knight
  • Just because I rock doesn't mean I'm made of stone
    • I can help with story design
    •  
    • I can help with web design
    •  
    • magintz worked on a game that was nominated for an AGS Award!
Re: Accessing the internet from within AGS
« Reply #28 on: 07 May 2010, 22:22 »
I've used the TCP/IP plugin before to retrieve web pages in game and I believe scotch or SSH made a IRC client with it, I'm not sure if this could do the trick.
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

suicidal pencil

  • The green-machine
    • I can help with animation
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with web design
    •  
Re: Accessing the internet from within AGS
« Reply #29 on: 14 May 2010, 14:08 »
what if instead of retrieving web pages, but a plugin that gets data from a database? It could be pretty useful. High scores, for example.

Re: Accessing the internet from within AGS
« Reply #30 on: 27 Apr 2018, 11:26 »
hey, does someone have any idea on how to port this plugin to Linux ?

edit: I found a source here: https://bitbucket.org/monkey0506/ags_shell/src/6516d82861c2?at=master

But I am not sure on how to start.

edit2: I started a repo here: https://github.com/ericoporto/agsshell

Trying to find the equivalent command for Linux to be able to port it...
« Last Edit: 28 Apr 2018, 19:57 by eri0o »

Re: Accessing the internet from within AGS
« Reply #31 on: 28 Apr 2018, 20:52 »
It worked!

binary release | github repo

Use this like below:
Code: Adventure Game Studio
  1.   if( System.OperatingSystem == eOSWindows ){
  2.     ShellExecute("open", "rundll32.exe", "url.dll,FileProtocolHandler http://www.google.com");
  3.   } else if( System.OperatingSystem == eOSLinux ){
  4.     ShellExecute("", "", "xdg-open http://www.google.com");
  5.   }
  6.  

Right click, save link as... libagsshell.so

Right click, save link as... agsshell.dll

I actually didn't generate the above .dll but if someone with Windows could confirm the above code works. I based on monkey0506 code linked above.
« Last Edit: 28 Apr 2018, 21:03 by eri0o »