2. What is GGM?
• A small collection of re-usable classes for native
2D game development in iOS.
• Primarily (exclusively) uses UIKit.
• Facilitates rapid 2D prototyping.
• Allows you to think almost exclusively in grid
coordinates rather than pixel coordinates.
3. M(VC) for 2D games
• Model
• various properties I find useful for games:
gameIsPaused, gameIsOver, gameDuration, score
• each grid element (x,y) has an integer “state”
• View
• knows how to display each state
• translates user input to the model
4. pod ‘GenericGameModel’
• GenericGameModel is installable via
cocoapods.
• Also available here:
https://github.com/mgrider/GenericGameModel
• Example project shows you how to do stuff.
5. GGM_BaseModel
• Subclasses BaseModel
• [self.game save]; — does all the encoding stuff or you.
• Game states are stored in a multidimensional array of
NSNumber objects.
• int s = [self.game stateAtX:x andY:y];
• [self.game setStateAtX:x andY:y toState:newState];
• Typically use key/value observing for score, sometimes for
GameIsOver. (Yes, this should be isGameOver, this, among
other things, needs refactoring.)
6. GGM_UIView
• setHandlesTaps:YES — detect tap input
• override handleTapAtX:andY: in your subclass
• setHandlesDrags:YES — detect drag input
• override handleDragStart, handleDragContinue, and
handleDragEnd in your subclass.
• setGridType — supports backgroundColor/UIImage/UILabel/
Hex shape
• Individual views themselves are often another custom UIView
subclass that draws its own state.
7. GGM History
• Conceived in 2012 because I
was writing very similar “model”
code for all my games. (At the
time I was working on both For
the Win and Oppo-Citrus.)
• Really got its start at the
Overnight Game Jam at
360iDev in 2012.
1st use, Cloud Growth, september 2012 —>
8. GGM History, p.2
• Second use was
for a Ludum
Dare (another
game jam) at
the end of 2012.
• Subclassed
GGM_UIView to
support
isometric
display. 2nd use, Henchmen, December 2012
9. GGM History: DrawCade
• Jan 2013 updated
DrawCade, my drawing
application for the iCade,
to use GGM classes.
• Took less than a day to
refactor/rewrite to use
GGM.
• Spent another two
days making it
universal.
10. GGM History: Catchup
• Jan 2013 — started
working on Catchup
(then Ketchup), a hex-
based board game
conversion for 2-players.
• Uses GGM_HexView
• Still in work in
progress.
11. GGM History: RE@L Match
• In 2013, built a series of kid’s
educational games around the
mechanic of matching tiles in
the “sliding hole” puzzle.
• 3 apps published Dec 2013:
• Numbers & Words
• Numbers & Counting
• Counting & Words
• States come not from the
GGM_BaseModel subclass.
12. GGM History: Root Down
• December 2013,
published Root Down, an
original 2-player board
game.
• Prototyped initial game
in an evening. ~6
hours.
• App store version took
maybe another 4 hours.
13. GGM History: Poker Game
• Feb / March
2014, built this
poker variant
application.
• Client project
• ~6 weeks
14. GGM History: Action Go
• Jan 2014, ported my
first game, Go-Tetris
(originally a flash
game) to iOS.
• ~4 weeks spent in
development so far.
15. Quartz “Juicing”
• Juicing just refers to visual effects, or pizazz.
• Some cocoapods to check out:
• AGGeometryKit
• UIView+EasingFunctions
• Squash