SlideShare a Scribd company logo
1 of 45
Mini Games Lessons From Rebuilding Classic Games in C++ and OpenGL Joe Linhoff Eugene Jarvis Darren Torpey
MiniGames Rebuilding Three Classic Joe Linhoff Eugene Jarvis Darren Torpey
DePaul University ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Workshop Target This is a discussion on the teaching of game development and will focus on the use of mini-games to teach game programming and game design. There will be no art.
Modern Game Design ,[object Object],[object Object],[object Object]
Running A Game Dev Class
Infrastructure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Infrastructure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Setup ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Setup ,[object Object],[object Object],[object Object]
Version Control (highly recommended) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Directory Structure dev -- development root can exist anywhere class1 student1 student2 class2 student1 student2 projects gdc09 <-- $(SolutionDir) art mini -- code files for mini-games qeStartup.c m_minipong.cc mini.vcproj mini.vcproj.user <-- user properties default game.sln bin -- shared bin files qeblue.dll freeglut.dll inc -- shared headers for qe and freeglut qe.h qec.h qefn.h GL/glut.h GL/freeglut.h ...  lib -- shared lib qeblue.lib freeglut.lib
MSVC Properties: paths ,[object Object],[object Object],Set in all Configurations Debugging Working Directory: $(SolutionDir) Environment: path=$(SolutionDir)../../bin;%path% C/C++ General Additional Include Directories: $(SolutionDir)../../inc Linker General Additional Library Directories: $(SolutionDir)../../lib Input Additional Dependencies: qeblue.dll
mini.vcproj.user ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Hello World
Building Hello World ,[object Object]
config.h ,[object Object],[object Object],// config.h #ifndef CONFIG_H #define CONFIG_H // build one at a time #define BUILD_HELLO  1 // hello world #define BUILD_MINIPONG  0 // pong #define BUILD_MINIMISSILE 0 // missile command #define BUILD_MINIROBO  0 // robotron #endif // ndef CONFIG_H // Copyright (C) 2007-2009 Joe Linhoff, All Rights Reserved // m_hello.c #include &quot;config.h&quot; // include the config file first #if BUILD_HELLO // compile this app #include &quot;qe.h&quot; // engine include file // qeMain() int qeMain(int argc,chr *argv[]) { qePrintf(&quot;%s / %s / %s&quot;,__FILE__,glGetString(GL_VERSION),qeVersion()); qePrintf(&quot;Hello World&quot;); // turn control over to the engine until the user closes the program qeForever(); return 0; } // qeMain() #endif // compile this app // EOF
QE ,[object Object],[object Object],[object Object],[object Object]
Pong, 1972
Teaching Game Development  Starting Student Projects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Game Development ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1000 Features (handout) unique value 0..1000 possible feature for your game -- focus on what you see, hear, and how to get it on the screen
000ZY Coordinates ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Cameras software metaphor // JFL 03 Oct 08 class Camera : public qe { public: chr name[16]; // name float fovyHalfRad; // in radians float nearClip; // near clipping plane float farClip; // far clipping plane float winWidth; // in pixels float winHeight; // in pixels float winWDivH; // window aspect ratio float nearHeight; // height at near plane float mat12[12]; // camera matrix int draw(); // draw-step function Camera(chr *name); // constructor }; // class Camera // setup -- happens once in mini-pong this->nearClip = 1; this->farClip = 500; this->fovyHalfRad = 0.5*((63*PI)/180.0); this->nearHeight =  this->nearClip * MathTanf(this->fovyHalfRad); // camera matrix -- from world space into camera space SET3(pos,0,CAMERA_Y,0); // position of camera SET3(at,0,0,0); // where camera is looking at SET3(up,0,0,-1); // the camera's up direction qeCamLookAtM12f(this->mat12,pos,at,up); // camera mat // draw -- set every frame before you draw if(qeGetWindowSize(&this->winWidth,&this->winHeight)<0) bret(-2); // jump to function exit this->winWDivH=this->winWidth/this->winHeight; // set the PROJECTION matrix (the camera lens) glMatrixMode(GL_PROJECTION); glLoadIdentity(); float yy = this->nearHeight; float xx=this->nearHeight*this->winWDivH; glFrustum(-xx,xx,-yy,yy,this->nearClip,this->farClip); // MODELVIEW (position and orientation of the camera) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); qeGLM12f(this->mat12); // set matrix
OpenGL 4x4 Matrices (M16) #define VecTransformM16(_d_,_v_,_m_) // d=dstvec v=srcvec m=mat16 (_d_)[0]=(_v_)[0]*(_m_)[M16_11]+(_v_)[1]*(_m_)[M16_21] +(_v_)[2]*(_m_)[M16_31]+(_m_)[M16_X], (_d_)[1]=(_v_)[0]*(_m_)[M16_12]+(_v_)[1]*(_m_)[M16_22] +(_v_)[2]*(_m_)[M16_32]+(_m_)[M16_Y], (_d_)[2]=(_v_)[0]*(_m_)[M16_13]+(_v_)[1]*(_m_)[M16_23] +(_v_)[2]*(_m_)[M16_33]+(_m_)[M16_Z] #define VecRotM16(_d_,_v_,_m_) (_d_)[0]=(_v_)[0]*(_m_)[M16_11]+(_v_)[1]*(_m_)[M16_21] +(_v_)[2]*(_m_)[M16_31], (_d_)[1]=(_v_)[0]*(_m_)[M16_12]+(_v_)[1]*(_m_)[M16_22] +(_v_)[2]*(_m_)[M16_32], (_d_)[2]=(_v_)[0]*(_m_)[M16_13]+(_v_)[1]*(_m_)[M16_23] +(_v_)[2]*(_m_)[M16_33] float mat[16]; glGetFloatv(GL_MODELVIEW_MATRIX,mat);
QE 3x4 matrices (M12) non-standard: XYZ and 3x3 rotation matrix #define VecTransformM12(_d_,_v_,_m_) (_d_)[0]=(_v_)[0]*(_m_)[M12_11]+(_v_)[1]*(_m_)[M12_21] +(_v_)[2]*(_m_)[M12_31]+(_m_)[M12_X], (_d_)[1]=(_v_)[0]*(_m_)[M12_12]+(_v_)[1]*(_m_)[M12_22] +(_v_)[2]*(_m_)[M12_32]+(_m_)[M12_Y], (_d_)[2]=(_v_)[0]*(_m_)[M12_13]+(_v_)[1]*(_m_)[M12_23] +(_v_)[2]*(_m_)[M12_33]+(_m_)[M12_Z] #define VecRotM12(_d_,_v_,_m_) (_d_)[0]=(_v_)[0]*(_m_)[M12_11]+(_v_)[1]*(_m_)[M12_21] +(_v_)[2]*(_m_)[M12_31], (_d_)[1]=(_v_)[0]*(_m_)[M12_12]+(_v_)[1]*(_m_)[M12_22] +(_v_)[2]*(_m_)[M12_32], (_d_)[2]=(_v_)[0]*(_m_)[M12_13]+(_v_)[1]*(_m_)[M12_23] +(_v_)[2]*(_m_)[M12_33]
Velocities ,[object Object],[object Object],[object Object],[object Object],[object Object],// JFL 25 Jan 09 class Ball : public qe { public: chr name[16]; // name float timeOfLastUpdate; // in seconds float xyz[3]; // current float vel[3]; // velocity Ball(chr *name); // constructor int update(); // update function int draw(); // draw function }; // class Ball // update, move the ball float t; // find time since last update t=this->timeOfLastUpdate; this->timeOfLastUpdate=qeTimeFrame(); t=this->timeOfLastUpdate-t; // delta // xyz += vel*t this->xyz[0]+=this->vel[0]*t; this->xyz[1]+=this->vel[1]*t; this->xyz[2]+=this->vel[2]*t;
Collisions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Collisions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Game Controller Use Singleton Pattern ,[object Object],[object Object],Game *Game::instance=0; // initialize Singleton // JFL 13 Aug 08 Game::Game(chr *name) : qeUpdateBase(name,0,GAMEID_GAME) { // constructor this->name = qeObjName(this->_oShared); // get name } // Game::Game() // JFL 16 Aug 08 void Game::InstanceDelete() { if(Game::instance) Game::instance->objRemove(); // request obj removal  } // GameInstanceDelete() // JFL 16 Aug 08 Game* Game::InstanceNew() { if(!Game::instance) Game::instance = new Game(&quot;game1&quot;); return Game::instance; } // Game::InstanceNew() // JFL 16 Aug 08 Game* Game::InstanceGet() { return Game::instance; } // Game::InstanceGet() // JFL 03 Oct 08 class Game : public qeUpdateBase { // game controller record chr *name; // points to system name  static Game *instance; // singleton Game(chr *name); // constructor public: static Game* InstanceNew(); static Game* InstanceGet(); static void InstanceDelete(); }; // class Game
qeUpdateBase base class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
qe base class ,[object Object],[object Object],[object Object],[object Object],[object Object]
Game Superstructure visualization
Button Counts uns qeInpButton(uns inpb); // QEINPBUTTON_ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Joysticks float qeInpJoyAxisf(uns joy,uns axis); // use QEJOYAXIS_ uns qeInpJoyButton(uns joy,uns button); // use QEJOYBUTTON_ ,[object Object],[object Object],[object Object],[object Object],[object Object]
Draw simple filled rectangle glColor3f(1,1,1); glPolygonMode(GL_FRONT,GL_FILL); // draw filled polygons glBegin(GL_QUADS); // draw quads counter-clockwise from camera's view glVertex3f(-1,0,-3); glVertex3f(-1,0,3); glVertex3f(2,0,3); glVertex3f(2,0,-3); glEnd();
Loading and Playing Sounds ,[object Object],[object Object],[object Object],[object Object],[object Object],// setup sound &quot;bump&quot; on channel 1 if((r=qeSndNew(&quot;bump&quot;,M_SNDNEW_CH_1,0,&quot;art/sounds/pongbump.wav&quot;))<0) BRK(); // trigger the sound qeSndPlay(&quot;bump&quot;);
qePrintf() qeLogf() ,[object Object],[object Object],[object Object],[object Object]
BRK() ,[object Object],[object Object],[object Object]
Bracket Resources ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Missile Command, 1980
Strings ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LLNode ,[object Object],[object Object],[object Object],// linked list typedef struct _llnode { struct _llnode *next; struct _llnode *prev; int t; // type: listhead=0, others=non-zero } LLNode; // JFL 23 Aug 06 // JFL 20 Mar 08; re-worked from DL void LLMakeHead(LLNode *h) { h->next=h->prev=h; h->t=0; } // LLMakeHead() // JFL 20 Mar 08; re-worked from DL // JFL 18 May 08; link to self void LLMakeNode(LLNode *n,int t) { n->next=n->prev=n; n->t=t; } // LLMakeNode() // JFL 23 Aug 06 // JFL 20 Mar 08; re-worked from DL void LLLinkAfter(LLNode *h,LLNode *n) { n->next=h->next; n->next->prev=n; n->prev=h; h->next=n; } // LLLinkAfter() // JFL 05 May 06 // JFL 20 Mar 08; re-worked from DL void LLLinkBefore(LLNode *h,LLNode *n) { n->prev=h->prev; n->prev->next=n; n->next=h; h->prev=n; } // LLLinkBefore() // JFL 05 May 06 // JFL 20 Mar 08; re-worked from DL void LLUnlink(LLNode *n) { n->prev->next=n->next; n->next->prev=n->prev; n->next=n->prev=n; // multiple unlinks OK } // LLUnlink()
Robotron, 1982
 

