SlideShare a Scribd company logo
Y-Tiles
iPhone Application
Chris Yunker
STL Mobile Dev Meeting
June 24, 2010
Why Y-Tiles?
• Simple, enjoyable game everyone understands
• Development touches a lot areas (graphics, touch
screen, camera, accelerometer, etc.)
Why The Name “Y-Tiles”?
• When I started development, there were already
over 25 implementations of this game
• I had to find a unique name so I added the first letter
of my last name
Development Details
• Hardware: iPhone 3G (16G)
• SDK: 2.2.1
• Development Time: 2-3 months
• Submitted to App Store: March 4, 2009
• Downloads: +2000 in last 26 weeks (according
to iTunes Connect App)
Fifteen Puzzle Game
The n-puzzle is known in various versions,
including the 8 puzzle, the 15 puzzle, and with
various names (Gem Puzzle, Boss Puzzle, Game of
Fifteen, Mystic Square and many others). It is a
sliding puzzle that consists of a frame of numbered
square tiles in random order with one tile missing.
If the size is 3×3, the puzzle is called the 8-puzzle
or 9-puzzle, and if 4×4, the puzzle is called the 15-
puzzle or 16-puzzle. The object of the puzzle is to
place the tiles in order (see diagram) by making
sliding moves that use the empty space.
http://en.wikipedia.org/wiki/Fifteen_puzzle
Top Level Views
Board Tab Photo Selection Tab Settings Tab
Board Types
Photo With NumbersPhotoTiles
Photo Selector
Camera PhotoDefault Photos
• Application contains 4 default photos
• User can take a new photo or use an existing photo
Settings
Settings Tab
•Board size: 3-6 rows / 3-6 columns
•Photo or numbered tiles
•Enable number tags on photo tiles
•Enable sound
Note: Changing the photo (from the Photo
Selector Tab) or the board size will trigger
a restart of game
Object Diagram
Board Controller
(UIViewController)
Photo Controller
(UIViewController)
Settings Controller
(UIViewController)
Tab Bar Controller
(UITabBarController)
Board
(UIView)
Tile (0-N)
(UIImageView
)
(Rows × Columns – 1) Tiles
Create Photo Tiles
Tile frame size is calculated from number of
rows/columns
Foreach Row/Column Coordinate
{
Image = CGImageCreateWithImageInRect
Create Tile object
}
Remove last Tile (bottom right)
Create Rounded Tile Image
Define the fill area with a CGMutablePathRef using two concentric polygons
• Create rectangle path with CGPathAddLineToPoint
• Create rounded path with CGPathAddLineToPoint and CGPathAddArcToPoint
Fill in area between the two polygons with CGContextEOFillPath (Even/Odd Fill)
Rectangle Path Rounded Path Filled In PathPhoto Image
Board Object
• Extends UIView object
• 2D array contains board state with pointers to all
tiles
• Emits a tick sound for each tile move
• Pauses board with a transparent overlay and
setting UserInteractionEnabled:NO
1 2 3 N
Tile Object
• Extends UIImageView object
• Numeric ID (Numeric Tile or Numeric Photo Tag)
• Home coordinate
• Movable State (Up/Down/Left/Right/None)
• Pointer to adjacent push tile (if applicable)
• Pointer to board object
1
Game Algorithm 1
N N N N
N N N N
N N N
N N N N
Iterate through all tiles in board
Foreach Tile in Board
{
Set MovableState:None
Is Tile solved?
}
Is Board solved?
Game Algorithm 2
N D N N
N D N N
R L L
N U N N
Start at empty spot and iterate through
tiles in same row and column
Foreach Tile Row/Column
{
Set MovableState:Up/Down/Left/Right
Set PushTile pointer (if applicable)
}
Game Algorithm 3
N D N N
N D N N
R L L
N U N N
• The Tile class can receive touches since it extends
UIImageView which extends UIResponder
• The Tile class implements these methods to
handle touches
touchesBegan(NSSet *, UIEvent *)
touchesMoved(NSSet *, UIEvent *)
touchesEnded(NSSet *, UIEvent *)
touchesCancelled(NSSet *, UIEvent *)
• To prevent multiple tiles from moving, an NSLock
object is used
Game Algorithm 4
When a Tile receives a touchesBegan event, it will respond if it’s in a movable
state and can acquire the lock.
The Tile will slide with the relative location provided by the touchesMoved
event. Its movement will be constrained by the empty area. If the Tile is pushing
another Tile, it will slide it the same distance via its PushTile pointer.
When the touch is done, the Tile will receive a touchesEnded event. If the Tile
has moved less than half the distance, it will snap to its original location. If it has
moved more than half the distance, it will snap to the empty location.
When a Tile moves, it communicates this back to the Board so it can update.
15 9 15 9
Accelerometer
Restart Menu
The Accelerometer is used so users can
restart/reshuffle the board
• Accelerometer provides a 3D g-force
vector at a configured interval (1/30 sec)
• A valid shake is when the g-force vector
delta exceeds a configured threshold in 2
of the 3 dimensions
• Shake counter is incremented for valid
shake
• Shake counter is reset for invalid shake
• Restart menu is triggered when counter
equals 3 shakes
Performance
• Coded application with an “Optimize Later”
philosophy
• Great game performance; Tiles are very
responsive
• Camera Photo Selector can cause memory
warnings
• Board generation can take 4-8 seconds
depending on size
Version 2.0
• Save game state
• Improve board generation time
• iAd
Questions?

