Presentation is loading. Please wait.

Presentation is loading. Please wait.

Super Pong Andrew Dunsmore CSC436. Overview Purpose Design Specification Software Engineering.

Similar presentations


Presentation on theme: "Super Pong Andrew Dunsmore CSC436. Overview Purpose Design Specification Software Engineering."— Presentation transcript:

1 Super Pong Andrew Dunsmore CSC436

2 Overview Purpose Design Specification Software Engineering

3 Purpose Waste Time Kill Twenty Minutes Something to do besides homework

4 Super Pong Video ping pong Players move paddle to intercept ping (ball) If the ping is missed, opponent scores a point Played until a player scores a set number of points

5 But what makes it SUPER? User level options Sound Effects Multi-Player Physics Models Ping Motion Boards (pre-defined and user-created)

6 Sounds Default or user-defined Categories can be set independently –External/Internal Wall Impacts –Own/Opponent Paddle User-defined sounds limited to digital (wav) of a set length

7 Single/Multi-Player Single player games can be played at 3 levels of difficulty Multi-player options –Direct connect using IP addresses –Connection to server program Multi-Player communication using Windows Sockets

8 Artificial Intelligence Model AI model not yet determined 2 possible Models Random Intelligence Instead of AI, the computer player randomly chooses not to try to hit the ping Time-deferred guessing Computer calculates expected position using pings current position and dx and dy Data can not be acted upon for dt, then must wait to gain more data

9 AI Model (continued) The choice of AI Model will be based on 2 metrics –Realism: the user should not be aware when the computer chose not to hit the ping –Difficulty rating: algorithm must ensure that Amateur games are easy and Expert games are hard

10 Multi-Player Issues Utilizes Windows Sockets At a minimum the game must communicate: –Both paddle positions –Ping position Issue: –User’s screen resolution is based on their desktop settings –Points will need to be translated between different resolutions

11 Physics Models User can choose from 3 different models True –Angle of reflection = -Angle of incident Pool –Angle of reflection is based on angle of incident, speed of ping, and firmness of bumper –Bumper firmness can be set by user as a percentage – 100% firmness will behave like True model Crazy –Angle of reflection is random

12 Ping Motion (or Physics II) Ping motion can be set by user Motion can be static, free rotate, or incident rotate Ping will begin rotating if: –Paddle is in motion at time of collision –Low incident angle with a wall A ping’s rotation will affect its reflection angle

13 Boards User can pick from 6 pre-defined boards User-created boards also possible with included sub-program

14 Board Customization Included board creation sub-program will be similar to MS Paint Brush Differences: –Area will be defined by fixed grid –A cell in grid is either filled or blank –Only half of board needs to be designed – other half of board is a mirror image Details: –Mirror image used to ensure equality for both players –Grids used to ease board recognition by program –For diagonal filled boxes, user can hit a button and computer will half fill adjacent boxes For multi-player games, if other player doesn’t have the board, the program will automatically send it

15 SE – Finite State Machine Game Init: Setting variables when game is loaded into memory Game Menu: Resting point for the game – executes menu commands Game Starting: Scores, Timers, etc. reset Resources acquired for Game Run Game Run: Handles the bulk of the game’s instructions, physics, video, etc. (typically ran every 1/30 second) Game Restart: Displays winner, releases resources used in Game Run Game Exit: Releases all resources and returns control to the OS

16 The FSM and OO C++ The Finite State Machine smoothly translates to Object Oriented languages The states become C++ functions Game Init = game_init Game Menu = handled in WinMain Game Starting = handled in game_main Game Run = game_main Game Restart = handled in game_main Game Exit = game_shutdown

17 Pseudo Code const int GAME_STATE_START = 0 const int … int state; game_init() { // initiate run-time variables: state = GAME_STATE_START; } game_main() { // note: this function is called on each frame // typically every 1/30 seconds switch (state) { case (GAME_STATE_START) // set variables for a new game // and set up the new board state = GAME_STATE_RUN; break; … } game_shutdown() { // this function releases all resources // and returns control to the OS SendMessage(…); } WinMain() { // set up window CreateWindowEx(…); // get resources and set initial variables game(init); // enter the main game loop while(1) { if(WM_CLOSE) { // if exit msg received game_shutdown() // end the game return(0); } // end if game_main() // else call the main game // function } // end while() }

18 Super Pong Drew Dunsmore CSC436 ?Questions?


Download ppt "Super Pong Andrew Dunsmore CSC436. Overview Purpose Design Specification Software Engineering."

Similar presentations


Ads by Google