More Related Content

What's hot

openFrameworks 007 - GL
openFrameworks 007 - GL openFrameworks 007 - GL
openFrameworks 007 - GL roxlu
 
Monogame Introduction (ENG)
Monogame Introduction (ENG)Monogame Introduction (ENG)
Monogame Introduction (ENG)Aloïs Deniel
 
Unity遊戲程式設計 - 2D Platformer遊戲
Unity遊戲程式設計 - 2D Platformer遊戲Unity遊戲程式設計 - 2D Platformer遊戲
Unity遊戲程式設計 - 2D Platformer遊戲吳錫修 (ShyiShiou Wu)
 
Game Programming 07 - Procedural Content Generation
Game Programming 07 - Procedural Content GenerationGame Programming 07 - Procedural Content Generation
Game Programming 07 - Procedural Content GenerationNick Pruehs
 
Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019
Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019 Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019
Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019 Unity Technologies
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 
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 AnimationJussi Pohjolainen
 
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha PhonesGetting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha PhonesMicrosoft Mobile Developer
 
Chapter ii(coding)
Chapter ii(coding)Chapter ii(coding)
Chapter ii(coding)Chhom Karath
 
The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]Nilhcem
 
A Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and AllegroA Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and Allegrosnowfarthing
 
3D Computer Graphics with Python
3D Computer Graphics with Python3D Computer Graphics with Python
3D Computer Graphics with PythonMartin Christen
 

