Due: Aug 8 Wed 11:59pm (Midnight)
1. Submission and Grading Instructions
1.1 Final Code
• The project must be named (in Eclipse) with the following format
LabNumber_FirstName_LastName_AssignmentNumber _FInal_StudentNumber, e.g.
D104_Jim_Silvester_Assignment4_Final_1234567
• For the code the entire project MUST be submitted (not just the source files)
• To submit, export the project (including all the libraries used) into a zip file (Archive
File) and name it exactly the same as the project name
(Please note failure to meet any of these submission requirements above would
result in a penalty of 0.25 pt each)
• No late submission will be accepted. If you do not complete the assignment by the
deadline, you will receive 0. For a legitimate reason a late submission might be allowed
pending discussion with your TA before the deadline. You may be required to provide
supporting documents.
• For the coding, make sure your code is syntax error free so that it runs properly on the lab
machine. You would receive 0 for the assignment if your code failed to run due to either
syntax errors or runtime exception.
Grading for Milestone 1: Will be done by a quick demo to TA during week 13 lab – make
sure you attend to get marks.
2. Overview of the Assignment
A4 Big picture: You will continue working on your simulation from and Assignment
4 Milestone 2.
You will learn how to build user interface using Java Swing components, and how to
control functionality of your program via UI. You will also expand on the
functionality of the simulation by enriching its content with more media types (e.g.
irregular, complex shapes, images, audio etc.), more intelligent features (e.g. sorting
and search), and some more advanced concepts (e.g. exception handling, design
patterns etc.)
This final assignment will go three iterations: milestone 1 (one week), milestone 2
(one week), and final code (two weeks).
2.1 Learning objectives for Milestone 2
By doing this assignment you will learn how to:
• Use packages to organize code properly
• Create objects using factory pattern
• Add features dynamically using decorator
• Create custom irregular shapes
• Add sound effects to the simulation world
2.2. Programming Requirements
In the final code, you will make your simulation rich in application of multimedia, must
include texts, custom shapes, sound effects, and more importantly interesting microanimations
(e.g. wing flapping, tail wiggling, leg alternating etc.) and sensible
interactions that are appropriate in the environment.
I. Coding requirements
1) At least 4 named packages (default package is NOT allowed) that group your
classes properly (e.g. main, garden, pond … - create descriptive packages that
fits to the theme of your own application)
2) Follows strict naming convention for package (please note it’s different from
the rest constructs), classes, methods and variables
3) For major objects including preys and predators must be created using
factory pattern (no abstract class is required though)
4) Code must be refactored to have NO redundant code, esp. between
superclasses and subclasses, there should be no redundant fields and/or
methods that are the same or serve exactly the same functionalities
5) Use try-catch to handle potential runtime error, mainly NullPointerException
and IndexOutOfBoundsException. Please note if a runtime error as such
occurs at the beginning when launching your program, you will get 0, or lose
at least half of the total marks if it occurs in-between of its running.
II. Application requirements:
1) For the environment: you need to add at least two obstacles into your
environment, one of which should be in a concave (learn what it is yourself),
polygon shape done using GeneralPath*, another should be a complex
shape created using either Perlin noise* or recursion (for fractal)*. Your
creatures (both preys & predators) need to move around these obstacles
using a fluid motion without bumping into or turning abruptly (i.e. no
bouncing but pre-sighted avoidance) from these obstacles. Resize your
environment to be large enough to accommodate all the features as
specified above and further below.
2) You need to place a proper imagery (graphic drawing or an image) into the
background that reflects features of the simulated environments, which
should have appropriate animations (e.g. sun shining, cloud variations, sea
weed waving, bubbling up and popping etc.)
3) You should involve using decorator pattern to add at least two features to
preys and predators respectively at run time, as a result of either mutual
interaction between creatures (e.g. features added on based on eating or
eaten activities etc.) (preferred and high credited), or user actions (e.g. by
clicking some buttons on control panel) (acceptable but low credited)
4) Graphical rendering: Your preys, predators and food should be rendered
with the quality expected from the polished graphically rich applications,
such as some professionally built games. Both preys and predators should (if
you haven’t done before) implement micro-animations (e.g. wing flapping,
tail wiggling, leg alternating etc.), which should have variations in their
regular search-for-food mode and escape-the-predator mode
5) You need to change creature’s behaviors when they are hungry or satiated,
based on their energy level. Instead of constantly following food, when they
are not hungry (satiated), they should take a rest by hanging around a fixed
location without hunting for food. They will go back to food hunting mode
once they become hungry again
6) Modify your textural display for each creature, to display only its energy level
and a status to indicate either hungry or satiated. The textural label should
be in different colors for the two status for hunger or satiation, and it should
gradually transition from one to another depending on changes of the
energy level
7) Add sound effects* to all interactions (e.g. eating, shooting etc.) in the
process and some ambient sound for the environment (e.g. bird singing,
cricket twitching, animal howling for forest) that should keep on going
* These topics will be covered in week 13’s lecture. Stay tuned.
III. Bonus (Up to 4pts)
You can win up to 4 bonus points if you can simulate the flocking behavior. It
means creatures move in groups, such as flock of birds, school of fish, herd of
wildebeests, etc. The movement of each creature depends on the movement of their
neighbors. The movement of each creature is determined by three forces: attraction
force to other creatures (to keep them together), repulsion force from other
creatures (to keep them apart), and speed of movement (to keep them moving in
same direction).
For you reference: the algorithms and formulas are described in Chapter 6, section
6.13 of Shiffman’s book (http://natureofcode.com/book/chapter-6-autonomousagents/).
Here is another paper that describes the forces:
https://www.red3d.com/cwr/boids/
Please put a comment in your environment panel class for the bonus feature if
implemented, or you may not get the credit because of overlooking.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。