Author Topic: online game content  (Read 209 times)

online game content
« on: 02 Aug 2018, 14:31 »
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???

Re: online game content
« Reply #1 on: 02 Aug 2018, 16:55 »
Not without the use of a plug-in or an external software that grabs the file.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: online game content
« Reply #2 on: 02 Aug 2018, 17:37 »
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".
« Last Edit: 02 Aug 2018, 17:40 by Crimson Wizard »

Re: online game content
« Reply #3 on: 02 Aug 2018, 22:17 »
thanks for the suggestions

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: online game content
« Reply #4 on: 11 Aug 2018, 07:28 »
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

  • NO PIXEL LEFT BEHIND!!!
    • Mandle worked on a game that was nominated for an AGS Award!
Re: online game content
« Reply #5 on: 12 Aug 2018, 01:35 »
Yer a wizard, Khris!