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.

RickJ

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

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

Edit: Figured it out

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

-------

#23
Quote from: Dave Gilbert on Mon 16/04/2007 18:33:06
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.

Dave Gilbert

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

Yea, you have to remember Dave's primary audience are the casuals.. not gamers.

Dave Gilbert

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


magintz

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

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.

eri0o

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

eri0o

#31
🚨hey, if you are looking for my plugin below, please try instead AgsAppOpenURL plugin here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=60640.0🚨;

It worked!

binary release | github repo

Use this like below:
Code: ags
  if( System.OperatingSystem == eOSWindows ){
    ShellExecute("open", "rundll32.exe", "url.dll,FileProtocolHandler http://www.google.com");
  } else if( System.OperatingSystem == eOSLinux ){
    ShellExecute("", "", "xdg-open http://www.google.com");
  }

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.

selmiak

linking a website works on windows, but when compiling I get this:

https://i.imgur.com/C40m3nR.png

even though the required file is in the AGS install directory. But not in the plugin part of the game project tree...

eri0o

Linux plugins need to be built twice, once for 32bit and once for 64bit, and then place into the specific directories in the Editor Linux directory.

I don't recommend using AGS shell plugin at all though, it essentially let's the game do whatever it pleases in the computer, I usually delete it when I see in a game. If this is for opening a link, we could add something for this directly in ags4 since it's a function that is in SDL2 itself since 2.0.14, probably adding some restrictions so it only uses http urls or something.

Crimson Wizard

Quote from: selmiak on Sat 21/05/2022 00:01:23
linking a website works on windows, but when compiling I get this:

https://i.imgur.com/C40m3nR.png

even though the required file is in the AGS install directory. But not in the plugin part of the game project tree...

Everything is mentioned in the manual:
https://github.com/adventuregamestudio/ags-manual/wiki/Plugins

SMF spam blocked by CleanTalk