The document discusses rebuilding three classic games: Pong, Tennis '78, and another. It provides goals and reasons for remaking Pong, including learning game development without using an emulator. It outlines the basic game development process and covers drawing the game objects, handling the game loop, updating and moving objects, and resolving collisions. Simple techniques are described for movement, collisions, and drawing the games.
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