online game content

Started by KiraHaraReturns, Thu 02/08/2018 14:31:52

Previous topic - Next topic

KiraHaraReturns

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

eri0o

Not without the use of a plug-in or an external software that grabs the file.

Crimson Wizard

#2
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".

KiraHaraReturns

thanks for the suggestions

Khris

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.

Mandle


SMF spam blocked by CleanTalk