4

I am currently working on a rather large, UI-heavy Flash game. Our team has been working on this for about 9 months now. None of us had any previous experience with Flash, so we have continually improved our workflows during this time. However, we still feel that what we are doing now is not optimal, especially the interface between coders and artists, so I am wondering how other teams are working.

The ideal workflow should satisfy the following requirements:

1. Reused UI elements are defined only once

This means, if we want to change a font or a button style, we do not want to go trough all of our menus and change them manually. We want them defined in one central place and only referenced from there. Bonus points if the assets are shared not only at edit time but also at runtime, i.e. they are downloaded only once.

2. Everything is loaded on demand

Currently, we have two different loading steps: First, we load the menu libraries. When this is done, the players can already interact with all the menus. Then, we start loading the actual gameplay data. The initial loading time is still too long, though, and causes us to lose many potential players. What we really want to do is to load only the bare minimum required for the main menu and then load everything else only when the player tries to actually open the respective menus. Zuma Blitz does this really well.

3. Artists can perform minor changes without help from coders

If a menu should be re-designed without changing the actual functionality, it should be possible for artists to do that on their own in Flash CS6. This requires a clear interface between art and code, and it should also be possible for artists to test and debug their changes before sending them to the coders.

-

Our current workflow looks like this: The artist build the screens as MovieClips in Flash CS6 and export them as SWFs. On the code side, load the MovieClips from the screen SWFs and use them as the View classes in our PureMVC-based system. The Mediators access the elements like text fields in the Views by their instance names.

This is error-prone because there is no central place to define the interface (i.e. the instance names). A lot of communication overhead between coder and artist is required. Also, it creates a dependency between the code and the internal structure of the movieclip. The artists cannot attach the text field to a different sub-movieclip when they want to apply some effects to it.

We are experimenting with an event-based interface that requires the artist to add a few lines of code to the movieclip. This is less error-prone and interdependent than before, but it still does not completely satisfy (3) unless we write additional tools for testing and debugging. This must be a common problem and I can hardly imagine that there is no easier way.

For (2), we also started building a home-brewed solution but again, this is such a common task, there has to be something out there already that we can use.

So, how do experienced Flash developers manage such large projects?

Benjamin Schug
  • 389
  • 1
  • 3
  • 12
  • I'm thinking that this question is _perhaps_ better fitted for the Programmers Stack Exchange site, since it seems to be about development in general rather than just code. That's not to say you wouldn't get helpful answers here, just that the chance of getting them may not be as high. – puggsoy Apr 10 '13 at 20:25
  • 3
    FYI, I had posted a similar question on gamedev : http://gamedev.stackexchange.com/questions/40238/how-to-produce-assets-effectively-on-large-flash-game-projects – Antoine Lassauzay Apr 11 '13 at 03:27
  • We decided to handle (1) by putting all the menus into a single FLA. This will mean that only one artist will be able to work at it at a time, but at our current team size that is ok. All bitmaps, sounds and other larger assets will be loaded on demand. Since there really seems to be no ready-made solution for our demands, we will need to build our own tools for the loading and for letting artists debug the screens on their own. – Benjamin Schug Apr 12 '13 at 09:03

1 Answers1

5

I have some thoughts, but they are based on my coding style, which is unique to me.

1. Reused UI elements are defined only once
Depending on what you're reusing, this can be as simple as defining a library symbol and just using it. Fonts can be replaced without digging with a search and replace, and you can also simply swap out the font in the Font Embedding menu.

For sharing across xfl's, you can use a Flash Pro Project. Keep in mind that there's a certain amount of time overhead involved in this (files will want to update when you open them or save them, Flash crashes more with Projects, and it can be a bad idea to try to work on two files from the same project at once).

Some people use swcs, but doing so requires that you instantiate things in it in code, which might not work for your workflow. I use them for audio only, and I find that the objects in it have to be compiled on or before the frame you designate as the AS compile frame, or the sound can't be properly instantiated. I suspect this is going to be the case for anything instantiated from a swc.

