SlideShare a Scribd company logo
Adventures in Data Compilation
    Uncharted: Drake’s Fortune


           Dan Liebgold

           Naughty Dog, Inc.
           Santa Monica, CA


 Game Developers Conference, 2008
Motivation


      Code is compiled, data is “built”
      What should be code, what should be data? Plenty, right?
          Game logic, geometry, textures...
      What is not clearly either?
          Particle definitions, animation states & blend trees, event &
          gameplay scripting/tuning, more...
Motivation


      Code is compiled, data is “built”
      What should be code, what should be data? Plenty, right?
          Game logic, geometry, textures...
      What is not clearly either?
          Particle definitions, animation states & blend trees, event &
          gameplay scripting/tuning, more...
Motivation


      Code is compiled, data is “built”
      What should be code, what should be data? Plenty, right?
          Game logic, geometry, textures...
      What is not clearly either?
          Particle definitions, animation states & blend trees, event &
          gameplay scripting/tuning, more...
Motivation


      Code is compiled, data is “built”
      What should be code, what should be data? Plenty, right?
          Game logic, geometry, textures...
      What is not clearly either?
          Particle definitions, animation states & blend trees, event &
          gameplay scripting/tuning, more...
Motivation


      Code is compiled, data is “built”
      What should be code, what should be data? Plenty, right?
          Game logic, geometry, textures...
      What is not clearly either?
          Particle definitions, animation states & blend trees, event &
          gameplay scripting/tuning, more...
The in between stuff


      Moving on from GOAL
      Lisp supports the code/data duality
      We will build DC in Scheme, a dialect of LISP!
The in between stuff


      Moving on from GOAL
      Lisp supports the code/data duality
      We will build DC in Scheme, a dialect of LISP!
The in between stuff


      Moving on from GOAL
      Lisp supports the code/data duality
      We will build DC in Scheme, a dialect of LISP!
Architecture
Architecture
Architecture
Architecture
Example




  Let’s define a player start position:
  (define-export *player-start*
   (new locator
        :trans *origin*
        :rot (axis-angle->quaternion *y-axis* 45)
        ))
Start with some types




   (deftype vec4 (:align 16)
     ((x float)
      (y float)
      (z float)
      (w float :default 0)
      )
     )
Start with some types




   (deftype vec4 (:align 16)
     ((x float)
      (y float)
      (z float)
      (w float :default 0)
      )
     )
Start with some types




   (deftype vec4 (:align 16)
     ((x float)
      (y float)
      (z float)
      (w float :default 0)
      )
     )
Start with some types




   (deftype vec4 (:align 16)
     ((x float)
      (y float)
      (z float)
      (w float :default 0)
      )
     )
Start with some types




   (deftype vec4 (:align 16)
     ((x float)
      (y float)
      (z float)
      (w float :default 0)
      )
     )
Start with some types

   (deftype vec4 (:align 16)
     ((x float)
      (y float)
      (z float)
      (w float :default 0)
      )
     )
   struct Vec4
   {
     float m_x;
     float m_y;
     float m_z;
     float m_w;
   };
