Adventures In Data Compilation

918
-1

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
918
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Adventures In Data Compilation

  1. 1. Adventures in Data Compilation Uncharted: Drake’s Fortune Dan Liebgold Naughty Dog, Inc. Santa Monica, CA Game Developers Conference, 2008
  2. 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. 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. 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. 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. 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. 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. 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. 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!
  10. 10. Architecture
  11. 11. Architecture
  12. 12. Architecture
  13. 13. Architecture
  14. 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. 15. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  16. 16. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  17. 17. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  18. 18. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  19. 19. Start with some types (deftype vec4 (:align 16) ((x float) (y float) (z float) (w float :default 0) ) )
  20. 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. 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. 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. 23. Types continued (deftype quaternion (:parent vec4) ()) (deftype point (:parent vec4) ((w float :default 1) )) struct Locator { Point m_trans; Quaternion m_rot; };
  24. 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. 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. 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. 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. 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. 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. 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. 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

×