Combat Models - ProkopHapala/SimpleSimulationEngine GitHub Wiki
There are several distinct combat models, and unit/weapon systems which should be perhaps merged:
See these files:
cpp/common/CombatModels/MinimalDivisionLevel.h
cpp/apps/LandTactics/LTUnitType.h
cpp/apps/NavalBattle/Battleship.h
cpp/common/engine/Turret.h
cpp/apps/OrbitalWar/spaceCombat.h
cpp/apps/FormationTactics/SoldierType.h
struct WeaponType{
double direct_reach; // [] distance
double indirect_reach; // []
double indirect_supression; // [] supression in idirect or direct fire
double movePenalty; // [0.0..1.] decreased firepower when moving
double supply; // supply consumed when fireing [/attack round]
double firepower[4]; // against armor-class : light[<10mm], medium[<50mm], heavy[<500mm], super heavy[>500mm]
};
struct UnitType{
int armorClass; // light[<10mm], medium[<50mm], heavy[<500mm], super heavy[>500mm]
double size; // [m] => visibility and hit probability
double supply; // [kg/day]
double weight; // strategic speed
double baseCost;
double speed_transit; // [km/h] operational speed
double speed_combat; // [km/h] tactical speed
WeaponType* primary; // this weapon is prefered
WeaponType* secondary; // used only when primary cannot be used
}
class LTGunType{ public:
std::string name = "defaultGunType";
double rps = 0.1; // [1] round per second
int nburst = 1;
double vMuzzle = 1000; // [m/s]
double caliber = 0.00762; // [m]
double pMass = 0.001; // [kg] projectile mass
double crossArea = caliber*caliber*0.25*M_PI;
double balisicCoef = crossArea/pMass; // [m^2/kg] aerodynamic_decceleration a = balisicCoef * v^2 * airDensity
double AP = 100; // [mm]s
double ExDMG = 4e+6; // [J] after penetration damage
int dmgType = 0; // e.g. KineticEnergy, Explosive, Flame ...
double spread = 1.1; // tg(angular_spread), spread = distance*fire_spread
};
class LTUnitType{ public:
int kind = UnitKind::inf;
std::string name = "defaultUnitType";
Vec3d sz;
Vec3d szAreas;
int nGun=1;
LTGunType* guns[nGunMax];
// --- mobility
double mass;
double enginePower;
double maxSpeed;
// --- Armor
double armorFront;
double armorSide;
double armorBack;
double armorTop;
double armorBottom;
// --- armor and defence
double HP = 2.0;
double recovery_rate = 10.0;
};
// cpp/common/engine/Turret.h
class TurretType{public:
Mesh * mesh = NULL;
int shape = 0;
int ngun = 1;
double prjmass = 1.0;
double vmuzzle = 1000.0;
double reload_rate = 0.1;
double vphi = 10.0; // deg/s
double vtheta = 10.0; // deg/s
double mass = 10e+3; //
double Rsize = 10.0;
};
class Battleship : public Ship2D, public CollisionObject { public:
char * name;
int nguns;
int nsalvo = 1;
//Turret * turrets;
std::vector<TurretType*> turretTypes;
std::vector<Turret*> turrets;
double life_max = 1.0d;
double life = 1.0d;
double life_regeneration_rate = 2.9d;
};
class SoldierType{ public:
std::string name = "default";
// --- movement
double mass = 1.0; // collision mass
double radius = 0.5; // collision radius
double max_speed = 1.0; // speed in good terrain / conditions
double min_speed = 1.0; // speed in bad terrain / conditions
// --- stamina / moral
//double moral_regain = 1.0;
double stamina_regain = 0.01;
double time_buffer = 15.0;
// --- meele combat
double melee_skill = 1.0;
double melee_period = 10.0;
double melee_range = 1.2;
double melee_damage = 3.0;
double melee_penetration = 1.0;
double melee_fStamina = 0.8; // stamina cost of meele attack
double melee_push = 1.0; // force exerted by weapon in push
double defence_skill = 1.0;
double defence_period = 2.0;
double defence_fStamina = 0.9;
// --- ranged attack
double fire_period = 20.0;
double fire_range = 0.0; // if this is <1.0 unit is not ranged; We may modify this later based on physics
double fire_damage = 3.0;
double fire_penetration = 1.0;
double fire_spread = 1.1; // tg(angular_spread), spread = distance*fire_spread
double fire_fStamina = 0.8; // stamina cost of fire attack
int fire_ammo = 30;
// --- armor and defence
double damage_tolerance = 10.0;
double armorFw = 1.0;
double armorBk = 0.5;
// -- shield
double shield_cos = 0.5; //
double shield_miss = 0.5; // probability to miss the shield
double shield_endurance = 100.0;
};
struct whippleShieldType{
int n;
double layerDens; // [kg/m^2]
double spacing; // [m]
double critEdens; // [J/m^2]
struct LaserGunType{
double power; // [W] maximum continuous (averaged) power
double peak; // [W] peak power
double aperture; // [m]
double wavelength_min; // [m]
double wavelength_max; // [m]
};
struct SpaceGunType{
int kind; // 0=laser, 1=railgun
double length; // [m]
double maxForce; // [N]
double maxPower; // [W]
double scatter; // tg(a) - angular uncertainity of flight direction
double fireRate;
};
struct PulseEngine{
double fuel_energy_density; // [J/kg]
double burnUp; // [1] share off fuel burned up
double nozzle_efficiency; // [1]
double pulse_fuel; // [kg]
double pulse_inert; // [kg]
double rate; // [Hz]
}
struct SpaceShipMobility{
PulseEngine engine_hiIsp;
PulseEngine engine_loIsp;
double mass_propletant;
double mass_fuel;
double mass_empty;
}