an introduction to generic game model

15
An introduction to Generic Game Model Martin Grider Abstract Puzzle LLC

Upload: martin-grider

Post on 22-Jun-2015

906 views

Category:

Software


2 download

DESCRIPTION

Slides from my talk about my open source GenericGameModel project.

TRANSCRIPT

Page 1: An introduction to Generic Game Model

An introduction to Generic Game Model

Martin Grider Abstract Puzzle LLC

Page 2: An introduction to Generic Game Model

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.

Page 3: An introduction to Generic Game Model

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

Page 4: An introduction to Generic Game Model

pod ‘GenericGameModel’

• GenericGameModel is installable via cocoapods.

• Also available here: https://github.com/mgrider/GenericGameModel

• Example project shows you how to do stuff.

Page 5: An introduction to Generic Game Model

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.)

Page 6: An introduction to Generic Game Model

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.

Page 7: An introduction to Generic Game Model

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 —>

Page 8: An introduction to Generic Game Model

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

Page 9: An introduction to Generic Game Model

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.

Page 10: An introduction to Generic Game Model

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.

Page 11: An introduction to Generic Game Model

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.

Page 12: An introduction to Generic Game Model

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.

Page 13: An introduction to Generic Game Model

GGM History: Poker Game

• Feb / March 2014, built this poker variant application.

• Client project

• ~6 weeks

Page 14: An introduction to Generic Game Model

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.

Page 15: An introduction to Generic Game Model

Quartz “Juicing”• Juicing just refers to visual effects, or pizazz.

• Some cocoapods to check out:

• AGGeometryKit

• UIView+EasingFunctions

• Squash