3/24/2006eecs150 lab lecture #101 game engine eecs150 spring2006 lab lecture #10 guang yang

23
3/24/2006 EECS150 Lab Lecture #10 1 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

Post on 20-Dec-2015

226 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 1

Game Engine

EECS150 Spring2006Lab Lecture #10

Guang Yang

Page 2: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 2

Project Status

Check Point 1

N64 Controller

Interface

Check Point 3

Chipcon RF

Transceiver

Check Point 4

Game Engine

Block Diagram of the Design

VideoRAMCheck Point 2

NTSC Video

VideoRAM

Page 3: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 3

Checkpoint 4 Basic Requirements

2-player wireless Tron Being able to find an opponent and

start playing Display the game and scores

Extra Credits There is a list of features in cp4 doc Feel free to add extra features. Talk to

TAs about extra credits BEFORE you do it.

Page 4: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 4

First thing first

100% Freedom 0% Freedom

Page 5: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 5

Game Setup Game Board Setup

Page 6: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 6

Game Board (1)

Internal game board representation It is in the engine. You can decide.

One possible way Use RAM to store the board data See the reference RAM implementation in cp4 zip file

Page 7: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 7

Game Board (2) For each point on the board, use 2

bits to represent its status

Value Meaning

00 Not yet visited

01 Visited by myself

10 Visited by opponent(s)

11 Board border

Page 8: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 8

Wireless Tron Two main

phases

Initialization Phase

Game Playing Phase

In channel 0• Initialize the board

• Find an opponent

• Select another channel for playing the game

• Go there

In channel 1~15• Maintain a

GameIndex

• Send your position and GameIndex

• Receive those from your opponent

• Update the game

• Game over. Go back to Initialization phase

Page 9: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 9

Initialization Phase

Init Board

Listen to Channel 0 for 1 sec

Send Acknowledge with (random)

ch#1~15

Receive an Invitation

Listen to Channel 0 for 1 sec

Change to new

channel

Receive a Confirmation

Wait 1 secPlay Game

Timeout

Send InvitationListen to Channel 0 for 1 sec

TimeoutTimeout

Send Confirmation

Save ch#

Receive an Acknowledge

Player1Player2

Page 10: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 10

Initialization Phase Packet formats standardize the 32-bit

payload. You need to decide the proper source address and destination address.

8’h80 8’h00 8’h00 8’h00InvitationPacket

where N is the channel number ranging from 1 to 15.

8’h80 8’h00 8’h0F 8’h0NAcknowledgePacket

8’h80 8’h00 8’hF0 8’h0NConfirmationPacket

Page 11: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 11

Wireless Communication

!!! UNRELIABLE !!! You must add redundancy to make

it reliable Send every packet multiple times.

We start with packetRepeatTimes = 3. You can experiment later on to find out the optimal value.

Page 12: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 12

Administrative Info (1) Checkpoint 3 due in the week after

spring break in lab 50% off one week later Plan out a design for checkpoint 4

No design review, but should be useful for project writeup

Considering extra credit? Plan for it Design consideration Time allocation

Page 13: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 13

Administrative Info (2)

Project grade breakdown Checkpoint 1: 10% Checkpoint 2: 15% Checkpoint 3: 30% Checkpoint 4 / Final Checkoff: 30% Report: 15%

Page 14: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 14

Administrative Info (3) Extra credit

Up to 20% of total project grade Due at the same time as your CP4

check-off (either early or standard check-off)

Not eligible unless you complete all previous required project work. (Single student groups can submit the blackboxes we gave you.)

Page 15: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 15

Game Playing Phase Parameters

Packet repetition timespacketRepeatTimes = 3

Car moving speedspeed = 10 pixel/second

You could try different values later To synchronize the moves of both

players, introduce a GameIndex. It starts from 0, and increment after moving one pixel ahead

Page 16: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 16

Game Playing Phase

GameIndex=0 Set init position

Make the move;

Increment GameIndex

GameIndex matches

End Game. Update Score

Check Game Status for the New Positions

Init Phase

Start Game

Send Position Update Packets

No valid packet received in one second

Receive Position Update Packets

You need to arbitrate

GameIndex does not match

Both alive

At least one dies

Start button pressed on

N64

Page 17: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 17

Game Playing Phase

Packet Format

1’b0 15’b GameIndex

8’h col 8’h rowPosition Update Packet

Page 18: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 18

VideoRAM You are free to choose any

implementation For your reference, in our

implementation, we have dedicated groups of signals for Read/Write car positions, and for Write characters on the screen

Refer to the Checkpoint assignment for detailed port information

Page 19: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 19

Extra Credit Some extra credit options

EARLY CHECKOFF (5%) Week of 4/10 to 4/14

Multiplayer (>=4) game (7%)For this one, you need to modify communication protocols and/or packet formats

Audio (5%) Viewpoints (5%) Finite wall (like snake) (3%) …

Check webpage for more options Up to 20%

Page 20: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 20

Project Tips (1)

Design Get used to debugging An unverified module is useless Refer to lab4 and lab5 Start from SIMULATION

Testing Multiple boards, different addresses,

different orderings, etc.

Page 21: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 21

Project Tips (2) Requirements

Finish these first Make sure it works well

Shouldn’t depend on a certain N64 controller Should work on multiple boards

Extra Credit Finish early, it’s worth 5% Keep your required version separate

Don’t touch it while you work on extra credit!

Page 22: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 22

Project Writeup Includes

Block diagrams Bubble-and-arc diagrams Comments NO SCHEMATICS (They’re too detailed) Use your design reviews!

Documentation helps you debug Also makes it easier for us to help you

More details will be posted later

Page 23: 3/24/2006EECS150 Lab Lecture #101 Game Engine EECS150 Spring2006 Lab Lecture #10 Guang Yang

3/24/2006 EECS150 Lab Lecture #10 23

Enjoy your spring break and/or

Wireless Tron