Menu ▾ ▴

combat simulation

Joshua Bough

Combat Simulation


In most real time strategy games each unit will have a weapon that does a certain amount of damage per unit time against different types of target. The unit has a certain number of hit points and is able to fight at full effect until it has no hit points left at which point it dies. This system is probably not the best for an accurate simulation of naval combat in the early 20th century.

For an accurate representation the aim is to simulate the difficulty of hitting targets at extremely long range and the massively varying effects of hits on the ships of the day. Sometimes a ship could be hit hundreds of times and reduced to a blazing, stationary wreck yet still be firing what guns they had left as they sank but sometimes a couple of lucky hits were all that was needed to hit a turret or magazine and cause the ship to disappear in a catastrophic explosion.

For this reason a probabilistic method of simulating combat will be used. This will enable the portrayal of ships gradually getting more accurate with their shooting as they fire ranging shots at a target by slightly increasing the probability of a hit with each salvo fired. Each salvo will have a base probability of hitting which is dependent on the speeds of the firing and target ships, the range and the size of the firing ship's guns. This probability is then modified to account for previous ranging shots and any damage that may have been taken by the fire control systems of the firing ship.

When a shell hits a ship it will hit a random part of the ship which it will have a certain chance of doing damage to depending on the amount of armour that section has and the size of the shell. If it does damage it will affect a random section of the ship with the chances of damaging each section depending on which part of the ship was hit. Damage could range from a slight decrease in top speed to a magazine explosion.

Current data structures for combat simulation (valid as of commit [afd450]):

  • [Structs]:
    • GunData
    • FiringData
    • Salvo
    • Guns
    • DamageLog
    • testShip
  • [Enums]:
    • Turret
    • Status
    • Size
    • hitArea
    • damageArea
    • damageType

Current header and source files for combat simulation (valid as of commit [afd450]):

  • [combat_sim.c]
    • main
  • [combat_sim_functions.c]
    • success
    • get_random
    • update_position
    • ship_can_fire
    • salvo_hit_check_and_resolve
    • update_sinking
    • check_damage_counter
    • write_update
  • [damage_functions.c]
    • apply_total_damage
    • get_area_hit
    • does_damage
    • get_damage_area
    • apply_damage
    • apply_machinery_damage
    • apply_guns_damage
    • apply_magazine_damage
    • apply_bridge_damage
    • apply_firecontrol_damage
    • apply_waterline_damage
    • apply_additional_damage
    • update_damage_log
    • hitArea_to_str
    • damageArea_to_str
  • [gunnery_functions.c]
    • fire_salvo
    • get_firing_sector
    • get_number_of_firing_guns
    • get_base_probability
    • get_prob_from_poly
    • get_difficulty_multiplier
    • get_max_prob
  • [test_ship.c]
    • load_ship
    • load_gun_data
    • init_firing_data
    • init_salvo
    • init_damage_log
    • write_ship_details_to_file
    • write_damage_log_to_file
    • turret_to_str
    • size_to_str

Related

Commit: [afd450]
Wiki: Home