User:Mbivol/proposal
From Unknown Horizons - Wiki
Contents |
Diplomacy
For start the diplomacy should be as presented in wiki. At beginning all the players are neutral. If one attacks another they will become hostile. A UI should be added for changing from hostile to neutral.
Weapons and WeaponHolder
Weapon Holder Class
My idea of creating easy developing combat is creating a WeaponHolder class that will be inherited by all fighting units. This way, any unit who holds a weapon can be used in combat.
A weapon holder will be similar to the storage holder. Every holder will have a limited number of slots and a limited number of weapons that can be equipped. So, a ground unit will have one or two slots, with only one weapon. A ship or a building will have more and different weapons. Also the weapon holder class will contain methods for firing all, or just some of the weapons.
Weapon Class
A weapon will have the following attributes, mainly based on the existing wiki:
- Impact radius;
- Attack range;
- Damage behaviour;
- Actual damage;
- Accuracy.
- Cooldown time;
- Duration of attack.
The accuracy will represent the chance for a ranged attack to hit the selected area. The damage behaviour will modify the damage taken by units in the impact radius, based on the actual damage.
For defending, every unit/object will have a scaling factor for different types of attack and a chance to evade it.
An attack should be done by this pseudo-algorithm:
def fire_weapon (self, location):
if self.attack_not_ready():
return
actual_location = self.get_random_position (location, self.accuracy)
for unit in self.get_affected_units(actual_location):
damage = self.get_damage(unit.position,
self.impact_radius,
self.damage_behaviour,
self.actual_damage)
damage_felt = self.get_damage_felt(unit.defence[attack_id],
damage)
self.deal_damage(unit, damage_felt)
Defense mechanism
Every unit that has health will have mapped for every weapon the defense modifiers.
Defense modifiers:
- scaling factor.
- evade chance.
Scaling factor represents the percentage of the damage felt by the unit from a particular weapon. Evade chance represents the chance for a attack to hit it's target. This is also needed for every unit because.
These modifiers are needed for keeping the system flexible for all fighting units.
Actual Combat
Movement
When the player right clicks on an enemy unit the attacking one will try to keep a good distance based on the other’s attack/defense modifiers. It will try to minimize the damage taken and maximize the dealt one.
Stances
- Aggressive:
- Any hostile unit that will get into player's unit range will be followed and attacked. If the player’s unit exceeds it’s area of movement will get back to it’s default position. Also when an attack is triggered the ship will become aggressive.
- Passive:
- Unit will attack only if it gets attacked. It will have a small area of movement. If the unit is a ship that has a trading route enabled, it will continue it's route even if attacked.
FightingUnit
The methods listed above will be implemented in a FightingUnit class that will be inherited by all moving fighting units.
Mockup Diagram
A mockup diagram to see how the concepts presented above should interact with fighting units:
New Buildings
Weapon Builder
Weapons will be needed resources for training new fighting units.
Training Camp
This is the place where new fighting units will be trained.
Defensive Buildings
The defensive building will also be a weapon holder. It will be aggressive, attacking any hostile units in it's range. As starting point I will use eoc's proposal User:Eoc/DD/BL#Defensive_Structures
Grouping:
Grouping will be done only on similar units. A player can have groups of ships or groups of ground units. A group of units will move with the speed of the slowest unit. If a group attacks, the attack method will be called for all units and they will move with their actual speed.
An issue with grouping is how a group reacts when attacking other group.
A simple method would be that when an attack is triggered, one unit fires and the rest are put in aggressive stance. The battle will continue based on the attacking method used by the units in group.
Meta: Pirating and stealing resources
One feature that can be added could be the ship crew and the ability for ships to steal resources from others.
Ship Crew
For ship crew to be implemented the idea of tavern in the branch office should be introduced. On a branch office a new tavern tab should be defined. It will contain a view of available crew members. Also a new building that recruits crew members should be implemented. The future crew units will be selectable moving objects. By selecting them and right click on the branch office, they will enter the tavern and be ready to get on a ship. This way, future ground units can also enter a ship. The ship will also have a crew tab. When near a branch_office it will be able to board new crew. For the crew to survive, it will need food (from branch office or containing ship)
Stealing Resources
When a ship is close enough to another the player should toggle "board". From that moment the ships will maintain their position and crew battle will be simulated. This will have as modifiers the ships hp and number of crew members. When attacking_crew / defending_crew ratio reaches a certain ratio resources will be transfered. If all the attacked ship remains with no resources or crew, the boarding will be disabled and both ships let to go. The boarding should also be disabled when the player toggles "board" again.