Making a game with Molehill: Zombie Tycoon Jean-Philippe Auclair Lead R&D Software Architect Luc Beaulieu CTO – Frima Studio.

Slides:



Advertisements
Similar presentations
Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
Advertisements

Using 2D sprite with OpenGL 2003 team Koguyue. Overview Motivation and basic concepts Advantages with using OpenGL Basic requirements of implementation.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
GlTF and rest3d Patrick Cozzi University of Pennsylvania CIS Fall 2013.
Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless)
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Prepared 5/24/2011 by T. O’Neil for 3460:677, Fall 2011, The University of Akron.
Week 11 - Wednesday.  Image based effects  Skyboxes  Lightfields  Sprites  Billboards  Particle systems.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
I3D Fast Non-Linear Projections using Graphics Hardware Jean-Dominique Gascuel, Nicolas Holzschuch, Gabriel Fournier, Bernard Péroche I3D 2008.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
Computer Graphics Hardware Acceleration for Embedded Level Systems Brian Murray
Morphing and Animation GPU Graphics Gary J. Katz University of Pennsylvania CIS 665 Adapted from articles taken from ShaderX 3, 4 and 5 And GPU Gems 1.
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408, University of Illinois, Urbana-Champaign 1 Programming Massively Parallel Processors Chapter.
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
AGD: 5. Game Arch.1 Objective o to discuss some of the main game architecture elements, rendering, and the game loop Animation and Games Development.
Sprite Batching and Texture Atlases Randy Gaul. Overview Batches Sending data to GPU Texture atlases Premultiplied alpha Note: Discussion on slides is.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
© Copyright Khronos Group, Page 1 Harnessing the Horsepower of OpenGL ES Hardware Acceleration Rob Simpson, Bitboys Oy.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
What is ? Open Graphics Library A cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is used to interact with a Graphics.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Tutorial 6 Working with Bitmaps and Gradients, and Publishing Flash Files.
Interactive Rendering of Meso-structure Surface Details using Semi-transparent 3D Textures Vision, Modeling, Visualization Erlangen, Germany November 16-18,
The Graphics Rendering Pipeline 3D SCENE Collection of 3D primitives IMAGE Array of pixels Primitives: Basic geometric structures (points, lines, triangles,
OpenGL ES Performance (and Quality) on the GoForce5500 Handheld GPU Lars M. Bishop, NVIDIA Developer Technologies.
STARLING FRAMEWORK. It is a Actionscript 3 Framework. Used to Built 2D Games. Built on top of Stage 3D. Port of Sparrow Framework from iOS. STARLING FRAMEWORK.
Games Games GAMES. About Me:  Ariel Nehmad.  I’m 31 years old.  Live in Buenos Aires, Argentina.  CTO and father of Flare3D, FLSL and Flare3D Phys…
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
1 Real-time visualization of large detailed volumes on GPU Cyril Crassin, Fabrice Neyret, Sylvain Lefebvre INRIA Rhône-Alpes / Grenoble Universities Interactive.
Realtime NPR Toon and Pencil Shading Joel Jorgensen May 4, 2010.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
2009 GRAPHICS : PROJECT 1 BASED ON DX9 BASICS. Documented by Dongjoon Kim SNU CS Ph.D Course Student Contact : NOTE.
Havok FX Physics on NVIDIA GPUs. Copyright © NVIDIA Corporation 2004 What is Effects Physics? Physics-based effects on a massive scale 10,000s of objects.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Advanced techniques for the development of 2D Windows 8 games using Direct X and C++ Markus Jost CEO, Lead Programmer, Codebox GmbH
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
Edison Gao 主讲人:高原. GameFinal A Next-Gen 3D Game Engine Edison Gao.
Mesh Skinning Sébastien Dominé. Agenda Introduction to Mesh Skinning 2 matrix skinning 4 matrix skinning with lighting Complex skinning for character.
DX10, Batching, and Performance Considerations Bryan Dudash NVIDIA Developer Technology.
Advanced D3D10 Shader Authoring Presentation/Presenter Title Slide.
Postmortem: Deferred Shading in Tabula Rasa Rusty Koonce NCsoft September 15, 2008.
2014 Animation Programming for Music Video Games Jessica Scott Harmonix Music Systems, Inc. October 10, 2014 #GHC
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
- Introduction - Graphics Pipeline
Ying Zhu Georgia State University
CUDA Interoperability with Graphical Environments
Week 11 - Wednesday CS361.
Advanced Graphics Algorithms Ying Zhu Georgia State University
Graphics Processing Unit
Deferred Lighting.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Understanding Theory and application of 3D
Graphics Processing Unit
UMBC Graphics for Games
3D applications in Delphi
Desktop Window Manager
RADEON™ 9700 Architecture and 3D Performance
Emerging Technologies for Games Review & Revision Strategy
CIS 6930: Chip Multiprocessor: GPU Architecture and Programming
Presentation transcript:

Making a game with Molehill: Zombie Tycoon Jean-Philippe Auclair Lead R&D Software Architect Luc Beaulieu CTO – Frima Studio

Session Overview State of Flash Molehill’s API presentation Digging deeper into Molehill

State of Flash Is Flash Dead? FB: Top 10 = 250M MAU Desktops: Flash 10 installed on 99%+ SmartPhones: Flash/Air 200+M, 100 devices Streaming: 120 petabytes per month Advances in Flash for 3D games AS3 10.1, 10.2 … Molehill

Molehill’s API Presentation Pros: – GPU Accelerated API – Relies on DirectX 9 and OpenGL ES 2.0 – Native Software fallback Cons: – No point sprite support, branching, MRT, depth buffer – No CPU threading support – Native Software fallback

This Page Intentionally Left Green

Digging deeper into Molehill Assuming a basic knowledge of 3D development terminology Display Layers Model/Animation File Format Character Animation: Matrix vs Quaternion Texturing Optimizing the Particle System Fast Lights & Shadows CPU Post-Processing effects Profiling & Debugging tools Bonus! – The math explaining all the numbers I’m going to talk about – Cheat sheets

Display Layers

Frima 3D File Format Many 3D engines for flash try to support multiple input format …Or support only generic format such as ColladaXML Using a format optimized for 3D game made in Flash – Small File Size – Small Memory footprint – No processing required

Frima 3D File Format Collada XML 3DS Max Scene Max Script Exporter Build Tool Export pipeline

Frima 3D File Format Model / Animation Build Tool Game Object Serialize (AMF) Compress Game File Export pipeline

Add To Scene Frima 3D File Format Game Object Uncompress Unserialize Game File In-Game usage

Zombie Re-Animation Techniques – Matrix linear blending – DualQuaternion linear blending Molehill Constraint – Vertex Shader constants limits: 128 Float4 Zombie: 24 bones

Animation techniques Matrix linear blending can cause loss of volume when joints are twisted or extremely bent When using matrix, each bone take 3 constants – Maximum number of bones is 40 When using DualQuats, each bone take only 2 constants – Maximum number of bones is 60 Matrix (left) / Dual Quaternion (Right)

Transitions & interpolation Too Much Animation transition require two sets of bones Idle blending to walk Same thing for frame interpolation (ex: Bullet time Animation)

File size? Performance?

Texturing in Molehill

The first version of the engine was only using PNGs Adobe Texture Format (ATF) – Texture are kept compressed in Video Memory – Native support for multi-device publishing – One file containing 3 encoding: DXT1, ETC1 and PVRTC – 1.3x bigger than original PNG – Contain the MipMapping of the texture – Does not support transparency

Texturing in Molehill Transparency – Use PNGs with indexed color – Sample a “alpha mask texture” in the pixel shader ATF Avatar = opaque ATF Avatar = opaque PNG Fence = Transparent PNG Fence = Transparent

Texturing in Molehill Many effects can use ATF when using the good blend modes No need for transparency Splatter = Multiply Fire = Additive

Particle System Using a divided workload (CPU/GPU) for better performance – Each particle property update is computed on the CPU at each frame Alpha, Color, Direction, Rotation, frame(If SpriteSheet), etc. – On the GPU Applying theses properties Expending billboard vertex to face the screen

Particle System : Optimization How many particle? – Due to the VertexBuffer and IndexBuffer limits, – In ZombieTycoon we were limited to around particles per draw call Using Fast ByteArray (also known as Alchemy memory or DomainMemory) – Using Azoth, properties updates were 10 times faster Batching draw calls using the same texture Using a 100% GPU particle system – It’s expensive on the GPU – Support only linear transformation – Zero CPU required

Particle System

Lights & shadows Techniques – ShadowMap & LightMap – Dynamic lighting – Fake Volumetric lights – Fake projected shadows

Lights & shadows ShadowMap & LightMap – We used two textures, a “multiplied” ShadowMap and an “additive” LightMap Diffuse * ShadowMap + Lightmap = Composite

Lights & shadows Dynamic lighting – Lighting required expensive pixel shader, currently limited to 256 instructions – Zombie Tycoon support up to 7-9 lights (spot or points) per object.

Lights & shadows Pixel Shader assembly code – Per light, without Normal/Specular mapping.

Lights & shadows Fake Volumetric Lights – Using a few billboard particles, it’s easy to fake a nice and lightweight volumetric lighting – All object are sampling Shadow and light maps, and since the light particles are “additive”, if an object is behind the lights, it will look brighter

Lights & shadows

Fake projected shadows – We created a particle of a gradient black spot aligned to the ground – Orientation and scale of the particle depends on light position and intensity

CPU Post-Processing Possibility of reading the BackBuffer – Strongly recommended not to use Readback – Fast pipeline for data from the System memory to Video memory – VERY slow pipeline from video to system memory Effects: Bloom, Blur, Depth of Field, etc. Motion Blur

CPU Post-Processing Bloom post-processingNormal

Profiling and Debugging tools (CPU) FlashDevelop (O.S.S.) – Most of the production is using FlashDevelop – Now with a profiler and a debugger, it’s very easy to work with it

Profiling and Debugging tools (CPU) Adobe Flash Builder Profiler – Profile Function calls – Profile Memory allocation

Profiling and Debugging tools (CPU) FlashPreloadProfiler (O.S.S.) – Profile Function calls – Profile Memory allocation – Profile Loaders status – Can be used in Debug/Release & browser/Projector

Profiling and Debugging tools (GPU) Pix for windows – List of API calls – Shaders assembly code – Pixel debugger – Texture viewer

Profiling and Debugging tools (GPU) Intel® Graphics Performance Analyzers (GPA) – Render in wireframe – Profile Vertex and Pixel shader performance – Visualize overdraw and draw call sequence – Save a frame, and make real-time experiment – Identification of bottlenecks

Sources & References Geometric Skinning with Approximate Dual Quaternion Blending – Intel® Graphics Performance Analyzers (GPA) – Pix for windows – Contact Luc Beaulieu Jean-Philippe Auclair  jpauclair.net TD-Matt blog FlashPreloadProfiler Azoth Flash in Facebook AppData.com Flash Stats

Bonus Slide: The maths! Character animation: – Matrix linear blending: 128 Float4 VertexConstant – WorldMatrix – ViewProj matrix = 120Float4 120Float4 / / 3Float4 per bone = 40 bones in the constants Bullet time and transitions require two sets of bones: 40/2 = 20 bones per character max – DualQuaternion linear blending: 128 Float4 VertexConstant – WorldMatrix – ViewProj matrix = 120Float4 120Float4 / / 2Float4 per bone = 60 bones in the constants Bullet time and transitions require two sets of bones: 60/2 = 30 bones per character max Max Particle Count – The VertexBuffer is limited to vertex, the IndexBuffer is limited to index of type SHORT – In theory, you could have up to triangle in one draw call – In practice, with no vertex re-use between particles and using quads (4 vertex): 65536/6 = particle max per draw call Lighting – With the PixelShader limit of 256 instructions, we were able to fit around 7 to 9 dynamic lights per object (point or spot light)

Achievement: Geek Cheat Sheet

Achievement: Super Geek!

Contact Luc Beaulieu Jean-Philippe Auclair  jpauclair.net Thank You! Questions?