More Related Content

What's hot

ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
Oluwasegun Oluwaseun Onibudo
 
Image classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwisImage classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwis
Femi Opaleye
 
Advanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 gamesAdvanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 games
Microsoft Schweiz
 
spatial anaylisi using ilwis
spatial anaylisi using ilwisspatial anaylisi using ilwis
spatial anaylisi using ilwisAsri Renggo
 
3d game engine
3d game engine3d game engine
3d game engine
luisfvazquez1
 
LarsDu_Final
LarsDu_FinalLarsDu_Final
LarsDu_Final
Lawrence Du, Ph.D.
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityGilbert Guerrero
 
Python GUI
Python GUIPython GUI
Python GUI
LusciousLarryDas
 
Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?
Ciprian Jichici
 

What's hot (9)

ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
 
Image classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwisImage classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwis
 
Advanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 gamesAdvanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 games
 
spatial anaylisi using ilwis
spatial anaylisi using ilwisspatial anaylisi using ilwis
spatial anaylisi using ilwis
 
3d game engine
3d game engine3d game engine
3d game engine
 
LarsDu_Final
LarsDu_FinalLarsDu_Final
LarsDu_Final
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting Interactivity
 
Python GUI
Python GUIPython GUI
Python GUI
 
Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?
 

Similar to Y Tiles

libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
Jussi Pohjolainen
 
Gui programming
Gui programmingGui programming
Gui programming
manikanta361
 
TIC-TAC-TOE IN C
TIC-TAC-TOE IN CTIC-TAC-TOE IN C
TIC-TAC-TOE IN C
IRJET Journal
 
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
Karel Van Isacker
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
Jussi Pohjolainen
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced gamesallenbailey
 
Presentatie Willem En Kevin
Presentatie Willem En KevinPresentatie Willem En Kevin
Presentatie Willem En Kevingueste26e85
 
Run and jump tutorial (part 2) scenes
Run and jump tutorial (part 2)   scenesRun and jump tutorial (part 2)   scenes
Run and jump tutorial (part 2) scenesMuhd Basheer
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
goodfriday
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA GameSohil Gupta
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
Sarthak Srivastava
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmers
Noam Gat
 
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdfHi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
fonecomp
 
Academy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentAcademy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. Environment
Binary Studio
 
The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196
Mahmoud Samir Fayed
 
Project report 393_395
Project report 393_395Project report 393_395
Project report 393_395
VishruthKhare
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2
Marlon Luz
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
Jussi Pohjolainen
 
Monogame and xna
Monogame and xnaMonogame and xna
Monogame and xna
Lee Stott
 

Similar to Y Tiles (20)

libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Gui programming
Gui programmingGui programming
Gui programming
 
TIC-TAC-TOE IN C
TIC-TAC-TOE IN CTIC-TAC-TOE IN C
TIC-TAC-TOE IN C
 
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced games
 
Presentatie Willem En Kevin
Presentatie Willem En KevinPresentatie Willem En Kevin
Presentatie Willem En Kevin
 
Run and jump tutorial (part 2) scenes
Run and jump tutorial (part 2)   scenesRun and jump tutorial (part 2)   scenes
Run and jump tutorial (part 2) scenes
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA Game
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmers
 
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdfHi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
 
