Coming Soon: Shipyard: The Combat Update
As an extension of the customization mechanic, one of the main features of Shipyard is its combat system. As it makes its way into the real of "real game," I figured it was about time I got to work on that mechanic. As of yet, the only coding I've done has been preparatory; however, I have been making plans for how the system will work when I get to the actual implementation. Below is an explanation of the concept as it currently stands. Not all of it is directly related to combat, but it is all has some effect on it and is therefore coming in the "Combat Update."
NOTE: Because very little actual coding has been done, this will be somewhat of a wall of text. If you are impatient or simply hate reading, you might want to check back when I have some actual progress.
Engaging an Enemy
To engage an enemy vessel, you must be within one tile of their ship (diagonals included). Clicking on the enemy will bring up a context menu, just like every other object in the world, with an option called "Engage." Clicking this will bring up an exterior view of the ship and a list of the weapons on your ship. From here, selecting a weapon and a location on the enemy ship will cause that weapon to attack the enemy.
Each turn, you are allotted a number of "weapon control" points equal to your weapon control stat, and every weapon has a firing cost in these points. Thus, no matter how many weapons you have on your ship, you can only fire as many per turn as your WC stat allows. If you have a single Small Weapon Controls system, giving 8 WC, you could fire eight Twin Autocannons or four Small Gauss/Plasma Cannons. Regardless of your WC stat, the same weapon can only be fired once per turn.
Turrets, Fixed Weapons, and Ship Rotation
Currently, the game does not consider the direction of your ship and allows you to move in any direction at any time. The limit for how many tiles you can move is the ratio of engine power to total mass of your ship. If you've looked through the image files, though, you may note that "shipicon.png," which contains the icon used by the navigation menu to represent your ship, shows the icon facing in eight different directions.
This is because, along with combat, the movement system is being effectively overhauled. You will still be limited by your thrust to mass ratio, however you will only able to move in the direction your ship is facing. Rotating your ship will count as a movement, even though you stay on the same tile. You will also be able to move diagonally with only one unit of movement (so that you don't have to constantly turn-move-turn-move and so on).
"But wait," you ask, "how does this relate to combat?" Well, dear reader/player, it will affect which tiles you can attack with which weapons. Currently, every weapon in the game is classified as a "turret," meaning it can fire in any direction regardless of the way your ship is facing. However, when combat is added, a new class of weapon will be implemented: fixed weapons. Fixed weapons are, as the name suggests, fixed relative to your ship. If, for example, you have a fixed weapon facing forward and an enemy 90 degrees to the right, you will not be able to attack them with that weapon unless you pay the movement cost to turn and face them. This does not mean that all fixed weapons must face forward, though; it would be entirely possible (though somewhat silly) to create a 27th century ship-of-the-line with rows of fixed cannons down either side. With this setup, you would have to pull alongside your enemies to attack them rather than face them directly.
Damage and HP vs Crew
Say everything goes right and you fire a weapon at an enemy ship. Let's assume both ships are in perfect condition to start with. You might not know what system you hit, but whatever it is, you will take away some of its hit points. Most systems will receive a 50% stat penalty upon reaching 30% of their max HP (at which point the system is considered "heavily damaged"), however some (like bridges and crew's quarters) will not. If you continue attacking the same spot and manage to reduce its hit points to zero, the system is "destroyed" and the penalty goes up to 100% on applicable systems.
However, there is another factor which determines the effectiveness of systems: crew. Ships will now have a certain number of crew available, capped by their crew capacity stat. Ideally, you will have enough crew to fill the requirements for all of your ship's systems. However, if you have less then enough, you will have to distribute crew according to what you think is most important at the time (for example, diverting crew from engines to weapon controls when engaging an enemy). Systems which are have less than enough crew will receive a penalty proportional to the number of empty crew slots. For example, a Small Weapon Controls with only four crew will receive a 4/8, or 50%, penalty to its effectiveness.
Your crew are not invincible, however. Even if a ship has enough room in its Crew's Quarters for, say, 64 crew, those crew members can be killed by attacking the system they are currently manning. Different types of weapons will deal more HP or crew damage, but a system with less HP will offer less protection to the crew inside. I haven't designed the exact formula for this, but for systems with most of their HP, crew damage shouldn't be a major problem.
Weapons are already divided into three categories, though only two are currently represented ingame. These categories are ballistic, energy, and explosive. Ballistic weapons are the middle-of-the-road kind, firing a solid projectile which does equal damage to systems and crew. Energy weapons are the "futuristic" ones, using superhot plasma or high-powered laser beams to attack the enemy. These deal extra damage to a system's hit points; however, since they don't involve a significant impact, they are less likely to kill crew. Explosive weapons are the opposite, using an explosive charge to create shrapnel that is lethal to crew but does less damage to HP.
Generally, the trade-offs between equivalent ballistic, explosive, and energy weapons will keep them roughly equivalent in effectiveness. However, since crew damage depends on system HP, explosive weapons are far more specialized than the other types.
First of all, if you've made it this far without skipping anything, congrats to you--you've made it through more of my writing than I can can handle myself. This "Combat Update" is shaping up to be the biggest the game has ever seen, and rightly so. Of course all of this is subject to change, but it should provide a general idea of what I'm going for.