Jump to content
Game-Labs Forum

Guns and damage


disc

Recommended Posts

I have seen some debate on guns, and how they work. To my knowledge, the current gun/damage system works as follows.

I put here a simple situation, where the shooting ship with one gun (hereafter, the "Shooter”) fires at a Target with an arbitrary quantity of armor on all surfaces.

  1. The Shooter acquires the Target. If it is in range, the Shooter locks on.
  2. The gun must turn to aim. This probably involves some calculations to give appropriate gun angle.
  3. The computer calculates the chance to hit, given all factors. At this point, the prospective shot contains most relevant information already: It will either hit or miss, based on probabilities.
  4. The game generates an approximate ballistic arc.
  5. The gun fires.
  6. A visual shell is created. It has no “substance,” as it has no hitbox and is only a visual representation.
  7. The visual shell is maneuvered midair to hit or miss the target, depending on the precalculated hit-or-miss. Trajectory corrections are made several times.
  8. The shell approaches for final impact on or near the Target.

This is where things become uncertain. The following is my best guess.

  1. If the shell is destined to hit, the computer rolls to hit one of the compartments.
  2. A lookup table is consulted: Depending on the range, the shell will “probably” hit either belt or deck armor. The computer rolls to choose which.
  3. The visual shell is given its final impact trajectory.
  4. If the shell was destined to miss, it impacts the ocean and makes a splash. As the shell is purely visual, if it passes through another ship, it does not “hit.”
  5. If the shell was destined to hit, it collides with the Target’s selected compartment on the appropriate surface.
  6. The relevant armor value for that compartment is chosen. If the belt armor is impacted, the computer chooses either “extended” or “main” thickness based on the angle of the Target relative to the Shooter at the approximate moment of impact.
  7. The computer calculates armor penetration with a formula and lookup table. This depends on the range (giving a vertical impact angle) and armor modifiers, as well as a Target-to-Shooter angle for belt armor. The “main” and “extended” belts probably have set angles that are modified: The main belt is likely 90deg from the Target’s long axis, while the extended belt is likely about 45 degrees from the long axis. The conning tower and turret "belt" armor are possibly treated as always perpendicular to the Target-Shooter axis, with no Target-to-Shooter angle applied.
  8. A damage value is selected based on penetration: Overpen, partial pen, full pen, etc.
  9. This damage value is modified up or down by various factors, including damage previously taken by the compartment.
  10. Chance of critical is applied, given the compartment that is hit and the penetration type.
  11. The computer shows an explosion, depending on position, and a decal is created. Damage (or bounce) and criticals are displayed and applied.

This is all theory, so I am curious to know if it is the reality. I'd like to know others' thoughts on this.

Edited by disc
Link to comment
Share on other sites

I would like to know too but I think we’re mostly in trade secrets territory here and we’ll never really know.

My guess...

Weapons fire as a salvo, they don’t fire as a single rifle or as single turrets.

All modifiers are compiled at the battle initialization stage, and into single useable values, none of these values would go through any sort of time wasting procedure between frames.

In the event of firing a salvo, in this instance, everything is calculated and all animations are initialized and there timers calculated and set, right there and then in that single event. This way the game only has to call up all the info once, use it and then it doesn’t have make those calls again.

Firing condition (“shooter") to trigger a firing event...

A simple alinement test, a 2D one at that, since weapons always firer while barrels are pointing into the water! (during ship heeling over while turning/sinking).
Range, loaded and visible tests too, simple true/false tests.

Salvo firing event, actions and animations initializations…

Rifle plumes objects.
Ships shudder and water shimmer.
Shell trajectories and shell objects.
Rolls the hit and miss chances.
Rolls the target hit location and damage.
Damage, Impact effect objects.
Missed effect objects.
Score and Counters.

Now that the timers (such as turret firing delays throughout the salvo battery) and animations are all set, the computer doesn’t have to do anything else or revisit anything.

What we see next is just the animations (visual aids/effects) beginning and ending (some animations just begin at the end of others). And all the compute has to do now is add the deltas (speed increments) to each shell and nothing else, it's free for the next salvo event or any other event.

Also I think the shells fly in a salvo too. It makes no sense to cycle through every single shell in the field, because that would take up too much time. All the game has to do is cycle through each flying salvo and add all the shell deltas at once, in that salvo call.

Hits and damage are all computed way before the animations and not at the point of impact, it's like we only see the echo.

Well that’s it, basically for maximum frame rate the most simplest, fastest solutions are used, so one has to think along those lines too.

 

Edited by Skeksis
Link to comment
Share on other sites

I don't think penetration or damage are calculated until about the moment of impact. Otherwise we would have very weird situations with target maneuvers and when a target is hit by another gun in the intervening time. Some testing might be in order....

Otherwise, I think you might be right with the salvo idea.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...