ADVENTURE - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

ADVENTURE

Description:

(NOTE: It will make your life a lot easier if you think of y as the up and down coordinate) ... Exactly like what you did in Tetris! ActionMaps InputMaps = Awesome ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 16
Provided by: meredithj
Category:
Tags: adventure | tetris

less

Transcript and Presenter's Notes

Title: ADVENTURE


1
ADVENTURE
  • THE MOST A-MAZE-ING GAME
  • OF YOUR LIFE
  • Your Adventure TA Team
  • Tatyana
  • Andrew
  • Alex
  • Arushi
  • Laura
  • Tyrell

2
Basic Requirements
  • A randomly generated maze
  • A goal
  • At least 2 non-player characters
  • Items
  • User Manual
  • How are we going to do all this???
  • You use the ThreeD Package!

3
ThreeD World Overview
  • Coordinate System Diagram
  • (NOTE It will make your life a lot easier if you
    think of y as the up and down coordinate)
  • Vectors
  • Represented by cs015.ThreeD.Vector class
  • NOT the same as a java.util.Vector
  • More like a vector from Math or Physics
  • Uses three values to represent a direction and a
    distance
  • Constructor takes x,y,z values
  • Vector Example

y
x
z
4
Viewing Your 3-D World!
  • Scene
  • A container for all of your 3D objects!
  • All your shapes, lights, and camera will live
    here
  • Think 3D Graphics Collection!
  • Camera
  • Eye Point the location from which to see scene
  • Look Vector Direction to look
  • Up Vector defines which direction is up
  • Window
  • Displays what the camera is pointing at
  • A window into the scene
  • Think 3D Drawing Panel!
  • Lights
  • Location where the light is located in world
    space
  • Color The color of the light emitted

5
Camera/Window/Scene????
scene
window
camera
NOTE wide viewing angle lots of distortion
6
Your ThreeD World
  • Your Containers
  • ThreeD.Scene
  • stores all of your shapes
  • all objects will have a reference to it
  • you only need ONE
  • ThreeD.Window
  • similar to a DrawingPanel
  • each window can only have one camera
  • for multiple simultaneous views, you need more
    than one Window
  • You will probably want simultaneous view
  • Your ThreeD.WorldObjects
  • translate(Vector vec)
  • moves object through space by desired amount
  • translateInternal(Vector vec)
  • translates the shape relative to its internal
    coordinate system
  • rotateY(double angle)
  • rotates the shape around a vector going through
    the center of the shape, parallel to the Y-axis
    of the world
  • same for X and Z

7
ThreeD.WorldObject
  • scale(double amount)
  • scales the size of a shape by a uniform amount
  • amount 1 makes object grow
  • amount
  • fitToUnitCube()
  • scales a shape to fit into a unit cube
  • youll probably want to use this often if not
    always to make your objects fit in your maze
    correctly
  • To color your shape use setDiffuse(Color color)
    from ThreeD.Attributes.Appearance
  • _shape.getAppearance().setDiffuse(
  • new ThreeD.Color(0.8, 0.4, 0.4) )
  • ThreeD.Camera
  • setViewAngle(double degrees)
  • sets the zoom, max at 180, default at 60
  • we recommend 60 or less, otherwise your objects
    look distorted
  • orient(Point eyePt,Vector lookVec,Vector upVec)
  • eyePt - position of the camera in the world
  • lookVec direction that the camera is looking
    at

8
Creating Rooms and Connections
  • Creating A Room
  • How do you create a Room?
  • You create walls, doors, etc around it. We call
    these connections
  • Rooms and Coordinates
  • This is tricky
  • The x and z coordinates of a Room define its
    center point. The y coordinate defines how high
    the floor is.
  • For your rooms, most of the time y 0
  • Connections and Coordinates
  • Also tricky
  • A Connection is defined by the coordinates of the
    two Rooms it connects.
  • The support code takes care of positioning
    connections as long as you give it the
    coordinates of the Rooms.
  • Did we mention this is tricky?
  • Lets see an example

9
Room Example
Overhead view! Y axis points towards you.
  • So where is a Room at (1,0,1) ?
  • Right there!
  • What would be the two rooms defining the top wall
    of this room?
  • (1,0,1) and (1,0,0)
  • Super Tricky suppose we have a room at (3,0,0).
    What two rooms define the top wall of this room
    (the outer wall of the maze?)
  • (3,0,0) and (3,0,-1)
  • Weird!

10
Additional things to think about...
  • ThreeD.Behaviors
  • Perpetual (executed continuously until removed)
  • Definite (breaks up movement into many steps --
    makes for smooth transitions)
  • Many subclasses like rotateX, translate, etc.
    help you make smooth transitions
  • You may also use ThreeD.Animator, thats
    basically the same thing as a ThreeD.Behaviors.Per
    petual
  • Keyboard Input
  • Exactly like what you did in Tetris!
  • ActionMaps InputMaps Awesome
  • When in doubt....check out the ThreeD docs linked
    off your friendly Adventure homepage!

11
Your Adventure Inheritance Diagram
12
Drunken Walk Algorithm
  • So how do we put this maze up anyways?!?!
  • .The Drunken Walk Algorithm!
  • Hmmmm..
  • Sounds like fun!
  • Tell me more...

13
More Drunken Walk
  • Array of rooms starts null, call drunkenWalk()to
    create the first room.
  • drunkenWalk (int row, int col)
  • Make a room
  • In the room, randomize order of directions in
    which to build connections
  • You will need to store your randomized list of
    directions (left, right, back, forward),
  • You will also need to store your connections (for
    example to the left there is wall, to the right
    there is door, back corridor, etc)
  • For each direction, decide what connection to
    make
  • 1) Check for array boundary
  • a) If room is on border, make a wall.
  • 2) Check to see if the next room is null
  • a) If null make an open connection in
  • current room
  • b) Recurse call drunken walk on new room
  • 3) If the room has been made already
  • a) If there is no connection already defined
  • by pre-existing room, make
    random
  • connection
  • b) If there is already a connection
    defined,

14
Yeah, maze!
  • Randomizing directions
  • Fill an array with directions
  • Swap two random locations for the array several
    times
  • Afterwards, go through the array and visit each
    direction

15
MAZE!!
Write a Comment
User Comments (0)
About PowerShow.com