Types continued


  (deftype quaternion (:parent vec4)
   ())

  (deftype point (:parent vec4)
   ((w float :default 1)
    ))
  (deftype locator ()
   ((trans point :inline #t)
    (rot quaternion :inline #t)
    )
   )
Types continued


  (deftype quaternion (:parent vec4)
   ())

  (deftype point (:parent vec4)
   ((w float :default 1)
    ))
  (deftype locator ()
   ((trans point :inline #t)
    (rot quaternion :inline #t)
    )
   )
Types continued


  (deftype quaternion (:parent vec4)
   ())

  (deftype point (:parent vec4)
   ((w float :default 1)
    ))
  struct Locator
  {
    Point m_trans;
    Quaternion m_rot;
  };
Define a function



  (define (axis-angle->quat axis angle)
   (let ((sin-angle/2 (sin (* 0.5 angle))))
    (new quaternion
         :x (* (-> axis x) sin-angle/2)
         :y (* (-> axis y) sin-angle/2)
         :z (* (-> axis z) sin-angle/2)
         :w (cos (* 0.5 angle))
         )))
Define a function



  (define (axis-angle->quat axis angle)
   (let ((sin-angle/2 (sin (* 0.5 angle))))
    (new quaternion
         :x (* (-> axis x) sin-angle/2)
         :y (* (-> axis y) sin-angle/2)
         :z (* (-> axis z) sin-angle/2)
         :w (cos (* 0.5 angle))
         )))
Define a function



  (define (axis-angle->quat axis angle)
   (let ((sin-angle/2 (sin (* 0.5 angle))))
    (new quaternion
         :x (* (-> axis x) sin-angle/2)
         :y (* (-> axis y) sin-angle/2)
         :z (* (-> axis z) sin-angle/2)
         :w (cos (* 0.5 angle))
         )))
Define a function



  (define (axis-angle->quat axis angle)
   (let ((sin-angle/2 (sin (* 0.5 angle))))
    (new quaternion
         :x (* (-> axis x) sin-angle/2)
         :y (* (-> axis y) sin-angle/2)
         :z (* (-> axis z) sin-angle/2)
         :w (cos (* 0.5 angle))
         )))
Define some instances



  (define *y-axis* (new vec4 :x 0 :y 1 :z 0))
  (define *origin* (new point :x 0 :y 0 :z 0))

  (define-export *player-start*
   (new locator
        :trans *origin*
        :rot (axis-angle->quaternion *y-axis* 45)
        ))
Define some instances



  (define *y-axis* (new vec4 :x 0 :y 1 :z 0))
  (define *origin* (new point :x 0 :y 0 :z 0))

  (define-export *player-start*
   (new locator
        :trans *origin*
        :rot (axis-angle->quaternion *y-axis* 45)
        ))
How we use these definitions in C++ code



    ...
    #include "dc-types.h"
    ...
    const Locator * pLoc =
      DcLookupSymbol("*player-start*");
    Point pos = pLoc->m_trans;
    ...
Build upon this basis


   We build upon this basis to create many many things
       Particle definitions
       Animation states
       Gameplay scripts
       Scripted in-game cinematics
       Weapons tuning
       Sound and voice setup
       Overall game sequencing and control
       ...and more

More Related Content

PPTX
My favorite slides
PPTX
Introduction to c
PPTX
YUI Tidbits
PPTX
PDF
Oxygine 2 d objects,events,debug and resources
PDF
ECMAScript 6 and beyond
PPT
Lecture4
PDF
Зависимые типы в GHC 8. Максим Талдыкин
My favorite slides
Introduction to c
YUI Tidbits
Oxygine 2 d objects,events,debug and resources
ECMAScript 6 and beyond
Lecture4
Зависимые типы в GHC 8. Максим Талдыкин

What's hot (19)

PPTX
ES6(ES2015) is beautiful
PDF
PDF
Short intro to the Rust language
PPTX
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
PDF
Lambda expressions in C++
DOCX
Clase de matlab
PDF
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
PDF
Bind me if you can
PDF
Низкоуровневые оптимизации .NET-приложений
PDF
Python speleology
PDF
Torturing the PHP interpreter
PDF
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
PDF
Hidden Gems in Swift
PDF
ECMAScript 6 major changes
PPT
شرح مقرر البرمجة 2 لغة جافا - الوحدة الثالثة
PDF
The Macronomicon
PPT
شرح مقرر البرمجة 2 لغة جافا - الوحدة الرابعة
PPT
KEY
Objective-Cひとめぐり
ES6(ES2015) is beautiful
Short intro to the Rust language
TypeScript - All you ever wanted to know - Tech Talk by Epic Labs
Lambda expressions in C++
Clase de matlab
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Bind me if you can
Низкоуровневые оптимизации .NET-приложений
Python speleology
Torturing the PHP interpreter
Writing SOLID C++ [gbgcpp meetup @ Zenseact]
Hidden Gems in Swift
ECMAScript 6 major changes
شرح مقرر البرمجة 2 لغة جافا - الوحدة الثالثة
The Macronomicon
شرح مقرر البرمجة 2 لغة جافا - الوحدة الرابعة
Objective-Cひとめぐり
Ad

Viewers also liked (13)

PDF
Multiprocessor Game Loops: Lessons from Uncharted 2: Among Thieves
PDF
Amazing Feats of Daring - Uncharted Post Mortem
PDF
Creating A Character in Uncharted: Drake's Fortune
PDF
Uncharted Animation Workflow
PDF
Uncharted 2: Character Pipeline
PDF
The Technology of Uncharted: Drake’s Fortune
PDF
Practical Spherical Harmonics Based PRT Methods
PDF
Autodesk Mudbox
PDF
Lighting Shading by John Hable
PDF
SPU Optimizations-part 1
PDF
SPU Optimizations - Part 2
PDF
State-Based Scripting in Uncharted 2: Among Thieves
PDF
Naughty Dog Vertex
Multiprocessor Game Loops: Lessons from Uncharted 2: Among Thieves
Amazing Feats of Daring - Uncharted Post Mortem
Creating A Character in Uncharted: Drake's Fortune
Uncharted Animation Workflow
Uncharted 2: Character Pipeline
The Technology of Uncharted: Drake’s Fortune
Practical Spherical Harmonics Based PRT Methods
Autodesk Mudbox
Lighting Shading by John Hable
SPU Optimizations-part 1
SPU Optimizations - Part 2
State-Based Scripting in Uncharted 2: Among Thieves
Naughty Dog Vertex
Ad

Similar to Adventures In Data Compilation (20)

PDF
Abstracting Vector Architectures in Library Generators: Case Study Convolutio...
PDF
Soft Shake Event / A soft introduction to Neo4J
PDF
A Few of My Favorite (Python) Things
PDF
Gems of GameplayKit. UA Mobile 2017.
PDF
Continuation Passing Style and Macros in Clojure - Jan 2012
PDF
Developing High Performance Websites and Modern Apps with JavaScript and HTML5
PDF
DevFest Istanbul - a free guided tour of Neo4J
PDF
SVGo workshop
PDF
Python 2.5 reference card (2009)
PPTX
ES6 is Nigh
PDF
Swift for tensorflow
PDF
Need help with questions 2-4. Write assembly code to find absolute v.pdf
PDF
The best language in the world
PDF
The Curious Clojurist - Neal Ford (Thoughtworks)
PDF
XNA L04–Primitives, IndexBuffer and VertexBuffer
PDF
Clojure for Java developers - Stockholm
PDF
Леонид Шевцов «Clojure в деле»
PPTX
Fact, Fiction, and FP
PDF
Python과 node.js기반 데이터 분석 및 가시화
PDF
Building DSLs with Xtext - Eclipse Modeling Day 2009
Abstracting Vector Architectures in Library Generators: Case Study Convolutio...
Soft Shake Event / A soft introduction to Neo4J
A Few of My Favorite (Python) Things
Gems of GameplayKit. UA Mobile 2017.
Continuation Passing Style and Macros in Clojure - Jan 2012
Developing High Performance Websites and Modern Apps with JavaScript and HTML5
DevFest Istanbul - a free guided tour of Neo4J
SVGo workshop
Python 2.5 reference card (2009)
ES6 is Nigh
Swift for tensorflow
Need help with questions 2-4. Write assembly code to find absolute v.pdf
The best language in the world
The Curious Clojurist - Neal Ford (Thoughtworks)
XNA L04–Primitives, IndexBuffer and VertexBuffer
Clojure for Java developers - Stockholm
Леонид Шевцов «Clojure в деле»
Fact, Fiction, and FP
Python과 node.js기반 데이터 분석 및 가시화
Building DSLs with Xtext - Eclipse Modeling Day 2009

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
sap open course for s4hana steps from ECC to s4
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
sap open course for s4hana steps from ECC to s4
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
MIND Revenue Release Quarter 2 2025 Press Release
Mobile App Security Testing_ A Comprehensive Guide.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars

Adventures In Data Compilation

  • 1. Adventures in Data Compilation Uncharted: Drake’s Fortune Dan Liebgold Naughty Dog, Inc. Santa Monica, CA Game Developers Conference, 2008
  • 2. Motivation Code is compiled, data is “built” What should be code, what should be data? Plenty, right? Game logic, geometry, textures... What is not clearly either? Particle definitions, animation states & blend trees, event & gameplay scripting/tuning, more...
  • 3. Motivation Code is compiled, data is “built” What should be code, what should be data? Plenty, right? Game logic, geometry, textures... What is not clearly either? Particle definitions, animation states & blend trees, event & gameplay scripting/tuning, more...
  • 4. Motivation Code is compiled, data is “built” What should be code, what should be data? Plenty, right? Game logic, geometry, textures... What is not clearly either? Particle definitions, animation states & blend trees, event & gameplay scripting/tuning, more...
  • 5. Motivation Code is compiled, data is “built” What should be code, what should be data? Plenty, right? Game logic, geometry, textures... What is not clearly either? Particle definitions, animation states & blend trees, event & gameplay scripting/tuning, more...
  • 6. Motivation Code is compiled, data is “built” What should be code, what should be data? Plenty, right? Game logic, geometry, textures... What is not clearly either? Particle definitions, animation states & blend trees, event & gameplay scripting/tuning, more...
  • 7. The in between stuff Moving on from GOAL Lisp supports the code/data duality We will build DC in Scheme, a dialect of LISP!
  • 8. The in between stuff Moving on from GOAL Lisp supports the code/data duality We will build DC in Scheme, a dialect of LISP!
  • 9. The in between stuff Moving on from GOAL Lisp supports the code/data duality We will build DC in Scheme, a dialect of LISP!
  • 14. Example Let’s define a player start position: (define-export *player-start* (new locator :trans *origin* :rot (axis-angle->quaternion *y-axis* 45) ))
  • 15. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  • 16. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  • 17. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  • 18. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  • 19. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  • 20. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) ) struct Vec4 { float m_x; float m_y; float m_z; float m_w; };
  • 21. Types continued (deftype quaternion (:parent vec4) ()) (deftype point (:parent vec4) ((w float :default 1) )) (deftype locator () ((trans point :inline #t) (rot quaternion :inline #t) ) )
  • 22. Types continued (deftype quaternion (:parent vec4) ()) (deftype point (:parent vec4) ((w float :default 1) )) (deftype locator () ((trans point :inline #t) (rot quaternion :inline #t) ) )
  • 23. Types continued (deftype quaternion (:parent vec4) ()) (deftype point (:parent vec4) ((w float :default 1) )) struct Locator { Point m_trans; Quaternion m_rot; };
  • 24. Define a function (define (axis-angle->quat axis angle) (let ((sin-angle/2 (sin (* 0.5 angle)))) (new quaternion :x (* (-> axis x) sin-angle/2) :y (* (-> axis y) sin-angle/2) :z (* (-> axis z) sin-angle/2) :w (cos (* 0.5 angle)) )))
  • 25. Define a function (define (axis-angle->quat axis angle) (let ((sin-angle/2 (sin (* 0.5 angle)))) (new quaternion :x (* (-> axis x) sin-angle/2) :y (* (-> axis y) sin-angle/2) :z (* (-> axis z) sin-angle/2) :w (cos (* 0.5 angle)) )))
  • 26. Define a function (define (axis-angle->quat axis angle) (let ((sin-angle/2 (sin (* 0.5 angle)))) (new quaternion :x (* (-> axis x) sin-angle/2) :y (* (-> axis y) sin-angle/2) :z (* (-> axis z) sin-angle/2) :w (cos (* 0.5 angle)) )))
  • 27. Define a function (define (axis-angle->quat axis angle) (let ((sin-angle/2 (sin (* 0.5 angle)))) (new quaternion :x (* (-> axis x) sin-angle/2) :y (* (-> axis y) sin-angle/2) :z (* (-> axis z) sin-angle/2) :w (cos (* 0.5 angle)) )))
  • 28. Define some instances (define *y-axis* (new vec4 :x 0 :y 1 :z 0)) (define *origin* (new point :x 0 :y 0 :z 0)) (define-export *player-start* (new locator :trans *origin* :rot (axis-angle->quaternion *y-axis* 45) ))
  • 29. Define some instances (define *y-axis* (new vec4 :x 0 :y 1 :z 0)) (define *origin* (new point :x 0 :y 0 :z 0)) (define-export *player-start* (new locator :trans *origin* :rot (axis-angle->quaternion *y-axis* 45) ))
  • 30. How we use these definitions in C++ code ... #include "dc-types.h" ... const Locator * pLoc = DcLookupSymbol("*player-start*"); Point pos = pLoc->m_trans; ...
  • 31. Build upon this basis We build upon this basis to create many many things Particle definitions Animation states Gameplay scripts Scripted in-game cinematics Weapons tuning Sound and voice setup Overall game sequencing and control ...and more