+ All Categories
Home > Documents > Object Oriented Design. Goals Feedback homework 8 Top Down Design: analyzing the requirements ...

Object Oriented Design. Goals Feedback homework 8 Top Down Design: analyzing the requirements ...

Date post: 21-Dec-2015
Category:
View: 216 times
Download: 3 times
Share this document with a friend
23
Object Oriented Design
Transcript
Page 1: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Object Oriented Design

Page 2: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Goals

Feedback homework 8 Top Down Design: analyzing the requirements Bottom Up Design: refactoring fundamental

OpenGL functionality

Page 3: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

The makings of the glutplane

Assumption: runtime environment is set up Windows: GL4Java*.dlls installed Mac: GL4Java*.zips installed in MRJClasses

Find file “glutplane.java” and “glutplane.html”

Install compile/link time environment Windows: add GL4Java.jar to classpath Mac: add GL4Java*.zips to project

Page 4: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Tools

Basic level tools Javac (part of Sun’s JDK) Jikes: http://www.research.ibm.com/jikes/

IDEs Jbuilder (Windows, OS X) CodeWarrior (Windows, OS X, OS 9, …)

Page 5: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Modify source

Edit “glutplane.java” Replace 3 calls to add_plane(); with 20 calls

Hint: use a “for” loop instead of typing add_plane(); 20 times! Compile/run/test Upload binary files (.class) and .html file to Web server

glutplane.class glutplane$planeobj.class glutplane$glutplaneCanvas.class

Test applet on server email URL referring to html file.

Page 6: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

More information

Provided by the Game Engine builders http://schenkc.freeshell.org/classes/csci4448

/contra/installation.html

Chris Schenk: [email protected] Luke Swanson: [email protected]

Page 7: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Top Down Requirement Analysis

Collect what the different applications/games need to have from the Game Engine

Danger: Getting carried away Creating specification that cannot be

implemented (in time, within budget, …)

Page 8: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Requirement for Game engine

Camera aimed at character Multiple cameras

Shapes Aggregate shapes Rotation of shapes and camera Collision detection IIII Clipping Physics II

Particles Text Infinite backgrounds (repetitive textures, sky domes, …) Foreground/messages/score keeping

Page 9: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Camera Control

Multiple cameras Switching between cameras: no gui

Camera tracking (stay on object) zoom Multiple views at the same time Independent control of camera

Page 10: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Shapes

Box, sphere, circle, rectangle, plane, line, point, cylinder, triangle strip,

Single / aggregate shapes Rotation Move in scene Add textures to shape Loading models

Load .obj files

Page 11: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Collision Detection iii

Detect collision of shapes and groups of shapes

Approximation with spheres Cubes

Page 12: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Clipping

no

Page 13: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Physics

Particles Airplanes, skis, bikes Simple gravity (would be nice)

Page 14: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Text

no

Page 15: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Backgrounds

Flat but repetitive Sky domes, Sky boxes

Page 16: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Information panels

Score keeper Output message Dialogs (hard)

Use OpenGL, Swing or AWT? Menus (hard)

Use OpenGL, Swing or AWT?

Page 17: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Bottom Up system design

Refactor existing functionality (the OpenGL mega blob) into service classes

Approach: look at instances of applications containing functionality that could be factored out of the application into a the middle ware layer => the Game Engine

Danger: Feature oriented: contrast between cool and necessary

functions

Page 18: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Refactoring textured square example

Basic structure of OpenGL application is give by init, display, and reshape

Look for code that, in generalized form could be pushed into game engine

=> collect these operations and attributes in a class called glWindow

Page 19: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

INIT

Collect a set of good initializations that make sense for most applications

Turn most features ON (lighting, texture mode)

In worst case application can overwrite or extend INIT

Page 20: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

DISPLAY

Refactor display method into preDisplay:

low level initializations that most applications would need anyway, e.g, clearing buffer.

Translating, rotating individual objects

mainDisplay: leave this to application to specialize postDisplay:

Cleanup, error handling Buffer swapping (to implement double buffering)

Page 21: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Factor out utility functions

Example: texture manager Replace complex implementations of

texture loading with single calls of texture managing functions located in middle ware (game engine)

Page 22: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Produce new application with middleware stuff

removed

Page 23: Object Oriented Design. Goals  Feedback homework 8  Top Down Design: analyzing the requirements  Bottom Up Design: refactoring fundamental OpenGL functionality.

Homework PROJECT:

Finish game proposal document Email to Alex & Andri Due: November 12

READING: OpenGL Red book chapter 3; Viewing http://fly.cc.fer.hr/~unreal/theredbook/ Due: November 12


Recommended