What's hot (15)

openFrameworks 007 - GL
openFrameworks 007 - GL openFrameworks 007 - GL
openFrameworks 007 - GL
 
Monogame Introduction (ENG)
Monogame Introduction (ENG)Monogame Introduction (ENG)
Monogame Introduction (ENG)
 
Unity遊戲程式設計 - 2D Platformer遊戲
Unity遊戲程式設計 - 2D Platformer遊戲Unity遊戲程式設計 - 2D Platformer遊戲
Unity遊戲程式設計 - 2D Platformer遊戲
 
Pygame presentation
Pygame presentationPygame presentation
Pygame presentation
 
Game Programming 07 - Procedural Content Generation
Game Programming 07 - Procedural Content GenerationGame Programming 07 - Procedural Content Generation
Game Programming 07 - Procedural Content Generation
 
Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019
Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019 Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019
Intrinsics: Low-level engine development with Burst - Unite Copenhagen 2019
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
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
 
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha PhonesGetting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
 
Chapter ii(coding)
Chapter ii(coding)Chapter ii(coding)
Chapter ii(coding)
 
The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]The 2016 Android Developer Toolbox [NANTES]
The 2016 Android Developer Toolbox [NANTES]
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 
A Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and AllegroA Simple 3D Graphics Engine Written in Python and Allegro
A Simple 3D Graphics Engine Written in Python and Allegro
 