2. Everything is loaded on demand
One of the best-kept secrets of Flash is that this is trivially easy to accomplish using the timeline and educated use of the complier. Here's how it works:

If your ActionScript compile frame is a frame greater than 1, then here is how things will compile:

  • Before Frame 1:
    • Any visual assets and embedded sounds used on frame 1
    • Your main Document Class, plus any Classes directly referenced from the Document Class (which is a good reason to code to Interfaces)
  • Before your AS compile frame (N):
    • Your AS Classes (the code, not necessarily the visual/audio assets)
    • The visual and audio assets for any library symbols set to Export for AS in frame N (even if they are not used in the swf)
  • Before the frame where the asset is first used on the timeline:
    • The visual/audio assets in all library symbols where Export for AS in frame N is not checked.

If you put a spinner loading graphic on frame 1 and you have selected frame 10 as your export frame, then if you just let the movie play until it hits frame 10, here is how it will load:

  • If you have any heavy assets in your spinner or directly referenced in your main Document Class, users will see a blank screen while this stuff downloads
  • The spinner will become visible and spin
  • Once your AS Classes have loaded, along with the Library Symbols set to Export in Frame 10 and the assets that are actually on Frame 10, you'll see those assets, and everything you need to use them will be ready.
  • The rest of the swf will continue to load in the background, updating framesLoaded.

I actually use a combination of a setter for the object that's on frame 10, plus an ENTER_FRAME handler to check to see if we're on frame 10 yet. There are certain things that I have to do that are easier based on one and others that work better to do the other way.

3. Artists can perform minor changes without help from coders
If the code is all in the Base Class for the library symbol, artists don't need to understand it, as long as they don't remove or change a needed instance name. I try to minimize dependence on instance names by watching ADDED_TO_STAGE (capture phase) and watching for Display Objects by type. Once I have a reference to an object of the appropriate type, it's easy enough to watch for REMOVED_FROM_STAGE on that object to dereference it. This is similar to how frameworks such as RobotLegs and Swiz work.

Further, I use a concept I call "Semantic Flash," where I do a lot based on labels. I have a base Class, FrameLabelCip, which has built-in nextLabel() and previousLabel() functionality, as well as dispatching FRAME_LABEL_CONSTRUCTED events. It's really easy to go from storyboard event name to Flash label name and just build out the graphics bang-bang-bang.

I make heavy use of Graphic Symbols for synchronizing graphics across multiple labels (for example, bulleted lists), instead of relying on code. This animator's trick makes these things both robust and approachable to less-technical teammates.

Amy Blankenship
  • 6,485
  • 2
  • 22
  • 45
  • Your preloading technique will only work for the main SWF, won't it? We have many dynamically loaded SWFs that are currently loaded in the initial loading screen. The players have to wait in that loading screen until all of the menu libraries are loaded. What we want instead is to load only the bare minimum to show the main menu and have every sub-menu loaded on demand, showing a loading icon until the screen is ready. There does not seem to be a ready-made solution for this in Flash, right? I want to be sure that I don't waste my time writing something that is already there. – Benjamin Schug Apr 11 '13 at 09:15
  • It seems to me that the goal for you is to get those menus up and running quickly. After that, you can deal with the dynamic part however you want. MPE is there is less need for assets to be dynamic than people think, with proper planning. For example, a lot of dynamic stuff can be handled by just making the data dynamic. – Amy Blankenship Apr 11 '13 at 15:22
  • You may want to look at [this](http://www.greensock.com/category/loading/) for the pieces that truly do need to be loaded dynamically. – Amy Blankenship Apr 11 '13 at 15:56
  • Thanks, that looks good. Your answer wasn't exactly what we were looking for, but after talking to several other developers, it seems like the tools we would like to have really do not exist. Still, you gave us some really good tips, so I will accept this answer. – Benjamin Schug Apr 12 '13 at 09:02