Skip to main content
Inspiring
July 10, 2013
해결됨

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

  • July 10, 2013
  • 1 답변
  • 6763 조회

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?

이 주제는 답변이 닫혔습니다.
최고의 답변: 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 답변

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?

Inspiring
July 15, 2013

OH - and sorry to be a pain in the butt - but now that i am testing stuff for tomorrow.

Just re read a little.

An image like a background for a game do I:

a. Import it as an external swf

b. Import it as an external image

c. Keep it in the original game swg where it is required.

Same question with a sound loop (a bg music so quite long...)

btw: I have some music loops which are around 500kb. That's quite a lot ie: If I didn't have them then the swf would be half as light or more. Are there any decent music loops out there that weigh a lot less?


Gerry,

I feel like you are trying to find a single correct approach that will fit all. If my impression is correct - I am afraid there are unrealistic expectations in finding an authority that will provide answers leading to perfection. There are no hard and fast rules. And not everything is under your control.

Without knowing business logic, objectives, and application architecture it is impossible to define optimal approaches.

To summarize what I already stated, based on my experience and realities of Internet based applications here are some of my PERSONAL approaches (which may be sub-optimal or even totally wrong under some circumstances):

  1. Never bake any non-Flash technology specific assets/mime types into application. Bitmaps, text files (XML included), videos, sounds, fonts, etc. should reside outside of application and either be loaded at runtime from CDN (or whatever entity plays role of CDN) or from local drive.
  2. Don’t aggregate assets into SWFs – use them separately. One exception is fonts.
  3. Use streaming protocols instead of progressive downloads whenever viable including RTMP and HTTP dynamic streaming (as a side note – HTTP dynamic streaming is always viable for it is as cheap as dirt).
  4. The only rare exception to the rule 1 is when streaming assets (videos or sounds) must be synched with scripted animations on frame-by-frame basis.
  5. Define each application phase readiness as an absolute minimum of available data and assets to start user experience as soon as possible. If a phase needs N external assets – load all of them in a burst and start user experience immediately.
  6. (As a flavor of 5) Load assets on as needed basis. Don't agonize over anticipating of user actions more than one step ahead.
  7. Never include any configuration data with the code – always write data providers that load external configuration data as a rule.
  8. Use RSL whenever possible.
  9. (As an extension of 8) Don’t include any code that is not mission-critical for the application’s top level. Load additional code when wanted as in points 5 and 6.
  10. If visuals must be scaled – consider using vector graphics first.
  11. For simple shapes use vector graphics.
  12. If 10 or 11 are not feasible – stick with external bitmaps.

I don’t have anything to say about complex animations for my line of work does not require dealing with it. But, still, if you have an opportunity to use GPU an obvious choice would be to utilize bitmap and manipulate BitmapData.

Unfortunately, without good server side there is always a ceiling to performance. This is to your observations regarding Facebook games performance. I am definitely spoiled in a sense that I have the best CDN and Cloud capabilities at my fingertips. I don’t have to agonize over server side performance. For you it is, probably, a different story because you may not have enough financial resources to employ such monsters as AKAMAI and Amazon Cloud (although Amazon is getting more and more agreeable with small business pocket).

As far as platforms go – cross-platform uniformity and compatibility is still a dream. You will have to cater to particular platform in a large extend. It just helps to have an architecture that allows for an efficient parts replacement.

Again, all this is theoretical in my opinion. If something is decent – screw perfection! What is an optimal balance between quantity and quality in your business? How much your users are willing to wait for an experience? How badly waiting time affects quality? As soon as benchmarks hit tolerable levels – it may be a good enough excuse for moving on.