User Tools

Site Tools


proton:flash_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
proton:flash_setup [2012/12/11 14:08]
seth
proton:flash_setup [2015/09/09 02:00] (current)
seth
Line 1: Line 1:
-===Compiling the examples for Flash from Windows ===+NOTE:  Well, Flash is more or less dead so this probably won't be updated. ​ Check the HTML5 exporting instead. 
 + 
 +====Compiling the examples for Flash from Windows ​====
  
  
 Adobe'​s new Flash C++ stuff (Flascc?) finally lets you pop get your Proton apps up on the web! Adobe'​s new Flash C++ stuff (Flascc?) finally lets you pop get your Proton apps up on the web!
 +
 +<​html>​
 +<​strong>​Flash version:</​strong>​
 +</​html>​
 +
 +<​html>​
 +<div id="​flashContent">​
 + <​object classid="​clsid:​D27CDB6E-AE6D-11cf-96B8-444553540000"​ width="​480"​ height="​320"​ id="​RTBareBones"​ align="​middle">​
 +   <param name="​movie"​ value="/​games/​test/​RTBareBones.swf"​ />
 +              <!--[if !IE]>​-->​
 +              <object type="​application/​x-shockwave-flash"​ data="/​games/​test/​RTBareBones.swf"​ width="​480"​ height="​320">​
 +              <​!--<​![endif]-->​
 +                <param name="​wmode"​ value="​direct"​ />
 +                <param name="​allowScriptAccess"​ value="​sameDomain"​ />
 +                <param name="​bgcolor"​ value="​CCCCCC"​ /> 
 +                <div>
 +                  <​h1>​You need to update flash:</​h1>​
 +                  <​p><​a href="​http://​www.adobe.com/​go/​getflashplayer"><​img src="​http://​www.adobe.com/​images/​shared/​download_buttons/​get_flash_player.gif"​ alt="​Get Adobe Flash player"​ /></​a></​p>​
 +                </​div>​
 +              <!--[if !IE]>​-->​
 +              </​object>​
 +              <​!--<​![endif]-->​
 +            </​object>​
 + </​div>​
 +</​html>​
 +
 +[[http://​www.rtsoft.com/​games/​test/​test1.html|View the RTSimpleApp example (has audio, jpeg loading) in Flash here]]
  
 ==Features== ==Features==
  
-  * Games run in Flash with 0 source ​code or media changes (except all sounds must be .mp3 at the moment, see gotchas below)+  * Games run in Flash without ​code or media changes (except all sounds must be .mp3 at the moment, see gotchas below)
   * Graphics are hardware accelerated,​ using Seth's GLESAdaptor which uses Stage3D shaders to emulate GLES 1.X behind the scenes   * Graphics are hardware accelerated,​ using Seth's GLESAdaptor which uses Stage3D shaders to emulate GLES 1.X behind the scenes
   * Converts GL_TRIANGLE_FAN and GL_TRIANGLE_STRIP to normal triangles on the fly   * Converts GL_TRIANGLE_FAN and GL_TRIANGLE_STRIP to normal triangles on the fly
Line 15: Line 44:
   * Uses Adobe'​s default preloader, but you could change that   * Uses Adobe'​s default preloader, but you could change that
   * Can also run in a simple text console only mode, see RTConsole example for that   * Can also run in a simple text console only mode, see RTConsole example for that
- 
- 
-Ok, it's assumed you've already built things on Windows and understand how Proton works. 
  
 It's not a perfect emulation (it's still a work in progress), but all the Proton examples run fine, so it ain't bad either. It's not a perfect emulation (it's still a work in progress), but all the Proton examples run fine, so it ain't bad either.
Line 24: Line 50:
  
 Flascc works for OSX or Windows, but I'm only going to cover the Windows setup as that's what I use.  It uses Cygwin, which is sort of a fake linux for Windows. ​ But, the Flascc SDK comes with its own version so you don't have to install it separately, like we used to have to do for Android builds. Flascc works for OSX or Windows, but I'm only going to cover the Windows setup as that's what I use.  It uses Cygwin, which is sort of a fake linux for Windows. ​ But, the Flascc SDK comes with its own version so you don't have to install it separately, like we used to have to do for Android builds.
 +
 +=== Step 1:  Install some sdks and verify your setup ===
  
 Before you whip out .swf's of the Proton examples and amaze everyone, make sure the SDK is working. Before you whip out .swf's of the Proton examples and amaze everyone, make sure the SDK is working.
 +
 +Ok, it's assumed you've already built things on Windows and understand how Proton works.
  
   * Install the Adobe Flash C++ Compiler (It's free, but Adobe makes you create an account [[https://​creative.adobe.com/​apps?​trial=GAME&​promoid=FLASCC|here]] to get it)   * Install the Adobe Flash C++ Compiler (It's free, but Adobe makes you create an account [[https://​creative.adobe.com/​apps?​trial=GAME&​promoid=FLASCC|here]] to get it)
Line 33: Line 63:
   * Follow [[http://​www.adobe.com/​devnet-docs/​flascc/​README.html|this]] and make sure you can compile the 01_HelloWorld example   * Follow [[http://​www.adobe.com/​devnet-docs/​flascc/​README.html|this]] and make sure you can compile the 01_HelloWorld example
  
-**Note**: If you get error "LLVM ERROR: Error: Unable to launch the Java Virtual Machine."​ then modify 01_HelloWorld\Makefile to add **-jvmopt=-Xmx1G** to the build commands, so in the end, it would look like this:+**Note**: If you get error "LLVM ERROR: Error: Unable to launch the Java Virtual Machine." ​like I did, then you should try giving [[http://​www.wikihow.com/​Increase-Java-Memory-in-Windows-7|Java more memory]]. ​ I had to reboot for it to work. 
 + 
 +{{:​proton:​java_fix.jpg?​200|}} 
 + 
 + 
 +If that doesn'​t work, you can modify 01_HelloWorld\Makefile to add **-jvmopt=-Xmx1G** to the build commands, so in the end, it would look like this:
 <​code>​ <​code>​
 T01: check T01: check
Line 48: Line 83:
  rm -f hello.swf hello *.bc *.exe  rm -f hello.swf hello *.bc *.exe
 </​code>​ </​code>​
 +
 +But that's not a great solution, because later you really WILL need more memory when you compile debug mode versions of bugger stuff, it's a huge hog.
 +
 +=== Step 2: Compiling RTBareBones example ===
 +
 +  * Edit **RTBareBones/​flash/​app_info_setup.bat** with a text editor and change stuff to match your paths. ​ In the linux style paths (like **/​cygdrive/​d/​pro/​flascc/​sdk**) you would change only **d/​pro/​flascc/​sdk** to **c/​yourflashSDKdir/​sdk** (if you were on drive c) and not change the /cygdrive part, as you need that.
 +  * Double click BuildRelease.bat.
 +  * If it works, you will see RTBareBones.swf in the same directory. ​ You can run this in the standalone flash projector, OR, you can view it in your browser by clicking test1.html. ​ You CANNOT run the .swf directly in the browser, because it needs the .html setting that enables Stage3D. (This doesn'​t apply to the RTConsole example, as it doesn'​t use 3d stuff)
 +  * Same thing to compile the RTSimpleApp example
 +
 +
 +=== Step 3: How to add a Flash target to your existing Proton game ===
 +
 +  * Copy the /flash folder from RTSimpleApp into your own project
 +  * Use [[:​proton_vsrename|vsrename]] from inside the /flash directory and change RTSimpleApp to your app name
 +  * Edit the /​flash/​makefile with a text editor and add/remove the correct source file names
 +  * To change the render size of your .swf, change the SWF_SIZE setting in the makefile, and also change the two places the size appears in the test1.html file.
 +  * Look at App.cpp in RTSimpleApp and notice a subtle change to the audio init - it now uses "new AudioManagerFlash",​ which solved a weird problem of AudioManager'​s virtuals not being overriden, I assume because the latest Flascc has some errors when certain kinds of vars are initialized earlier than it wants them to be.
 +  * That should be it!  If you have nonstandard media folders to copy from, you can fix it by editing build_prepare.bat
  
 ===Misc Notes & Gotchas=== ===Misc Notes & Gotchas===
 +  * -O4, the best Flascc G++ optimization setting has weird freezes making it useless. ​ I've heard rumors this happens because exceptions are used and the next Flash player will fix it.  Until then, I've setup RTSimpleApp to use -O3, but it does make the .swf 35% bigger
 +  * Non pod globals that get intialized right away act funky in some cases. ​ Something to do with order of init?  Especially classes with virtual functions. ​ So try to only init stuff in classes and such, instead of globals where you don't control when the init happens.
   * Don't try to rename Console.as, the default preloader that Adobe ships hardcodes this name, we'd better keep it.  (At first I tried to rename it FlashMain.as,​ bad idea..)   * Don't try to rename Console.as, the default preloader that Adobe ships hardcodes this name, we'd better keep it.  (At first I tried to rename it FlashMain.as,​ bad idea..)
   * shared/​flash/​app/​flash/​Console.as is the normal one, shared/​flash/​app/​flash/​RTConsoleVersion/​Console.as is a special version that just does console output, no Stage3D or audio support, the RTConsole example uses it   * shared/​flash/​app/​flash/​Console.as is the normal one, shared/​flash/​app/​flash/​RTConsoleVersion/​Console.as is a special version that just does console output, no Stage3D or audio support, the RTConsole example uses it
   * If you get reference errors in release builds you need to add the names of those functions to your project/​flash/​export.txt file.  This will stop them from getting stripped out.   * If you get reference errors in release builds you need to add the names of those functions to your project/​flash/​export.txt file.  This will stop them from getting stripped out.
   * printf will act like LogMsg, both will go to debug output   * printf will act like LogMsg, both will go to debug output
-  * Some MSVC examples have a Flash GLES Debug profile setup, it compiles and renders with MSVC, but there is no video as it's all going through a crippled GLFlashAdaptor - you can't see anything, but it's useful to me for debugging and seeing which GLES things aren't handled yet. 
   * Only 128kz stereo mp3 audio is supported   * Only 128kz stereo mp3 audio is supported
-  * SetVolume, SetPan, IsPlaying ​on AudioManagerFlash not implemented+  * The SetVolume, SetPan, ​and IsPlaying ​functions in AudioManagerFlash ​are not implemented
   * Not all GL functions supported   * Not all GL functions supported
-  * Only one light is supported and it must be ambient+  ​* Some MSVC examples have a Flash GLES Debug profile setup, it compiles and renders with MSVC, but there is no video as it's all going through a crippled GLFlashAdaptor - you can't see anything, but it's useful to me for debugging and seeing which GLES things aren't handled yet. 
 +  ​* Only one GL light is supported and it must be ambient
   * LaunchURL works, but only when loading the swf from a real website, otherwise you get a security error   * LaunchURL works, but only when loading the swf from a real website, otherwise you get a security error
-  * It's slow.. I get 60 fps but only because I have a top of the line machine.. there are many optimizations I can still make, especially in the GLES1Adaptor ​code.+  * It's slow.. I get 60 fps but only because I have a top of the line machine.. there are many optimizations I can still make, especially in the GLESAdaptor ​code, I'm going to try to replace it with Adobe'​s GLStage3D stuff as well and see how that does 
 +  * Compiling is slowish make -j7 for more threads doesn'​t seem to do anything. ​ Release builds are slow * 100. 
 +  * I get Java memory errors if I try to compile a full -g debug version of the larger examples (RTSimpleApp) even with trying to hack everything to use 4gb of java memory, it just won't work.  So RTSimpleApp doesn'​t include the -g switch 
 +  * You can do full GDB debugging with this - edit BuildDebug.bat and change **set RUN_GDB_DEBUGGER=0** to 1
  
  
  
proton/flash_setup.1355234911.txt.gz · Last modified: 2012/12/11 14:08 by seth