Developer postOriginal post (opens in a new tab)

Upcoming Homebrew Features: Weapons Part 3

From the team

Hello everyone! This will be our last post before the much anticipated weapons update for Homebrew. This initial weapons update is set to be released TOMORROW and since we've already showed you the guns let's look at how we model the weapons, calculate a vehicle’s hitpoints and how to figure how much armor you vehicle has.

How we model weapons

We started by coming up with a list of weapons that we felt represented the most common types of weapons that are mounted on vehicles. After narrowing that list down we started looking up as much information about the penetration, muzzle velocity, drag characteristics and mass of the individual shells. We took that information and built a “bullet maker” that allowed us to model weapons quickly, easily, and realistically with just a handful of variables.

At some point we might release this as a built in tool in the game to let players design their own ammunition and weapons. We took the bullet data, calculated the accuracy of the weapon based on the effective range of the weapon and then built a ballistic model with drag for each weapon. Below you can see all the guns that this update brings lined up:

How we calculate vehicle health

After we worked out the particulars of the individual weapon, we developed a relative damage system that we could use that would give us some level of realism without requiring an excessive development time. Keep in mind that this system will be modified in the future to be more robust and allow far more player customization, especially when it comes to the placement of armor.

The way we decided to handle vehicle health is by taking the total mass of a vehicle and then multiplying it by a simple constant. This way vehicles that are naturally larger and heavier will have more health. A 747 model weighing the same as a real 747 will have dramatically more HP than a family sedan as would be expected.

How we calculate armor

Armor is calculated a little differently and this was a result of a lot of compromise to keep the system simple and easy to develop. Currently we take the total mass of the vehicle, divide it by the volume and then multiply the resulting density by a constant.

This means that small and heavy vehicles will naturally be more armored than light and distributed model. This also means that 60 T tanks having considerably more protection than a small airplane of the same size. After calculating the density and multiplying by the constant, we get a value in mm of rolled homogeneous armor. We balanced this against our weapons so that the weapon would penetrate the expected amount of armor in a real world scenario.

How damage works

So now that you have your armor and health value, we can do some damage. When a bullet strikes your vehicle we calculate the kinetic energy of the collision as well as the expected penetration based on a number of projectile properties.

If the penetration of the armor exceeds the armor value, the bullet penetrates and does damage. Damage is calculated by determining how much energy was lost in penetrating the armor and subtracting that from the energy of the projectile.

If the damage exceeds the health of the vehicle, the vehicle is destroyed and the bullet could potentially pass through the remainder of the broken vehicle and out the other side albeit with reduced speed.

If the penetration of the bullet does not exceed the armor value, no damage is done. Regardless of penetration or not, the vehicle struck by a projectile will still be affected by the force on the shot hitting it.

Ammunition types

Each weapon has different ammunition types based on its real world equivalent. Although there are a wide variety of possible ammunition types, we narrowed it down based on the balance we needed as well as providing players with an interesting set to play with.

The first ammo type is the standard/ball/armor piercing round. This round is just a slug of metal that does damage to a target it collides with. It is available to most of the weapons and is a good balanced choice for doing direct damage.

Next is the SABOT (say-bow) round. This round is a super narrow round that travels at tremendous speeds to penetrate armor. It has incredible ballistic performance and can penetrate virtually anything. Since it is a lighter round however, it does considerably less damage to the target it penetrates.

Another one is the HEAT round. This round uses a shaped charge to blast a jet of molten steel into the target it strikes rather than using kinetic energy like the AP or SABOT round does. It tends to be a slower and less accurate round than some of the other options, but it penetrates very well and causes serious damage.

And finally we have the high explosive/fragmentation round. This round explodes on contact and spawns smaller pieces of shrapnel that spread in every direction capable of doing some serious damage. As in the real world, a HE round explodes in a sphere causing the energy of the round to drop off very rapidly making direct hits a must to do real damage to an armored target.

Selection of the ammo type is as simple as sending a number into the weapon in question. 0 or blank = AP/Standard/Default. 1 = HIGH EXPLOSIVE, 2 = HEAT, 3 = SABOT. The table below shows what weapon has what type of shot:

Ammo logistics

Now some of you may be wondering about logistics and ammunition. Modeling ammunition was easy since we know how much space each round takes up because of how we modeled the bullets and therefore we knew how many rounds could theoretically fit in a given volume of box.

Originally each weapon and type of ammo had its own box. That was realistic but it led to major part creep so we decided to go a bit gamey and make it so any weapon can be fed from a single ammo box.

When a weapon is fired, it subtracts the volume of the round from the volume of ‘ammo’ left in the box. If there isn't enough ammo the weapon doesn't fire, but it is possible to fire a weapon that shoots a smaller round assuming there is ammo available for it as well. For example if I fire 10 125mm rounds I could still fire a couple 20mm rounds before emptying the box totally. As the ammo box gets emptied, it also starts to weigh less.

Ammunition by its very nature is very heavy and you will have to take this into account in your designs. Here is a handy chart for an idea how much ammo you can hold in the default sized ammo box by weapon:

What does this mean for design?

So what does this mean for designs? Depends on what you are designing. If you want to make a tank, expect it to have the weight of a real one along with all the consequences that brings in design. If you are designing a combat plane you will have to make some serious armor sacrifices to keep weight down. Generally if you design something the size and weight of the real world version you will get the performance you would expect.

To close this post we'd like to show you one of the crazy creations that have been made in the weapons build.