Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: KiraHaraReturns on Thu 02/08/2018 14:31:52

Title: online game content
Post by: KiraHaraReturns on Thu 02/08/2018 14:31:52
hey,
I would like to know if it's possible to load sprites from www in real time while playing an ags game? What I mean is creating an object with a certain sprite, which is just and only online, so the algorithm has to verify, if the picture is available online and if it is, than load and display it in the game???
Title: Re: online game content
Post by: eri0o on Thu 02/08/2018 16:55:47
Not without the use of a plug-in or an external software that grabs the file.
Title: Re: online game content
Post by: Crimson Wizard on Thu 02/08/2018 17:37:25
AGS has no network support. It can create DynamicSprite from a file on disk, but you'd need a custom plugin to download it from the web.

Alternatively, you may use ready plugin called "Shell Execute" to run some program that can load files from command line, unless such solution does seem too "dirty".
Title: Re: online game content
Post by: KiraHaraReturns on Thu 02/08/2018 22:17:54
thanks for the suggestions
Title: Re: online game content
Post by: Khris on Sat 11/08/2018 07:28:15
It's possible if you use the agsSock plugin and write your own server.

1. Have the server load/download the image file (convert it to PCX format) and turn it into base64 before sending it
2. Send an HTTP Request to the server using the plugin, decode the base64 and write the raw binary to a file
3. load the image into AGS using DynamicSprite.CreateFromFile

I did this successfully with small images, like 100x50 pixels. With bigger images a) the server would send it in chunks, which my code couldn't deal with yet b) the conversion from base64 to binary took ages.
Title: Re: online game content
Post by: Mandle on Sun 12/08/2018 01:35:41
Yer a wizard, Khris!