Your SlideShare is downloading. ×

Adventures In Data Compilation

633

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
633
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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!
  • 10. Architecture
  • 11. Architecture
  • 12. Architecture
  • 13. Architecture
  • 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

×