Skip to main content
Inspiring
July 10, 2013
Answered

Central folder for images and sounds to reuse them or NOT???

  • July 10, 2013
  • 1 reply
  • 6764 views

Hi.

I am producing a large amount of graphics and sounds for an online elearning course.

Can I just confirm one thing please?

Should I put most of my graphics that are going to be shared with other swfs into its own dedicated swf.

As it is cached I suppose that would be the best idea.

BUT

Doesn't it also take longer for a game or screen to load if it has to import the particular mc inside the large resources.swf.

Also, how exactly does it get to that mc.

For example I want mountain mc (which resides inside resources.swf) in my flyingGame.swf.

Does flyingGame have to import resources.swf and then "look inside" for mountain mc EVERYTIME.

Is this good or bad.

I getconfused as to the best way to go about this. So,ebody mentioned RSLs - is that better or am I in fact doing that already as the libraries are cached and shared anyway?

This topic has been closed for replies.
Correct answer sinious

Nesting libraries inside others will do exactly as you've said, cause you to load unnecessary things. It also creates a dependancy that could be highly unnecessary. If one game is updated that uses a shared asset, all the other games will update for nothing. 

To take an example for speedy web design (other than sprite sheets), it's always been highly suggested to limit the number of HTTP requests. If you need to load 50 images, 30 audio files, etc, this isn't going to work terribly efficiently as external assets.

If you can manage to get the assets on sprite sheets, I feel these are the most flexible overall, especially with an atlas. Keep in mind external files are easy to edit, don't have the SWF bloat and are also cached.

The only thing SWF gives you is development speed and perhaps a speed advantage if you're loading dozens and dozens of external assets. If you went external and found you needed to load 50-100+ assets then wrapping it in a single SWF is far more advantageous.

Audio is an ideal target to bundle in SWF if you can because each file must be a separate download. That said, there's nothing SWF is doing to make the audio any smaller than you could make it at similar settings in any other audio encoder at the right settings. MP3 is MP3, etc.

Your answer could lie in between multiple per-game strategies. SWFs for some games, external assets where possible elsewhere and a combination of both as well. It really depends on your game.

1 reply

sinious
Legend
July 10, 2013

How complex are the graphics assets? Any reason not to load them off the server as regular graphics and audio rather than in a SWF? The most efficient way is going to be literally only loading what you need and nothing more. If there's tons of little graphics in games then you'll optimize it even more with sprite sheets.

Inspiring
July 10, 2013

Hi.

Well, I should say that they are not pictures as such but vocabulary.

Food: has orange, apple etc...

These mcs are used hundreds of times by different games so are imported as you comment at the end.

The other example is more for larger game apps such as a crossword I have. I import the graphics because I thought I would use them in other games and I certainly will but for now I'm thinking that there is a lag because of what I am doing.

The game has to import another swf and look for the assets it needs etc... So in that repect would it be better to put those graphics back into the game fla that requires them.

I just thought it would be a great idea especially for music because some tracks can get up to 500k. I am looping them but they are still big.

btw: when I put sounds inside a swf they get compressed even more so that should be good shouldn't it?

sinious
Legend
July 15, 2013

Hi.

There is a a lot of information on this post now. I will try out all methods and report back. All this knowledge has me a lot to know how to do things better and how they work:

BUT

I tried out a few tests this morning and to my horror the "problems" seem to be somewhere else. So all these comments will help greatly but the problem is in our code.

TEST

I uploaded a new menu.swf that weighed only 270kb to replace the other one of 1MB+ thinking that should do the trick. To my horror it loaded as slowly (uncached as I empty the cache on firefox for testing).

It took 13 seconds - what a disaster.

So on the good side my asset loading doesn't seem to be too bad (although it can get a lot better).

Bad side, my menu screen is doing some requests to the server database with some xml in there etc... and that is where I am completey lost.

That has nothing to do with this post, should I try and create another post?


It doesn't have much to do with this post but it's still on the general track of helping you optimize your project.

Have you load tested your server? 270KB would load instantaneously on just about any system with decent net. A rusty old DSL connection at 1.0Mbit would load that in ~2.1 seconds at full speed and most people have been well beyond that for a decade or more. The issue must be hardware, poorly performing software or an overwhelmed network. 13 seconds is a very, very long time.