flash gamm 2011,"stage3d survival guide"

45
Stage3D Survival Guide: Руководство по выживанию: Choosing the fittest Flash 3D engine on earth for your AAA game. By Michael Ivanov.

Upload: michael-ivanov

Post on 05-Dec-2014

3.759 views

Category:

Technology


1 download

DESCRIPTION

My session on Stage3D powered engines."FlashGAMM,Kiev Ukraine 10/12/2011 .

TRANSCRIPT

  • 1. Stage3D Survival Guide: :Choosing the fittest Flash 3D engine on earth for your AAA game. By Michael Ivanov.
  • 2. About Me. .
  • 3. Ivanov Michael,31,Israel. Lead Programmer R&D,Neurotech Solutions LTD and Geek. The Author of Away3D 3.6 Cookbook by Packt Publishing. Spare Time:Stage3D,Unity,UnrealEngine,OpenGL. Visit my tech blog:http://blog.alladvanced.net
  • 4. About you. .
  • 5. The problem. .
  • 6. Available Stage3D powered frameworks. Stage3D.
  • 7. 3D Engines. Alternativa3D-free,binary distribution. Flare3D-commercial,binary distribution. Away3D-free,open source. Yogurt3D-free,open source. Noob3D-commercial,binary distribution. Proscenium-free,open source by Adobe. Minko-free,open source. ND3D-free,open source. And some more
  • 8. 2D Engines ND2D-free,open source. Starling Framework-free , open source. M2D(Discontinued?)-free , open source.
  • 9. Particle Engines FLINT Particles-robust particle engine .Free, open source. ND2D basic particles system.Free,open source. Starling-basic particles system.Free,open source. Flint demo
  • 10. 3D Engines: Which is the best? ?
  • 11. None! !
  • 12. Each one wins or looses in one or more of these categories: : Performance.(.) Features. () Learning Curve.( ) Productiveness.() Customization.( ) Support. ( ) Costs.()
  • 13. Performance..
  • 14. Away3D Alternativa3D Flare3DPerformance demo
  • 15. 907200 Triangles160140 135 118 115120100 FPS NL FPS 2LS80 RAM60 52.5 SIZE 49.5 40 3740 29.5 30.1 29.5 26 23.520 0 Away3D Flare3D Alternativa3D Skin performance demo
  • 16. Features..
  • 17. Basic system modules in a typical 3D engine: External assets handling. Lightning system. Rendering system. Materials library & composing tools. Primitives library. Physics, AI, Particle engines. Network. GUI
  • 18. External assets handling Away3D Alternativa3D Flare3D Geometry Formats3DS Yes Yes NoNative AWD1,AWD2 A3D F3DCollada No Yes YesBones MD5.MD2 Collada F3D,ColladaNative Maya ,Blender 3Ds Max only 3Ds Max onlyplugin
  • 19. Lightning system Away3D Alternativa3D Flare3DDirectional Yes Yes YesPoint(Omni) Yes Yes YesSpot No Yes NoAmbient No Yes Yes
  • 20. Material Library Away3D Alternativa3D Flare3DWireframe Yes Yes NoColor Yes Yes YesBitmap Yes Yes YesEnvironment Yes ? YesVideo Yes Yes YesAnimated Yes Yes YesMulti-material ? Yes YessurfacesCustom Shaders AGAL AGAL FLSL Filters
  • 21. Geometry types Away3D Alternativa3D Flare3DCube Yes Yes YesSphere Yes Yes YesPlane Yes Yes YesCone Yes No YesCylinder Yes No YesCapsule Yes No NoLine Segments Yes Yes(via WireFrame) Yes (via Lines3D)Sprite Yes Yes NoAnimated Sprite Yes Yes No(via filter only)
  • 22. Physics,AI,Particles Away3D Alternativa3D Flare3DBuilt-in Away Bullet (alchemy) Under dev Under dev3td party JigLib JigLib JigLibAI AwaySteer(OpenSteer) under No No devParticles Native,FLINT FLINT,Native(under Native,FLINT dev?)
  • 23. Learning Curve. .
  • 24. Mastering a Flash 3D engine. 3D . The APIs follow the same basic 3D engine paradigm. Experience with the previous versions helps a lot. Previous game development and Math experience contribute to the learning process.
  • 25. Productiveness..
  • 26. Flare3D. Flare3D Studio (World editor IDE). FLSL GLSL like shader coding,AGAL free. For Dummies like API.
  • 27. Flare3D Studio IDE Character model by courtesy of Roman Zinchenko http://www.wix.com/zinche/zraFlare Studio demo
  • 28. Flare3D Shading Language FLSL =AGAL Abstraction. GLSL/CG look.
  • 29. OpenGL 3.3 GLSL Flare3D V2 FLSL #version 330 layout(location = 0) in vec4 position; layout(location = 1) in vec4 color; < namespace:"flare", name:"TextureFilter" > smooth out vec4 theColor; uniform vec3 offset; public texture "texture"; uniform mat4 perspectiveMatrix; public float1 alpha = 1; input UV0 uv0; void main() interpolated float4 iUV; { vec4 cameraPos = position + vec4(offset.x, offset.y, offset.z, 0.0); private void vertex0() gl_Position = perspectiveMatrix * cameraPos; { theColor = color; iUV = uv0; } } private float4 fragmentTexture0() { return sample( "texture", iUV.xy, "2d,repeat,linear,miplinear" ) * alpha; } #version 330 smooth in vec4 theColor; technique main" { out vec4 outputColor; vertex vertex0(); fragment fragmentTexture0(); void main() } { outputColor = theColor; }FLSL Demos
  • 30. Code Modularity. . Alternativa3D vs Flare3D Skin Animation set up code samplesprivate function loadModel():void{ private function loadModel():void{ var loaderCollada:URLLoader = new URLLoader(); model = scene.addChildFromFile( loaderCollada.dataFormat = "assets/spyAnim.f3d,scene);URLLoaderDataFormat.TEXT; scene.addEventListener( Scene3D.COMPLETE_EVENT, loaderCollada.load(new completeEvent );URLRequest("assets/SpyAnimCollada.DAE")); } loaderCollada.addEventListener(Event.COMPLETE, private function completeEvent(e:Event):voidonColladaLoad); {} scene.resume(); model.play();private function onColladaLoad(e:Event):void { } var parser:ParserCollada = new ParserCollada(); parser.parse(XML((e.target as URLLoader).data),"assets/"); var mesh:Skin = parser.getObjectByName("spy") asSkin; mesh.y =0; container.addChild(mesh); var animSwtich:AnimationSwitcher=newAnimationSwitcher(); var animClip:AnimationClip=parser.animations[0]; var animAll:AnimationClip=animClip.slice(0,870/30); animContr=new AnimationController(); animContr.root=animSwtich; for each (var resource:Resource inscene.getResources(true)) { resource.upload(stage3D.context3D); }}
  • 31. Away3D. Compact API ,but not like Flare3D. Prefab3D- Visual IDE V2 .still under development. Away3D 3x users benefit from smooth portability.
  • 32. Customization. .
  • 33. Open Source is the winner! Flare3D loans engines source code for payment. Alternativa3D -?Kinect demo
  • 34. Away3D core adjustments example Vector3D to screen fix:Adding code to lens:public function projectToScreenSpace(point3d:Vector3D,screenW:Number,screenH:Number):Point{ var p:Point=new Point(); var v:Vector3D=matrix.transformVector(point3d); p.x=((v.x*screenW)/(2*v.w))+screenW*0.5; p.y=(-(v.y*screenH)/(2*v.w))+screenH*0.5; return p;}Adding code to Camera3D:public function projectToScreen(point3d : Vector3D,screenW:Number,screenH:Number) : Point{return lens.projectToScreenSpace(inverseSceneTransform.transformVector(point3d),screenW,screenH);}Using:var screenPoint:Point=_view.camera.projectToScreen(sp.position,_view.width,_view.height);
  • 35. Technical Support. .
  • 36. Away3D has much larger community and learning materials like books and tutorials , than others. Four books dedicated to Away3D development. Away3D and Flare3D-both supply professional support for payment.
  • 37. Costs..
  • 38. Some out-of-the-Flash thoughts. .
  • 39. Conclusion. .
  • 40. Away3D = Features .()Alternativa3D = Industrial Quality.( )Flare3D = Ease of Use.( )
  • 41. But what really matters - ...
  • 42. Determination to make a great game! !
  • 43. Thank you! !