3D Computer Graphics with Python
3D Computer Graphics with Python3D Computer Graphics with Python
3D Computer Graphics with Python
 
Soc research
Soc researchSoc research
Soc research
 

Viewers also liked

Entity System Architecture with Unity - Unity User Group Berlin
Entity System Architecture with Unity - Unity User Group BerlinEntity System Architecture with Unity - Unity User Group Berlin
Entity System Architecture with Unity - Unity User Group BerlinSimon Schmid
 
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016Simon Schmid
 
C++ How I learned to stop worrying and love metaprogramming
C++ How I learned to stop worrying and love metaprogrammingC++ How I learned to stop worrying and love metaprogramming
C++ How I learned to stop worrying and love metaprogrammingcppfrug
 
ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016Simon Schmid
 
Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Nick Pruehs
 
Game Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity SystemsGame Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity SystemsNick Pruehs
 

Viewers also liked (6)

Entity System Architecture with Unity - Unity User Group Berlin
Entity System Architecture with Unity - Unity User Group BerlinEntity System Architecture with Unity - Unity User Group Berlin
Entity System Architecture with Unity - Unity User Group Berlin
 
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
 
C++ How I learned to stop worrying and love metaprogramming
C++ How I learned to stop worrying and love metaprogrammingC++ How I learned to stop worrying and love metaprogramming
C++ How I learned to stop worrying and love metaprogramming
 
ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016
 
Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)
 
Game Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity SystemsGame Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity Systems
 

Similar to Gdc09 Minigames

Open Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 TutorialOpen Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 Tutorialantiw
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
FGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for GamesFGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for Gamesmochimedia
 
Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Pritam Samanta
 
Ideal Deployment In .NET World
Ideal Deployment In .NET WorldIdeal Deployment In .NET World
Ideal Deployment In .NET WorldDima Pasko
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentOOO "Program Verification Systems"
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresFrits Van Der Holst
 
A 3D printing programming API
A 3D printing programming APIA 3D printing programming API
A 3D printing programming APIMax Kleiner
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Patrick Chanezon
 
