180 likes | 309 Views
Chris Orona CS 491B June 2, 2005. Game Components. Introduction Storyline Objective System Game threads Scheduling Characters Player ships and weapons Enemies and paths Software Issues Technical Background Technical Issues Deployment. Storyline Introduction.
E N D
Chris Orona CS 491B June 2, 2005
High Score 30000 Game Components • Introduction • Storyline • Objective • System • Game threads • Scheduling • Characters • Player ships and weapons • Enemies and paths • Software Issues • Technical Background • Technical Issues • Deployment
High Score 30000 Storyline Introduction • Aliens are attacking Earth! Last time, a lone space ship attempted to save mankind from aliens. Now the aliens are back with reinforcements. Now it’s up to you to eradicate this threat to humanity once and for all!
High Score 30000 Gameplay • Player earns points by defeating enemies. • Player starts with 4 lives, when hit by an enemy, the player loses a life. • Lose all your lives, and the game is over. • Pickup powerup weapons to improve your destructive powers.
High Score 30000 Redraw Screen Game Threads Wait for next event Keyboard Mouse Run next event Cheats Any more events? Yes No Scheduler Thread Update Thread Input Thread
High Score 30000 Game Threads (cont.) • Level Threads Score Panel Action Panel Background Panel • Character Threads
High Score 30000 Level Scheduler Design • How the scheduler works • Implemented using a PriorityQueue • Inserts objects in a tree sorted by run time • Schedules the introduction of enemies, powerups, or the end of timed levels • Some enemies schedule events when they die
High Score 30000 Powerups • Weapon Cycling • Each ship has certain weapons it may use • Additional Lives • Shielding • Protects from enemy attacks for a short while
High Score 30000 Collision Detection bounding box hit detected • Bounding Box check • x, y, height, width of shots are compared to the enemies’ coordinates.
High Score 30000 Enemies • Equipped weapon • Some enemies will fire at the player, these shots are considered enemies. • Enemy Health • Amount of hits required to destroy the enemy • Corporeality • Some “enemies” should not be allowed to be hit! This includes enemy shots, explosions, and powerups. • Defeat • Award points, and special death events • Path • Movement pattern assigned to an enemy.
High Score 30000 (x1, y1) (x2, y2) (x3, y3) (x4, y4) Enemy paths • Paths • Collection of points for movement • Different paths can be plugged into any object (except the ship) • Basic Types • Straight Line • Oscillating • Random
High Score 30000 Shot Paths (x0, y0) (x1, y1) Δy = y1- y0 Δx = x1- x0 Is |Δy| * aspect > |Δx|? (y1’ - y0) = (Δy/ Δx)(x1’ - x0) (x1’, y1’)
High Score 30000 (x1’, y1’) θ0 = atan2(y1 - y0, x1 - x0) c d’ θ0 ′ = atan2(c, d) x1′ = d’′ cos(θ0 +θ0 ′ )y1′ = d’′sin(θ0 +θ0 ′ ) (x2’, y2’) θ0’ d θ0 Zigzag Paths (x3, y3) (x2, y2) (x1, y1) (x0, y0)
High Score 30000 Technical Background • Language • Uses Java for cross-platform compatibility • Minimum version is Java 5 • Java 2D API and Java Sound API • Based on an earlier project • Java 1.2 with limited capability
High Score 30000 Technical Issues • Using Java2D shapes is much faster than bitmap images. • Objects are reused whenever possible. • Sprite and Sound caches • Lowering the refresh rate of threads improves performance.
High Score 30000 Java Web Start • Deploy Java programs online using Java applications rather than applets • Enables automatic updates by checking the web server for a more recent version • Can be accessed as a shortcut on the desktop • Configured through the use of a JNLP file (which is XML format) • MIME type: application/x-java-jnlp-file
High Score 30000 Java Web Start Configuration File <?xml version="1.0" encoding="utf-8" ?> <jnlpspec="1.5+" codebase="http://cs.calstatela.edu/~corona/cs491/" href=“DeepSpace2.jnlp"> <information> <title>Deep Space 2</title> <vendor>C. O.</vendor> <homepagehref="http://cs.calstatela.edu/~corona/cs491/" /> <descriptionkind="short">Deep Space 2 - the game</description> <iconhref=“DeepSpace2.gif" width="50" height="50" /> <offline-allowed /> </information> <resources> <j2seversion="1.5+" initial-heap-size="8m" /> <jarhref="DeepSpace2.jar" /> </resources> <security> <all-permissions /> </security> <application-descmain-class="DeepSpace2.GameManager" /> </jnlp>
High Score 30000 References