Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a 2D Tiled Engine in Unity

Building a 2D Tiled Engine in Unity

Talk given at CodeStock 2014

62d40699d57955829bf57bf2240892bd?s=128

Michael C. Neel

July 12, 2014
Tweet

Transcript

  1. Building a 2D Tile Engine in Unity by Michael C.

    Neel @vinull / vinull.com
  2. What is this talk?

  3. Unity 4.5 – A New Hope …Lost

  4. What is a 2D Tile Engine?

  5. What is a 2D Tile Engine?

  6. What is a 2D Tile Engine?

  7. Background

  8. Tiled and XTiled

  9. Unity Options Few free and Open Source Only basic support

    Limited map size
  10. UTiled Project Goals All Features of Tiled No Size Limit

    Modifiable (destructible environments) “The Unity Way”
  11. The Unity Way Prefabs for Layers Scriptable Objects Unity 4.3

    – Sprites and Spritesheets Colliders from Polygons Editor UI
  12. What a mesh! Sprite object have high overhead “Pixel Perfect”

    Physics issues better in 4.5, but still some remain No Zlib or Gzip compression support in Unity’s Mono Cannot access source image before import processor
  13. M*E*S*H Geometry is painless

  14. M*E*S*H Geometry is painless

  15. 1 (0,0,0) 3 (1,1,0) 4 (0,1,0) 2 (1,0,0) V[] =

    (0,0,0), (1,0,0), (1,1,0), (0,1,0) M*E*S*H Geometry is painless
  16. 1 3 4 2 1 2 1 = 1, 3,

    4 2 = 1, 2, 3 T[] = 1, 3, 4, 1, 2, 3 M*E*S*H Geometry is painless
  17. 1 3 4 2 M*E*S*H Geometry is painless (0,0) (1,1)

    (0,1) (1,0) 0.167 UV[] = (0, 0), (0, 0.125), (0.167, 0.125), (0.167, 0)
  18. M*E*S*H Geometry is painless 3 8 10 13 3

  19. Demos! 1. Draw a circle 2.Draw the rest of the

    owl
  20. The Technology Cooperative techco.org speakerdeck.com/vinull Michael.neel@gmail.com vinull.com @ViNull