Academy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentAcademy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. Environment
 
The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196
 
Project report 393_395
Project report 393_395Project report 393_395
Project report 393_395
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
Monogame and xna
Monogame and xnaMonogame and xna
Monogame and xna
 

Recently uploaded

From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
Rodney Thomas Jr
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
madeline604788
 
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdfMaximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Xtreame HDTV
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
Isaac More
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
greendigital
 
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog EternalMeet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Blog Eternal
 
Panchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdfPanchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdf
Suleman Rana
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Hidden Treasure Hunts
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
Indira Srivatsa
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
Zsolt Nemeth
 
240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
Madhura TBRC
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
greendigital
 
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
get joys
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
Sabrina Ricci
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
Isaac More
 
The Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy DirectorThe Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy Director
Mark Murphy Director
 
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdfCreate a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Genny Knight
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
Aarush Ghate
 
Reimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a SuccessReimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a Success
Mark Murphy Director
 

Recently uploaded (19)

From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
From Slave to Scourge: The Existential Choice of Django Unchained. The Philos...
 
Christina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptxChristina's Baby Shower Game June 2024.pptx
Christina's Baby Shower Game June 2024.pptx
 
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdfMaximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
Maximizing Your Streaming Experience with XCIPTV- Tips for 2024.pdf
 
Skeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on ForumSkeem Saam in June 2024 available on Forum
Skeem Saam in June 2024 available on Forum
 
Tom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive AnalysisTom Selleck Net Worth: A Comprehensive Analysis
Tom Selleck Net Worth: A Comprehensive Analysis
 
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog EternalMeet Crazyjamjam - A TikTok Sensation | Blog Eternal
Meet Crazyjamjam - A TikTok Sensation | Blog Eternal
 
Panchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdfPanchayat Season 3 - Official Trailer.pdf
Panchayat Season 3 - Official Trailer.pdf
 
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles onlineTreasure Hunt Puzzles, Treasure Hunt Puzzles online
Treasure Hunt Puzzles, Treasure Hunt Puzzles online
 
A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024A TO Z INDIA Monthly Magazine - JUNE 2024
A TO Z INDIA Monthly Magazine - JUNE 2024
 
Hollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest galleryHollywood Actress - The 250 hottest gallery
Hollywood Actress - The 250 hottest gallery
 
240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf240529_Teleprotection Global Market Report 2024.pdf
240529_Teleprotection Global Market Report 2024.pdf
 
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to StardomYoung Tom Selleck: A Journey Through His Early Years and Rise to Stardom
Young Tom Selleck: A Journey Through His Early Years and Rise to Stardom
 
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and LoveMeet Dinah Mattingly – Larry Bird’s Partner in Life and Love
Meet Dinah Mattingly – Larry Bird’s Partner in Life and Love
 
I Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledgeI Know Dino Trivia: Part 3. Test your dino knowledge
I Know Dino Trivia: Part 3. Test your dino knowledge
 
Scandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.zaScandal! Teasers June 2024 on etv Forum.co.za
Scandal! Teasers June 2024 on etv Forum.co.za
 
The Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy DirectorThe Evolution of Animation in Film - Mark Murphy Director
The Evolution of Animation in Film - Mark Murphy Director
 
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdfCreate a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
Create a Seamless Viewing Experience with Your Own Custom OTT Player.pdf
 
This Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I MadeThis Is The First All Category Quiz That I Made
This Is The First All Category Quiz That I Made
 
Reimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a SuccessReimagining Classics - What Makes a Remake a Success
Reimagining Classics - What Makes a Remake a Success
 

