FAMUFSU College of Engineering EEL 3705 3705 L

  • Slides: 16
Download presentation
FAMU-FSU College of Engineering EEL 3705 / 3705 L Digital Logic Design Spring 2007

FAMU-FSU College of Engineering EEL 3705 / 3705 L Digital Logic Design Spring 2007 Instructor: Dr. Michael Frank Modules #90 -99 (Extra Slides): Design Examples Module #93: Animated VGA Graphics– Ping-Pong Video Game 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 1

FAMU-FSU College of Engineering Ping-Pong Videogame Example Dynamic Display Generation, Layered Graphics, Controlled Paddle

FAMU-FSU College of Engineering Ping-Pong Videogame Example Dynamic Display Generation, Layered Graphics, Controlled Paddle Motion 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 2

FAMU-FSU College of Engineering Real-World Ping-Pong Table Image credit: Wikipedia 3/4/2021 M. Frank, EEL

FAMU-FSU College of Engineering Real-World Ping-Pong Table Image credit: Wikipedia 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 3

FAMU-FSU College of Engineering Ping-Pong Game Display Mocked-up here as a Powerpoint animation Ball

FAMU-FSU College of Engineering Ping-Pong Game Display Mocked-up here as a Powerpoint animation Ball Left paddle “Midline” Right paddle “Net” 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 4

FAMU-FSU College of Engineering Plan for Game Controls o Left pushbutton FLEX_PB 1 will

FAMU-FSU College of Engineering Plan for Game Controls o Left pushbutton FLEX_PB 1 will control left player’s paddle n o Held down = move down, released = move up Right button controls right paddle similarly 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 5

FAMU-FSU College of Engineering Plan for game’s “physics” o When the ball hits a

FAMU-FSU College of Engineering Plan for game’s “physics” o When the ball hits a wall, it bounces elastically n o Horizontal or vertical velocity will change sign When the ball hits a paddle… n Its vertical velocity (vy) will increase or decrease depending on which direction paddle is moving o o n Its horizontal velocity (vx) will change sign (bounce) o o 3/4/2021 Paddle moving up vertical velocity decreases Paddle moving down vertical velocity increases Its absolute value will increase if the ball hits near the center of the paddle (a “good hit”) Its absolute value will decrease if the ball hits near the edge of the paddle (a “glancing blow”) M. Frank, EEL 3705 Digital Logic, Fall 2006 6

FAMU-FSU College of Engineering Prioritized Color Layer Combiner o Allows one graphics object to

FAMU-FSU College of Engineering Prioritized Color Layer Combiner o Allows one graphics object to override another… 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 7

FAMU-FSU College of Engineering Table Surface Stipple Color Layer Generator o Pure green makes

FAMU-FSU College of Engineering Table Surface Stipple Color Layer Generator o Pure green makes for an overly bright table surface, so instead we use an XOR gate to create a green-on-black checkerboard stipple pattern implemented by this circuit 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 8

FAMU-FSU College of Engineering Game Display Generator (top half) Note we use two instances

FAMU-FSU College of Engineering Game Display Generator (top half) Note we use two instances of the color_mixer module to combine the outputs of the table, midline, and net renderers 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 9

FAMU-FSU College of Engineering Paddle Renderer (only left paddle so far) Left paddle is

FAMU-FSU College of Engineering Paddle Renderer (only left paddle so far) Left paddle is rendered as a 10× 50 pixel blue rectangle starting at y coordinate lpy (input) 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 10

FAMU-FSU College of Engineering Entire Ping-Pong Display Renderer (so far) Altogether we’re using three

FAMU-FSU College of Engineering Entire Ping-Pong Display Renderer (so far) Altogether we’re using three of our color_mixer modules in order to correctly combine the graphics on the playing surface, midline, net, and paddle layers. (default black background) green stipple Increasing graphics layer priority white midline black net blue paddle 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 11

FAMU-FSU College of Engineering Left Paddle Controller Circuit Comparator allows paddle y to be

FAMU-FSU College of Engineering Left Paddle Controller Circuit Comparator allows paddle y to be updated iff its new value is in the range [0, 480− 50] = [0, 430] 3/4/2021 Adder increments/ decrements paddle y coordinate in direction determined by pushbutton #1 M. Frank, EEL 3705 Digital Logic, Fall 2006 12

FAMU-FSU College of Engineering Top-Level Circuit for Ping-Pong Game (so far) 3/4/2021 M. Frank,

FAMU-FSU College of Engineering Top-Level Circuit for Ping-Pong Game (so far) 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 13

FAMU-FSU College of Engineering Demonstration of Game Display (so far) o We can hook

FAMU-FSU College of Engineering Demonstration of Game Display (so far) o We can hook up the board directly to the lecture hall video projector in order to demonstrate the left paddle’s live functionality to the class… 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 14

FAMU-FSU College of Engineering Ping-Pong Ball Sprite Design Planning the bitmap 0 0 0

FAMU-FSU College of Engineering Ping-Pong Ball Sprite Design Planning the bitmap 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 1 0 0 0 3/4/2021 M. Frank, EEL 3705 Digital Logic, Fall 2006 Approx. on-screen appearance DEPTH = 10; WIDTH = 10; ADDRESS_RADIX = HEX; DATA_RADIX = BIN; CONTENT BEGIN 0 : 0001111000; 1 : 011110; 2 : 011110; 3 : 11111; 4 : 11111; 5 : 11111; 6 : 11111; 7 : 011110; 8 : 011110; 9 : 0001111000; END; ball_sprite. mif 15

FAMU-FSU College of Engineering Still to do on ping-pong game… o You might like

FAMU-FSU College of Engineering Still to do on ping-pong game… o You might like to try some of these yourself! n n Add 2 nd, red paddle on right, controlled by PB 2 Create a ball object, implement game physics o n n Add a scoreboard using the 7 -segment display Hook up an external speaker to the expansion bus o Done except for red paddle movement 3/4/2021 Adjust movement speeds for best playability and generate “beep” sounds when the ball bounces off a wall or a paddle or goes out of bounds M. Frank, EEL 3705 Digital Logic, Fall 2006 16