68
Архитектура современных 3D движков Vitaliy Borodovsky Технический директор мобильного подразделения Wargaming

Wargaming.net: Архитектура современных 3D движков

Embed Size (px)

DESCRIPTION

Доклад будет рассказывать о современных подходах проектирования ПО. Основной темой будет построение компонентных архитектур на примере архитектуры сцены 3D движка. Будет рассмотрен классический объектно-ориентированный подход организации сцены, его плюсы и минусы, и в качестве альтернативы будет показан компонентно ориентированный подход организации сцены. Доклад позволит слушателям понять, как разрабатывать сложные системы, которые впоследствии можно легко поддерживать.

Citation preview

  • 1. 3D Vitaliy Borodovsky Wargaming

2. , 3. 4. 5. 6. - PC Windows Mac OS Mobile iOS Android Windows Mobile Previous generationconsoles PS3 XBox 360 Current generationconsoles PS4 XBox 1 7. GPU CPU GPU API CPU , 8. OperationSystemsGraphics APIsCPUWindows XPDirectX 9HardwareARMx86PPCGPUAMDnVidiaIntelSoC GPUPowerVRMaliAdrenoTegraDirectX 11OpenGL & ESMetalMantlePS4 APIDX 12OpenGL 5????Windows 7,8Windows 10Mac OS XiOSAndroidAPIsWindows Phone* 3-7 9. 10. Unity UE4! ? 11. - , 12. Unity , : C# - , , , . - ! 13. UE4 C++ , 5% royalty from gross revenue , UE3 14. JIT , CPU 15. C 16. 2011 Unity , 3D , 95% 1- 2 17. 18. Tools (2011-2012) UI undo-redo copy-paste ! 19. 20. Data-driven - 21. C++ Qt Tools - UI WinForms - C#, 22. Cross-platform Main focus is iOS & Android Support from low-end to high-end mobile devices PC & Mac Focus on support of low-end PC & Mac withembedded video cards Big market Maximum usage of the hardware 23. , , , 24. ! . 25. 26. Tools , ? Data-driven UI 27. Data-driven UI Reflection / Introspection UI 28. ? 29. API C 30. - 31. SceneNodeRenderNodeLODNodeOtherNodeMatrix4 localTransform;Matrix4 worldTransform;Vectorchildren;virtual void Update()virtual void Draw() ? ! 32. - a programming paradigm that uses "objects" datastructures consisting of datafields and methodstogether with their interactions to design applicationsand computer programs. (Wikipedia) Includes features such as Inheritance 33. blackbox 34. , , ? 35. ? , 36. C++ 1979 1998 2003 2011 , : ++ CPU 37. CPU 38. CPU / Memory 39. 1979? 1980 - RAM latency - 1 2010 - RAM latency - 400 * 2 - 4 2014 - RAM latency - 400-600 cycles * 4-8 400-600 ? 40. ! , , , , ? 41. ? ? ! 42. , , virtual Update(), virtual Draw(), virtual Anything() ++ 43. BaseNodeJointNodePhysicalNodeCollisionNodeRenderNodeContainerNodeLODNodeSwitchNodeSoundNodeVehicleNodeScriptNodeSkinnedNode ? AnimationNode - , Physics, Collision, ScriptAnimationNode TransformNode 44. ??BaseNodeJointNodePhysicalNodeCollisionNodeSkinnedNodeRenderNodeContainerNodeLODNodeSwitchNodeSoundNodeVehicleNodeScriptNodeAnimationNodeTransformNode? 45. BaseNodeAnimationCollisionPhysicsScriptetcJointNode VehicleNodePhysicalNodeSkinnedNodeRenderNodeContainerNodeLODNodeSwitchNodeSoundNode TransformNode Update 46. 5000 , (8 ms iPad2) if (flags & NODE_REQUIRE_UPDATE)return; 11,111 , (4ms PS3) 2-4 , vtbl, flags 47. , , , 48. Data-driven paradigm - in which the program statements describethe data to be matched and the processing required rather thandefining a sequence of steps to be taken. Component-based paradigm It is a reuse-based approach to defining, implementing andcomposing loosely coupled independent components intosystems. : unix tools, 49. Data-driven TransformComponent RenderComponent LODComponent PhysicsComponent . For each transform in transformComponentArray Perform Transform For each renderComponent in renderComponentArray Call Render 50. , ? 51. Entity Entity - ID entity 52. ? virtual voidComponent::Process() , , , . -, ! 53. Entity-Component-System EntityIDComponents ComponentData *optional DataSystemSceneProcess all systems 54. ComponentsRenderTransformCollisionPhysicsAnimationScriptSoundParticleMoreSystemsRender Update System - update render system with info from othersTransformSystem - perform transformationsCollisionSystem - perform collisionsPhysics - calculate physicsAnimationSystem - system to transform animationsScriptSystem - system to perform scriptsSoundUpdateSystem - update positions from world to sound engineParticleUpdateSystem - update particle systemsUpdateSystem, OcclusionSystem, CullingSystem and many others 55. , (), , 56. ComponentsTransformComponentLookAtComponentSystemsTransformSystemLookAtSystem 57. ComponentsTransformComponentLookAtComponentEntity1SystemsTransformSystemLookAtSystemTransformComponentEntity2LookAtComponentEntity3TransformComponentEntity4LookAtComponent 58. ComponentsTransformComponentLookAtComponentEntity1SystemsTransformSystemLookAtSystemTransformComponentEntity2LookAtComponentEntity3TransformComponentEntity4LookAtComponent 59. ComponentsTransformComponentLookAtComponentEntity1SystemsTransformSystemLookAtSystemTransformComponentEntity2LookAtComponentEntity3TransformComponentEntity4LookAtComponent 60. Dependency Manager , , Process , . TransformComponent, LookAtComponent - TransformSystem- . LookAtSystem Process TransformSystem 61. Artemis http://gamadu.com/artemis/tutorial.html T-machine blog http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/ Stack overflow links: http://stackoverflow.com/questions/1901251/component-based-game-engine-design DAVA Framework https://github.com/dava/dava.framework 62. , ?? ? 63. , 64. , SceneGraph Entity Component System , JOB- multithreading , , 65. 66. Launcher Similar to Tanks Game Launcher List of tools with latest versions Stable versions updated automatically Artists are happy! Because they always have latestversion. 67. !?