[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-viewNAVER D2
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsNick Pruehs
 
Go Programming by Example_ Nho Vĩnh Share.pdf
Go Programming by Example_ Nho Vĩnh Share.pdfGo Programming by Example_ Nho Vĩnh Share.pdf
Go Programming by Example_ Nho Vĩnh Share.pdfNho Vĩnh
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webpjcozzi
 
Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2dVinsol
 
XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...
XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...
XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...Publicis Sapient Engineering
 

Similar to Gdc09 Minigames (20)

Open Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 TutorialOpen Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 Tutorial
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
FGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for GamesFGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for Games
 
Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game
 
Ideal Deployment In .NET World
Ideal Deployment In .NET WorldIdeal Deployment In .NET World
Ideal Deployment In .NET World
 
PVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications developmentPVS-Studio, a solution for resource intensive applications development
PVS-Studio, a solution for resource intensive applications development
 
Introduction
IntroductionIntroduction
Introduction
 
Deep Learning Edge
Deep Learning Edge Deep Learning Edge
Deep Learning Edge
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
Modern frontend in react.js
Modern frontend in react.jsModern frontend in react.js
Modern frontend in react.js
 
A 3D printing programming API
A 3D printing programming APIA 3D printing programming API
A 3D printing programming API
 
React native
React nativeReact native
React native
 
Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?Google's HTML5 Work: what's next?
Google's HTML5 Work: what's next?
 
Unity3D Programming
Unity3D ProgrammingUnity3D Programming
Unity3D Programming
 
[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
Go Programming by Example_ Nho Vĩnh Share.pdf
Go Programming by Example_ Nho Vĩnh Share.pdfGo Programming by Example_ Nho Vĩnh Share.pdf
Go Programming by Example_ Nho Vĩnh Share.pdf
 
WebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open webWebGL: GPU acceleration for the open web
WebGL: GPU acceleration for the open web
 
Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2d
 
XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...
XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...
XebiCon'17 : Faites chauffer les neurones de votre Smartphone avec du Deep Le...
 

More from Susan Gold

More from Susan Gold (20)

Community
CommunityCommunity
Community
 
ICEC
ICECICEC
ICEC
 
Dgxpo
DgxpoDgxpo
Dgxpo
 
Fog
FogFog
Fog
 
Ivdc
IvdcIvdc
Ivdc
 
Gold And Robinson 2009
Gold And Robinson 2009Gold And Robinson 2009
Gold And Robinson 2009
 
GDC 2009 Game Design Improv
GDC 2009 Game Design ImprovGDC 2009 Game Design Improv
GDC 2009 Game Design Improv
 
Gdc09 Minimissile
Gdc09 MinimissileGdc09 Minimissile
Gdc09 Minimissile
 
Setup
SetupSetup
Setup
 
Qe Reference
Qe ReferenceQe Reference
Qe Reference
 
Pong
PongPong
Pong
 
Missilecommand
MissilecommandMissilecommand
Missilecommand
 
Gdc09 Minipong
Gdc09 MinipongGdc09 Minipong
Gdc09 Minipong
 
Assignment Pong
Assignment PongAssignment Pong
Assignment Pong
 
Global Game Jam Overview
Global Game Jam OverviewGlobal Game Jam Overview
Global Game Jam Overview
 
Agd Talk Speed Run
Agd Talk   Speed RunAgd Talk   Speed Run
Agd Talk Speed Run
 
SIGGRAPH 2007 IGDA Presentation
SIGGRAPH 2007 IGDA PresentationSIGGRAPH 2007 IGDA Presentation
SIGGRAPH 2007 IGDA Presentation
 
Mscruise
MscruiseMscruise
Mscruise
 
GDC China 2007
GDC China 2007GDC China 2007
GDC China 2007
 
Digra07
Digra07Digra07
Digra07
 

Gdc09 Minigames

  • 1. Mini Games Lessons From Rebuilding Classic Games in C++ and OpenGL Joe Linhoff Eugene Jarvis Darren Torpey
  • 2. MiniGames Rebuilding Three Classic Joe Linhoff Eugene Jarvis Darren Torpey
  • 3.
  • 4. Workshop Target This is a discussion on the teaching of game development and will focus on the use of mini-games to teach game programming and game design. There will be no art.
  • 5.
  • 6. Running A Game Dev Class
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Directory Structure dev -- development root can exist anywhere class1 student1 student2 class2 student1 student2 projects gdc09 <-- $(SolutionDir) art mini -- code files for mini-games qeStartup.c m_minipong.cc mini.vcproj mini.vcproj.user <-- user properties default game.sln bin -- shared bin files qeblue.dll freeglut.dll inc -- shared headers for qe and freeglut qe.h qec.h qefn.h GL/glut.h GL/freeglut.h ... lib -- shared lib qeblue.lib freeglut.lib
  • 13.
  • 14.
  • 16.
  • 17.
  • 18.
  • 20.
  • 21.
  • 22. 1000 Features (handout) unique value 0..1000 possible feature for your game -- focus on what you see, hear, and how to get it on the screen
  • 23.
  • 24. Cameras software metaphor // JFL 03 Oct 08 class Camera : public qe { public: chr name[16]; // name float fovyHalfRad; // in radians float nearClip; // near clipping plane float farClip; // far clipping plane float winWidth; // in pixels float winHeight; // in pixels float winWDivH; // window aspect ratio float nearHeight; // height at near plane float mat12[12]; // camera matrix int draw(); // draw-step function Camera(chr *name); // constructor }; // class Camera // setup -- happens once in mini-pong this->nearClip = 1; this->farClip = 500; this->fovyHalfRad = 0.5*((63*PI)/180.0); this->nearHeight = this->nearClip * MathTanf(this->fovyHalfRad); // camera matrix -- from world space into camera space SET3(pos,0,CAMERA_Y,0); // position of camera SET3(at,0,0,0); // where camera is looking at SET3(up,0,0,-1); // the camera's up direction qeCamLookAtM12f(this->mat12,pos,at,up); // camera mat // draw -- set every frame before you draw if(qeGetWindowSize(&this->winWidth,&this->winHeight)<0) bret(-2); // jump to function exit this->winWDivH=this->winWidth/this->winHeight; // set the PROJECTION matrix (the camera lens) glMatrixMode(GL_PROJECTION); glLoadIdentity(); float yy = this->nearHeight; float xx=this->nearHeight*this->winWDivH; glFrustum(-xx,xx,-yy,yy,this->nearClip,this->farClip); // MODELVIEW (position and orientation of the camera) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); qeGLM12f(this->mat12); // set matrix
  • 25. OpenGL 4x4 Matrices (M16) #define VecTransformM16(_d_,_v_,_m_) // d=dstvec v=srcvec m=mat16 (_d_)[0]=(_v_)[0]*(_m_)[M16_11]+(_v_)[1]*(_m_)[M16_21] +(_v_)[2]*(_m_)[M16_31]+(_m_)[M16_X], (_d_)[1]=(_v_)[0]*(_m_)[M16_12]+(_v_)[1]*(_m_)[M16_22] +(_v_)[2]*(_m_)[M16_32]+(_m_)[M16_Y], (_d_)[2]=(_v_)[0]*(_m_)[M16_13]+(_v_)[1]*(_m_)[M16_23] +(_v_)[2]*(_m_)[M16_33]+(_m_)[M16_Z] #define VecRotM16(_d_,_v_,_m_) (_d_)[0]=(_v_)[0]*(_m_)[M16_11]+(_v_)[1]*(_m_)[M16_21] +(_v_)[2]*(_m_)[M16_31], (_d_)[1]=(_v_)[0]*(_m_)[M16_12]+(_v_)[1]*(_m_)[M16_22] +(_v_)[2]*(_m_)[M16_32], (_d_)[2]=(_v_)[0]*(_m_)[M16_13]+(_v_)[1]*(_m_)[M16_23] +(_v_)[2]*(_m_)[M16_33] float mat[16]; glGetFloatv(GL_MODELVIEW_MATRIX,mat);
  • 26. QE 3x4 matrices (M12) non-standard: XYZ and 3x3 rotation matrix #define VecTransformM12(_d_,_v_,_m_) (_d_)[0]=(_v_)[0]*(_m_)[M12_11]+(_v_)[1]*(_m_)[M12_21] +(_v_)[2]*(_m_)[M12_31]+(_m_)[M12_X], (_d_)[1]=(_v_)[0]*(_m_)[M12_12]+(_v_)[1]*(_m_)[M12_22] +(_v_)[2]*(_m_)[M12_32]+(_m_)[M12_Y], (_d_)[2]=(_v_)[0]*(_m_)[M12_13]+(_v_)[1]*(_m_)[M12_23] +(_v_)[2]*(_m_)[M12_33]+(_m_)[M12_Z] #define VecRotM12(_d_,_v_,_m_) (_d_)[0]=(_v_)[0]*(_m_)[M12_11]+(_v_)[1]*(_m_)[M12_21] +(_v_)[2]*(_m_)[M12_31], (_d_)[1]=(_v_)[0]*(_m_)[M12_12]+(_v_)[1]*(_m_)[M12_22] +(_v_)[2]*(_m_)[M12_32], (_d_)[2]=(_v_)[0]*(_m_)[M12_13]+(_v_)[1]*(_m_)[M12_23] +(_v_)[2]*(_m_)[M12_33]
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 34.
  • 35.
  • 36. Draw simple filled rectangle glColor3f(1,1,1); glPolygonMode(GL_FRONT,GL_FILL); // draw filled polygons glBegin(GL_QUADS); // draw quads counter-clockwise from camera's view glVertex3f(-1,0,-3); glVertex3f(-1,0,3); glVertex3f(2,0,3); glVertex3f(2,0,-3); glEnd();
  • 37.
  • 38.
  • 39.
  • 40.
  • 42.
  • 43.
  • 45.