Download Document

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Chris Orona
CS 491B
June 2, 2005
Score
200
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
Score
300
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!
Score
400
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.
Score
500
High Score
30000
Game Threads
Keyboard
Wait for
next event
Mouse
Cheats
Run
next event
Redraw
Screen
Any
more events?
Yes
No
Update Thread
Input Thread
Scheduler Thread
Score
600
High Score
30000
Game Threads (cont.)
Level Threads
Score Panel
Action Panel
Background Panel
Character Threads
Score
700
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
ScheduledItem
stime
50
sitem
spoint
(400, 0)
spath
StraightPath
Score
800
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
Score
900
High Score
30000
Collision Detection
bounding box
hit detected
Bounding Box check
• x, y, height, width of shots are compared to the
enemies’ coordinates.
Score
1000
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.
Score
1100
High Score
30000
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
(x1, y1)
(x2, y2)
(x3, y3)
(x4, y4)
Score
1200
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’)
Score
1300
High Score
30000
Zigzag Paths
(x3, y3)
(x2, y2)
(x1’, y1’)
θ0 = atan2(y1 - y0, x1 - x0)
d  (x 1  x 0 )2  (y 1  y 0 )2
c
(x1, y1)
d’
θ0 ′ = atan2(c, d)
d   d 2 c 2
(x0, y0)
θ0 ’
θ0
d
(x2’, y2’)
x1′ = d’′ cos(θ0 +θ0 ′ )
y1′ = d’′sin(θ0 +θ0 ′ )
Score
1400
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
Score
1500
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.
Score
1600
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
Score
1700
High Score
30000
Java Web Start Configuration File
<?xml version="1.0" encoding="utf-8" ?>
<jnlp spec="1.5+" codebase="http://cs.calstatela.edu/~corona/cs491/"
href=“DeepSpace2.jnlp">
<information>
<title>Deep Space 2</title>
<vendor>C. O.</vendor>
<homepage href="http://cs.calstatela.edu/~corona/cs491/" />
<description kind="short">Deep Space 2 - the game</description>
<icon href=“DeepSpace2.gif" width="50" height="50" />
<offline-allowed />
</information>
<resources>
<j2se version="1.5+" initial-heap-size="8m" />
<jar href="DeepSpace2.jar" />
</resources>
<security>
<all-permissions />
</security>
<application-desc main-class="DeepSpace2.GameManager" />
</jnlp>
Score
1800
High Score
30000
References
Programs
J2SE Development Kit
http://java.sun.com/
Eclipse IDE
http://www.eclipse.org/
Audacity Sound Editor
http://audacity.sourceforge.net/
References
Java2D
http://java.sun.com/products/java-media/2D/
Java Sound
http://java.sun.com/products/javamedia/sound/index.jsp
Java Web Start
http://java.sun.com/j2se/1.5.0/docs/guide/javaws/
Video Game Music
http://www.vgmusic.com/