Question
Flash Runtime Sharing Challenge 2008
Hi everyone!
So I've been looking more into the "Import/Export for runtime sharing" of flash, and have run into some frustrating behavior. The problem I'm running into is that Flash's management of swf paths is confusing, and there is not a lot of documentation as to how the engine links files together.
First some background; forgive me if it's verbose, I just want to make sure I supply enough information for this complex scenario.
Basically, I'm trying to make a simple 2D fighting game like Street Fighter, so I'll use a character... Let's say... Ryu(cause he's the coolest!)
I'm using external linking to try and reduce the sizes of the swfs from the FX in the game w/o having to create a complex dummy system. I've got most of the research completed, the final hitch that I've encountered is how Flash CS3 handles the linkage setup. Here's the setup I have with Ryu:
/game/rsrc/characters/ryu/flash/Impact.fla
/game/rsrc/characters/ryu/flash/ Impact.swf
/game/rsrc/fx/ ImpactFX.fla
/game/rsrc/fx/ ImpactFX.swf
/game/bin-debug/Game.swf
So ImpactFX is the VFX that will be used in all character's animations. It's a dust cloud that appears when ryu hits the ground.
Ryu's Impact file references ImpactFX's library. There will probably be others like WallImpact, etc.
Game is the main game.
So if I have 200 Impact animations with Ryu, w/o using runtime sharing, I have to take the size hit, roughly 200 * sizeof( ImpactFX.swf), since the assets are burnt into each individual Impact animation's swf. With runtime sharing, I only have to download ImpactFX.swf, so I get major savings over that VFX. Right?
I've been able to get runtime sharing to work in specific instances, but not in a general system.
So the first thing I did:
I setup the shared symbols in ImpactFX.fla to 'Export for runtime sharing'. I used the default symbol names, and used the URL ' ImpactFX.swf.'
Dragged the folder that contained the shared symbols from ImpactFX.fla to Impact.fla. This setup all the symbol's correctly.
Added them to my scene and ran( Impact.swf). No dice! I got this error:
Error opening URL 'file:///H|/flash/game/rsrc/characters/ryu/flash/ImpactFX.swf'
From this, I ascertained that Impact.swf was looking for ImpactFX.swf in the same directory as it.
As a quick test I copied the ImpactFX.swf to the same directory as Impact.swf. Re-ran, and success! The swf savings are there, but it's not ideal at all, I have to copy the swfs to the same directory???
From there I changed the linkage up a bit. From the library in Impact.fla, I changed the Import URL to ../../../fx/ImpactFX.swf. Still success! But... Some more weirdness here, I only changed it on one symbol, and during runtime it worked for all symbols... Even though the other symbols still point to just ImpactFX.swf...
So this works fine when I run and test the animation from the fla. However, when I try to run it from the Game.swf, DISASTER! This one was even more frustrating; the flash player doesn't seem to give the previous error message(even though it's the same issue.) I traced this problem down before and found that the Impact.swf would never return a 'loaded' event. Not cool. Of course, copying the ImpactFX.swf to the appropriate path fixes this and it runs beautifully.
So where does that leave me? There's a way to get this to work, but it's not pretty at all, especially for artists. The ideal setup I would like to have the artist working is:
1. Open the FX library fla, pin the library, and drag drop the appropriate symbols for the animation.
2. Save and export.
3. Run and confirm in the fla's test frame work.
4. Run and confirm in the game.
Unfortunately, with all the swf location copying and pathing this adds too much complexity for an art pipeline.
So that's my dilemma. The main question I am trying to figure out now is, what's the best pipeline solution for this scenario? I want to be able to runtime share these files with multiple shell programs. A solution is forming, but I don't think it's the best.
It seems like when you setup a symbol to 'export for run-time sharing', the URL defines the path the parent importing swf uses to find the runtime resources, which seems a little backwards...
I tried loading ImpactFX.swf before Impact.swf. That didn't work, even though they are in the same security sandbox.
Other questions:
1. Is there a way to make loading swfs throw that 'Error opening URL' error?
2. Is there a way to say 'hey flash player, the file you are looking to link is over here!'
3. Or even better, 'hey load these runtime assets before you load the assets that reference them!'
4. Is this necessary? I'm assuming this is a required savings, because if we have a lot of animations with FX, we're going to want to cut down on our download size. Figuring out this pipeline may also allow us to load one large library file for the game animations, and just load that.
5. Does the security sandbox system have anything to do with this.
Any thoughts or ideas? Feel free to point me towards documentation, I haven't had much luck finding any detailed documentation for this topic.
So I've been looking more into the "Import/Export for runtime sharing" of flash, and have run into some frustrating behavior. The problem I'm running into is that Flash's management of swf paths is confusing, and there is not a lot of documentation as to how the engine links files together.
First some background; forgive me if it's verbose, I just want to make sure I supply enough information for this complex scenario.
Basically, I'm trying to make a simple 2D fighting game like Street Fighter, so I'll use a character... Let's say... Ryu(cause he's the coolest!)
I'm using external linking to try and reduce the sizes of the swfs from the FX in the game w/o having to create a complex dummy system. I've got most of the research completed, the final hitch that I've encountered is how Flash CS3 handles the linkage setup. Here's the setup I have with Ryu:
/game/rsrc/characters/ryu/flash/Impact.fla
/game/rsrc/characters/ryu/flash/ Impact.swf
/game/rsrc/fx/ ImpactFX.fla
/game/rsrc/fx/ ImpactFX.swf
/game/bin-debug/Game.swf
So ImpactFX is the VFX that will be used in all character's animations. It's a dust cloud that appears when ryu hits the ground.
Ryu's Impact file references ImpactFX's library. There will probably be others like WallImpact, etc.
Game is the main game.
So if I have 200 Impact animations with Ryu, w/o using runtime sharing, I have to take the size hit, roughly 200 * sizeof( ImpactFX.swf), since the assets are burnt into each individual Impact animation's swf. With runtime sharing, I only have to download ImpactFX.swf, so I get major savings over that VFX. Right?
I've been able to get runtime sharing to work in specific instances, but not in a general system.
So the first thing I did:
I setup the shared symbols in ImpactFX.fla to 'Export for runtime sharing'. I used the default symbol names, and used the URL ' ImpactFX.swf.'
Dragged the folder that contained the shared symbols from ImpactFX.fla to Impact.fla. This setup all the symbol's correctly.
Added them to my scene and ran( Impact.swf). No dice! I got this error:
Error opening URL 'file:///H|/flash/game/rsrc/characters/ryu/flash/ImpactFX.swf'
From this, I ascertained that Impact.swf was looking for ImpactFX.swf in the same directory as it.
As a quick test I copied the ImpactFX.swf to the same directory as Impact.swf. Re-ran, and success! The swf savings are there, but it's not ideal at all, I have to copy the swfs to the same directory???
From there I changed the linkage up a bit. From the library in Impact.fla, I changed the Import URL to ../../../fx/ImpactFX.swf. Still success! But... Some more weirdness here, I only changed it on one symbol, and during runtime it worked for all symbols... Even though the other symbols still point to just ImpactFX.swf...
So this works fine when I run and test the animation from the fla. However, when I try to run it from the Game.swf, DISASTER! This one was even more frustrating; the flash player doesn't seem to give the previous error message(even though it's the same issue.) I traced this problem down before and found that the Impact.swf would never return a 'loaded' event. Not cool. Of course, copying the ImpactFX.swf to the appropriate path fixes this and it runs beautifully.
So where does that leave me? There's a way to get this to work, but it's not pretty at all, especially for artists. The ideal setup I would like to have the artist working is:
1. Open the FX library fla, pin the library, and drag drop the appropriate symbols for the animation.
2. Save and export.
3. Run and confirm in the fla's test frame work.
4. Run and confirm in the game.
Unfortunately, with all the swf location copying and pathing this adds too much complexity for an art pipeline.
So that's my dilemma. The main question I am trying to figure out now is, what's the best pipeline solution for this scenario? I want to be able to runtime share these files with multiple shell programs. A solution is forming, but I don't think it's the best.
It seems like when you setup a symbol to 'export for run-time sharing', the URL defines the path the parent importing swf uses to find the runtime resources, which seems a little backwards...
I tried loading ImpactFX.swf before Impact.swf. That didn't work, even though they are in the same security sandbox.
Other questions:
1. Is there a way to make loading swfs throw that 'Error opening URL' error?
2. Is there a way to say 'hey flash player, the file you are looking to link is over here!'
3. Or even better, 'hey load these runtime assets before you load the assets that reference them!'
4. Is this necessary? I'm assuming this is a required savings, because if we have a lot of animations with FX, we're going to want to cut down on our download size. Figuring out this pipeline may also allow us to load one large library file for the game animations, and just load that.
5. Does the security sandbox system have anything to do with this.
Any thoughts or ideas? Feel free to point me towards documentation, I haven't had much luck finding any detailed documentation for this topic.