Y Tiles

  • 1. Y-Tiles iPhone Application Chris Yunker STL Mobile Dev Meeting June 24, 2010
  • 2. Why Y-Tiles? • Simple, enjoyable game everyone understands • Development touches a lot areas (graphics, touch screen, camera, accelerometer, etc.) Why The Name “Y-Tiles”? • When I started development, there were already over 25 implementations of this game • I had to find a unique name so I added the first letter of my last name
  • 3. Development Details • Hardware: iPhone 3G (16G) • SDK: 2.2.1 • Development Time: 2-3 months • Submitted to App Store: March 4, 2009 • Downloads: +2000 in last 26 weeks (according to iTunes Connect App)
  • 4. Fifteen Puzzle Game The n-puzzle is known in various versions, including the 8 puzzle, the 15 puzzle, and with various names (Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others). It is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing. If the size is 3×3, the puzzle is called the 8-puzzle or 9-puzzle, and if 4×4, the puzzle is called the 15- puzzle or 16-puzzle. The object of the puzzle is to place the tiles in order (see diagram) by making sliding moves that use the empty space. http://en.wikipedia.org/wiki/Fifteen_puzzle
  • 5. Top Level Views Board Tab Photo Selection Tab Settings Tab
  • 6. Board Types Photo With NumbersPhotoTiles
  • 7. Photo Selector Camera PhotoDefault Photos • Application contains 4 default photos • User can take a new photo or use an existing photo
  • 8. Settings Settings Tab •Board size: 3-6 rows / 3-6 columns •Photo or numbered tiles •Enable number tags on photo tiles •Enable sound Note: Changing the photo (from the Photo Selector Tab) or the board size will trigger a restart of game
  • 9. Object Diagram Board Controller (UIViewController) Photo Controller (UIViewController) Settings Controller (UIViewController) Tab Bar Controller (UITabBarController) Board (UIView) Tile (0-N) (UIImageView ) (Rows × Columns – 1) Tiles
  • 10. Create Photo Tiles Tile frame size is calculated from number of rows/columns Foreach Row/Column Coordinate { Image = CGImageCreateWithImageInRect Create Tile object } Remove last Tile (bottom right)
  • 11. Create Rounded Tile Image Define the fill area with a CGMutablePathRef using two concentric polygons • Create rectangle path with CGPathAddLineToPoint • Create rounded path with CGPathAddLineToPoint and CGPathAddArcToPoint Fill in area between the two polygons with CGContextEOFillPath (Even/Odd Fill) Rectangle Path Rounded Path Filled In PathPhoto Image
  • 12. Board Object • Extends UIView object • 2D array contains board state with pointers to all tiles • Emits a tick sound for each tile move • Pauses board with a transparent overlay and setting UserInteractionEnabled:NO 1 2 3 N
  • 13. Tile Object • Extends UIImageView object • Numeric ID (Numeric Tile or Numeric Photo Tag) • Home coordinate • Movable State (Up/Down/Left/Right/None) • Pointer to adjacent push tile (if applicable) • Pointer to board object 1
  • 14. Game Algorithm 1 N N N N N N N N N N N N N N N Iterate through all tiles in board Foreach Tile in Board { Set MovableState:None Is Tile solved? } Is Board solved?
  • 15. Game Algorithm 2 N D N N N D N N R L L N U N N Start at empty spot and iterate through tiles in same row and column Foreach Tile Row/Column { Set MovableState:Up/Down/Left/Right Set PushTile pointer (if applicable) }
  • 16. Game Algorithm 3 N D N N N D N N R L L N U N N • The Tile class can receive touches since it extends UIImageView which extends UIResponder • The Tile class implements these methods to handle touches touchesBegan(NSSet *, UIEvent *) touchesMoved(NSSet *, UIEvent *) touchesEnded(NSSet *, UIEvent *) touchesCancelled(NSSet *, UIEvent *) • To prevent multiple tiles from moving, an NSLock object is used
  • 17. Game Algorithm 4 When a Tile receives a touchesBegan event, it will respond if it’s in a movable state and can acquire the lock. The Tile will slide with the relative location provided by the touchesMoved event. Its movement will be constrained by the empty area. If the Tile is pushing another Tile, it will slide it the same distance via its PushTile pointer. When the touch is done, the Tile will receive a touchesEnded event. If the Tile has moved less than half the distance, it will snap to its original location. If it has moved more than half the distance, it will snap to the empty location. When a Tile moves, it communicates this back to the Board so it can update. 15 9 15 9
  • 18. Accelerometer Restart Menu The Accelerometer is used so users can restart/reshuffle the board • Accelerometer provides a 3D g-force vector at a configured interval (1/30 sec) • A valid shake is when the g-force vector delta exceeds a configured threshold in 2 of the 3 dimensions • Shake counter is incremented for valid shake • Shake counter is reset for invalid shake • Restart menu is triggered when counter equals 3 shakes
  • 19. Performance • Coded application with an “Optimize Later” philosophy • Great game performance; Tiles are very responsive • Camera Photo Selector can cause memory warnings • Board generation can take 4-8 seconds depending on size
  • 20. Version 2.0 • Save game state • Improve board generation time • iAd