Forum Games Loading external assets online

Discussion relating to game development with Flash

Loading external assets online

Postby AniMoney » September 13th, 2013, 9:07 am

This is more of a theory/common practice question since it's something I don't really understand. Not a specific problem I'm having now, but might later. I'm pretty new so excuse me if these are stupid questions.

I have a game that loads assets (xml, images, sound, etc) externally. The .swf loads them just fine and works well on my computer, but if I upload the .swf on the internet, it doesn't work. Obviously, it's because it can't load the external assets that are on my computer, so I'd have to upload them online too, right?

Am I supposed to upload my entire project folder online (with relative paths) to make the .swf work? I guess that'd be okay if I'm hosting it on my own website. Is there a way to package it all into one file, embedding everything or something for mobile?

What if I'm putting it on a site like newgrounds or kongregate and they ask me to upload one .swf? If I can't upload all the assets onto their server then will I have to make it so that each version of the .swf (newgrounds', kong's, etc) loads it all from the same place (like my website)?

Hopefully someone can explain the process to me! My game is coming along fine, I just want to understand how I'll be sharing it online.
AniMoney
 
Posts: 13
Joined: November 26th, 2012, 9:21 am

Re: Loading external assets online

Postby Benjaminsen » September 13th, 2013, 5:00 pm

It's quite common to have to work with assets that are loaded from a 3rd party server. In fact that is a major reason why we provide the Player.IO GameFS API.

However as you point out yourself, loading all assets from the web every time a mobile app starts might not be the best of solutions for that platform. For such platforms it might simply be better to embed everything into the same SWF.

If you are up for the technical challenge, you could also use the mobile devices local storage capacity to store the latest versions of assets and only load them from web when a new version is uploaded.


Sadly I do not have a code example of the later laying around. Anybody else around here who have a good example of how to do this?
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Loading external assets online

Postby AniMoney » September 21st, 2013, 3:19 am

For such platforms it might simply be better to embed everything into the same SWF.


So for flash (web) it should be okay to have people load the images from a server (perhaps using GameFS), but if I have some assets I know every client will use (certain images, sounds), it would be better just to have them included in the .swf and have them load during the preloader. Is there anyway to include them in the .swf on export without them being in the .fla's library?

Like I don't want to have them inside the .fla, I prefer to have them in a assets folder inside the project folder, but I want those assets to be packaged into the .swf file on export. Can I embed them in through code or some setting in FlashBuilder?

Sadly I do not have a code example of the later laying around. Anybody else around here who have a good example of how to do this?


That'd be awesome if someone does.
AniMoney
 
Posts: 13
Joined: November 26th, 2012, 9:21 am


Return to Games



cron