Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
CSCI 204 – Project 3 - Galaxy Conflict by Alex Fuchsberger
Introduction
In a galaxy far far away...
The galaxy is in turmoil. Thousands of star systems have declared their independence. Everywhere new weapon facilities
and shipyards are pushing out tools of mass destruction. It is only a matter of time until our beloved homeworld will be
eradicated from existence. We are a nation of peace and prosperity and not prepared for an all out war with our rebelling
colonies. Our government has entrusted you to prepare and design a fleet that will ensure the survival of our species and
continued dominance in the cluster…
In this project we are going to implement a complex space
battle simulation in multiple phases. Two opposing fleets will
clash and fight for survival. Only one will prevail, who is it
going to be? You will have to create Spaceships and equip
them with modules such that they are effective in bringing
down your opponents before they can bring down yours. In
the final stage we will let each commander (yes, that is you)
test out their fleet composition in a fair battle against each
other and see who really has the skills to become grand
admiral of our starfleet! A grand prize awaits the most capable
commander and his or her designs will ensure the safety of
future generations to come!
This project consists of multiple phases:
1. Create several Ship and Weapon classes and build a fleet.
2. Create a Battle Simulator that will schedule the firing of weapon systems and handle basic combat
3. Improve your Battle simulator by adding a sophisticated Targeting-Computer that will allow your weapon systems
to do maximum damage to an enemy with known capabilities
Timeline Due Points
Phase 1: “Imminent Doomstacks” Fr, 4/8 11pm 36
Phase 2: “Advanced Battle Simulator” Mo, 4/18 11pm 29
Phase 3: “Autonomous Target System” We, 4/27 11pm 35
Extra Credit: Doomsday Showdown We, 4/29 in class (5)
Important: All phases are submitted via Gradescope but must be implemented in replit. Phases 1 and 2 will also be
auto-graded via Gradescope. You have the choice of submitting each phase (and not altering your submissions afterwards)
by the phase deadline for 100% of the score or submit it until the final phase deadline for 80% of the score.
CSCI 204 Project 3 - Galaxy Conflict 1
Overview
On this page we list the TODOS for the three phases and what to submit. For all three phases you will work in the same replit.
Before getting started with the project you should study all given files to get an overview of the project.
For phase 1 you need to deliver the following files via gradescope:
● specs/ships.py (contains your Ship, Fighter, Destroyer, Cruiser, Battleship classes)
● specs/weapons.py (contains your Weapon, Torpedo, Laser, Railgun classes)
● specs/fleet.py (create your read_fleet_file method)
For phase 2 you need to redeliver the following files via gradescope:
● specs/weapons.py (resubmit with updated fire method)
● specs/fleets.py (updated Fleet class with more methods for GUI output)
For phase 3 you need to deliver the following files via gradescope:
● computers/student.py (contains your target computer)
● fleets/student.txt (contains your fleet composition)
● README.md (feedback and explanations)
Weapon Properties/Attributes Ship Properties/Attributes Fleet Properties
self.ship (phase 1)
self.damage (phase 1)
self.accuracy (phase 1)
self.target (phase 1)
class properties:
hull_modifier (phase 1)
armor_modifier (phase 1)
shield_modifier (phase 1)
cooldown (phase 1)
self.fleet (phase 1)
self.weapons (phase 1)
self.max_hull (phase 1)
self.max_armor (phase 1)
self.max_shields (phase 1)
self.pd (phase 1)
self.evasion (phase 1)
self.hull (phase 1)
self.armor (phase 1)
self.shields (phase 1)
class properties:
cost (phase 1)
self.name
self.ships
Weapon Methods (you need to impl.) Ship Methods (you need to implement) Fleet Methods (you need to implement)
fire (phase 2) __init__(self) (phase 1)
__str__(self) (phase 1)
read_fleet_file() (phase 1)
get_stats() (phase 2)
get_weapons() (phase 2)
__str__() (phase 2)
Table 1: Class Attributes
student.py (phase 3) only contains a single function set_targets(attackFleet, targetFleet) that you need to complete.
Good luck to you and good fortune to us all… May we survive the battles to come…
CSCI 204 Project 3 - Galaxy Conflict 2
Phase 1 - “Imminent Doomstacks”
Our shipyard has delivered us clear specifications of ship types they can produce. Types vary in size and purpose and can hold a
number of modules. Every ship has a hull, armor and shields. An attacker needs to first overcome the ship’s shield barriers. Once the
shields are down, the armor can be damaged. A ship without any armor remaining is vulnerable to hull damage. Should the hull
integrity fail the ship is destroyed. Every ship also has some maneuverability in the form of evasion - the ability to dodge an attack.
This is a percentage to avoid damage altogether.
1.1 Ship Types & Defense Modules
Fighter (F) The smallest ship in our armada can be produced cheap and fast. Because it is so fast it's really hard to target, thus most
normal weapons will miss. Unfortunately a direct hit usually means the end of it.
Destroyer (D) This small but capable attack ship can house two weapon slots and a defense slot. It is stronger and slower than a
Fighter but still maneuverable.
Cruisers (C) are offering great firepower and defense capabilities but lack the maneuverability of smaller ship types. They offer a
good combat strength for its cost.
Battleships (B) are massive warships that offer supreme firepower and are really hard to take down. They also cost a lot though
limiting their deployment in combat. Overcharging their weapons however takes time, thus aiming accuracy is decreased.
Here is an overview and comparison of ship specifications that you should implement:
Overview Fighter Destroyer Cruiser Battleship
Cost / Command Points 1 2 4 8
Weapon Slots 1 2 3 4
Defense Slots 0 1 2 3
Base Hull / Armor / Shields 100 300 600 1000
Evasion 80% 40% 20% 10%
Damage Multiplier 100% 100% 120% 150%
Accuracy (Lasers and Railguns) 100% 100% 90% 80%
Fire Priority First Second Third Last
Defense modules can increase armor or shields of a ship, boost its maneuverability, or provide a means to defend against torpedoes.
Here is an overview of the available defense modules.
Defense Modules Description
Shield Generator (S) adds 50% of base Shield to the shield value of the ship
Tritanium Armor (A) adds 50% of base Armor to the armor value of the ship
Ion Thrusters (E) doubles the evasion level of the ship (only one of these per ship allowed)
Point Defense (P) adds a 1/3 chance to shoot down incoming torpedoes
A ship is created via the following prototype:
class Ship:
def __init__(self, modules, base, dmg_modifier):
It is probably easiest to directly modify the ships base values based on the characters you receive in the module string.
CSCI 204 Project 3 - Galaxy Conflict 3
In the end all ship objects must contain the attributes as outlined in Table 1. I strongly suggest creating these attributes in the base
class (ship) not in the child classes (Fighter,...). Further make sure that the child classes (Fighter,...) properly inherit from the ship
class.
Notice that some attributes are labeled as class attributes. Whenever your objects have a property that is always the same for all
objects of that type it is better to not create it with each object but rather in the class itself. This also works with inheritance:
As you can see the cost (command point requirement) does not change
between ships of the same type. Thus this is an ideal candidate for a
class attribute.
The only thing to keep in mind is that changing such a class attribute
will change it for all objects.
self.fleet is a reference to the owner's fleet thus given a ship we can get
the matching fleet.
max_* attributes represent hull, armor and shields of that ship at the
beginning of combat and should not change over the course of battle.
That's what self.hull, self.armor and self.shields are for.
Set self.pd and self.evasion as fractions (e.g. 1/3 or 0.8).
TODO and Hint Summary:
● Create all Ship classes and set defense attributes correctly based on the module string.
● Use inheritance whenever possible and useful. Do not recreate the same mechanics for each ship, rather inherit.
● For self.weapons you can for now just create an empty python list [] and worry about weapons modules in 1.1.
1.2 Weapon Types
Weapon slots can be equipped with Lasers, Railguns or Torpedos:
Railguns (R) are effective against shields and have a high rate of fire. They are ineffective against armor.
Lasers (L) cut through hull and armor at ease but are ineffective against shields.
Torpedos (T) ignore shields altogether. They always hit and cannot be evaded. Ships can defend themselves against torpedoes using
Point Defense modules. Torpedo bays also need a long time to reload and have a lower DPS for compensation.
Weapon Modules Railgun Laser Torpedo
Base Damage 10 60 120
Cool Down 1 5 15
Damage to Hull 90% 100% 120%
Damage to Armor 40% 120% 100%
Damage to Shields 120% 40% -
Specials 100% accuracy regardless of ship size
ignores enemy evasion
ignores enemy shields
Weapons need to be implemented a little bit differently than Defense modules: Instead of modifying the ship's stats weapons are added
under self.weapons which is a python list. Make sure:
CSCI 204 Project 3 - Galaxy Conflict 4
● Weapon base damage and accuracy is modified correctly according to the ship's specifications
● You create class attributes for hull_modifier, armor_modifier, shields_modifier, and max_cooldown
● You set the actual cooldown of the weapon to 0 so it can be shot in the first round. Please check the charge method to see how
the firing works. Basically every round we charge the weapons and if ready, shoot. A max_cooldown of 0 therefore means
this weapon can shoot every round.
● Don't worry about the special features of Torpedoes yet, except for the accuracy which should be always at 100%. (phase 2).
● You do not need to touch the fire method at this point (phase 2).
● You do not need to worry about the fire priority at this point (phase 2).
1.3 Reading and Describing Ships and Fleets
1.3.1 Reading Fleet Files