Galaxy: Ship design calculations From: Ross Morgan-Linial <rmorganl@fhcrc.org> Date: Sun, 27 Oct 1996 00:00:00 +0000 I had a bit of spare time, so I calculated some equations which will take the abilities (speed, cargo, etc.) you want a ship to have and give you the numbers you need to use to design the ship. First, decide the following things: Mass (not including cargo) Speed (assuming Drive tech of 1) Attacks Offense (weapons/(weapons+effective shields), assuming techs are 1) Transport (cargo room, assuming Cargo tech of 1) Next, calculate: Loaded Mass = Mass + Transport Magic = (30/Loaded Mass)^(1/3) Weapon Mul = (Attacks + 1)/2 Div = Offense * Weapon Mul * Magic + 1 - Offense Find Drive and Cargo: Drive = Speed * Mass / 20 Cargo = sqr(10 * Transport + 25) - 5 Find the mass available for weapons and shields: Arms = Mass - (Drive + Cargo) (if this is < 0, go back and try again...) Finally, find the Weapon and Shield values: Weapon = Offense * Arms * Magic / Div Shield = (1 - Offense) * Arms / Div Use the Attacks value you decided above. Done! Quick C code follows (untested): void calc_ship(double mass, double speed, double attacks, double offense, double transport, double *drive, double *weapon, double *shield, double *cargo) { double tmass, magic, wmul, div, arms; /* Total mass */ tmass = mass + transport; /* Shield reduction by mass */ magic = pow(30 / tmass, 1.0 / 3.0); /* Weapon space multiplier by attacks */ wmul = (attacks + 1) / 2.0; /* Divisor (don't ask) */ div = offense * wmul * magic + 1 - offense; /* Drive, just a fraction of total mass */ *drive = speed * tmass / 20; /* Cargo, easy equation to find :-) */ *cargo = sqr(10 * transport + 25) - 5; /* What's left for weapons and shields */ arms = tmass - (*drive + *cargo); /* Weapons */ *weapon = offense * arms * magic / div; /* Shields */ *shield = (1 - offense) * arms / div; } Referenced By Up