Gdc09 Minipong
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,023
On Slideshare
1,023
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1.  
  • 2. MiniGames Rebuilding Three Classics Joe Linhoff Eugene Jarvis Darren Torpey
  • 3. Pong, 1972
  • 4. Goals
    • Not to recreate "Pong" -- get an emulator
      • lots of MUCH easier ways to do this that will turn out MUCH better with MUCH less time
    • Program a Pong-like game from scratch
    • Learn game development
      • programming
      • game design
      • process
  • 5. Why Pong
    • First game
      • games must keep score, start and end
      • first with score, sound
    • Static
      • fixed number of game objects
    • Simple
  • 6. Game Development
    • Process
      • workflow
    • Design
      • what are you trying to do
    • Development tools and language
      • build an exe
    • Game development techniques
      • solutions to the problem space
  • 7. 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
  • 8. Tennis 78' -39..39 in X 27' -14..14 in Z Camera is above, looking down paddles ball X Z
  • 9. Teaching Goal lead students through first iteration
    • do brainstorm and design
    • 1000 features handout
    • cover 000ZY coordinates
    • 'draw' the camera
    • draw the court
    • exit cleanly
    • notes
      • treat camera, matrix as black box code
        • adventurous students can dig in
      • focus on drawing game objects
  • 10. Game Loop
    • update (voluntary)
      • move player paddles
      • move ball
    • collide (involuntary)
      • ball versus paddles
      • ball versus court
      • player versus court
    • draw
      • draw court
      • draw ball
      • draw paddles
      • draw score (HUD)
    • update
      • performs voluntary movement
    • collision
      • handles involuntary movement
  • 11. Velocities
    • variable frame rates
    • float qeTimeFrame()
      • returns seconds since engine start / restart
    • keep track of the time since the last update
    • use Euler integration
    // 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;
  • 12. Collisions
    • simplifications
      • move, then collide non-moving objects
      • don't worry about resolution order
      • run through once
    • guarantee
      • after detection, move objects out of that collision (may be in another -- too bad)
      • end up in valid world position
      • no movement after collision resolution
  • 13. Collisions
    • ball v world
      • if over right or left
        • score point, re-serve
      • if over top or bottom
        • set to top or bottom
        • reflect (flip z vel)
    • paddle v world
      • make sure player stays on the court
    • ball v paddles
      • test against near edge of paddle
        • set to near edge
        • bounce (flip x vel)
        • add English (later)
    • improvements
      • preserve distance when colliding
        • don't just set to collision edge
        • reflect at collision point
    • does order matter?
      • theoretically
      • unlikely
    • fast balls
      • could run through the paddle
        • depends on paddle size and ball speed
        • really need to handle moving collisions
  • 14. 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();