aliens

Author Topic: Other Ways to Modify Aircraft  (Read 3123 times)

Offline ChainsawAardvark

  • Sergeant
  • **
  • Posts: 20
    • View Profile
Other Ways to Modify Aircraft
« on: December 15, 2014, 09:52:45 pm »
Does the code allow for interceptors that modify variables outside of HP/speed etc? For example, a unit with an improved radar system that lets it fire weapons faster and more accurately. Or a stealth craft that has a better chance to dodge enemy fire when you select aggressive interception mode. Rotary launchers/multiple ejector racks that let the plane carry more ammunition than normal also occurred to me.

On a somewhat related note - can research projects affect these variables. You could have a Top Gun dissimilar air combat training (DACT) program that makes your pilots better. It could either add the bonuses above, or give an extra 10% speed as they hunt the aliens more efficiently.

As a final question, could there be craft with built in special weapons unique to them? An F-89 cleared for the genie air to air nuclear tipped rocket, or swarms of rockets, an F-14 with extra long range Phoenix missiles. (I am aware that we try to avoid real world craft, but these were the first one weapon one plane systems I could think of.)

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #1 on: December 16, 2014, 01:17:44 am »
Yankes' OpenXCom Extended supports weapon slots with restrictions as to what can be fitted in slots of different types. It would be possible to define a plain which is the only one to have slot X, which means it would be the only one able to have Weapon Y that requires an X slot. Similarly, some slots can be devoted to hardware that enhances the stats of the craft.

It is expected that some of the features in OXC Extended might be merged in the main branch once work on TftD is done, until then, you would have to use the alternate build.

Nothing as far as I know supports pilot improvement though.

Offline GO-shnick

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #2 on: February 22, 2025, 04:01:02 pm »
Hello everyone. I'm new here and also have a question about aircrafts. So, before registering here I have studied a forum for quite a some time, but never found out any useful information, so I decided to ask directly. So here it goes.

It seems that I totally cannot understand the fuel/range formula. How craft's range is calculated? It seems that if we have two crafts with equal fuelMax parameter and craft A have speed of 760 knots and craft B have 2100, the latter will have larger operational range. But what is the exact formula? What other parameters are taken into account during the calculations? It don't helps either that speed is measured in knots and range is given in nautical miles and kilometers.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9376
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #3 on: February 22, 2025, 04:08:58 pm »
https://github.com/OpenXcom/OpenXcom/blob/master/src/Savegame/Craft.cpp#L663

Code: [Select]
/**
 * Returns the maximum range the craft can travel
 * from its origin base on its current fuel.
 * @return Range in radians.
 */
double Craft::getBaseRange() const
{
return _fuel / 2.0 / getFuelConsumption(_rules->getMaxSpeed()) * _speedMaxRadian;
}

https://github.com/OpenXcom/OpenXcom/blob/master/src/Savegame/Craft.cpp#L630

Code: [Select]
/**
 * Returns the amount of fuel the craft uses up
 * while it's on the air.
 * @param speed Craft speed for estimation.
 * @return Fuel amount.
 */
int Craft::getFuelConsumption(int speed) const
{
if (!_rules->getRefuelItem().empty())
return 1;
return (int)floor(speed / 100.0);
}

Offline GO-shnick

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #4 on: February 22, 2025, 04:50:25 pm »
Well, I'm still confused (because I can't understand the code syntax), but thanks anyway. Or maybe you can give a more understandable sample, let's say, with vanilla Skyranger values?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9376
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #5 on: February 22, 2025, 06:16:04 pm »
Well, you explicitly asked for the exact formula.
This is the exact formula.

If you didn't understand the descriptions and explanations on the forum and in the ufopaedia.org, then anything I write will probably be exactly the same kind of not-understandable.
Maybe someone else can make a better/different explanation.

If you want a calculator of craft range based on craft parameters, you can use the Stats for Nerds in OXCE... see attached screenshot for vanilla Skyranger.
« Last Edit: February 22, 2025, 06:34:25 pm by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9376
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #6 on: February 22, 2025, 06:41:22 pm »
Here's the same formula written differently (for the calculator).
Maybe that helps.

Offline GO-shnick

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: Other Ways to Modify Aircraft
« Reply #7 on: February 22, 2025, 07:05:43 pm »
Hmph, yeah. That's it. That's might be what I'm looking for.

As far as I understood, int means integer, so any values here are rounded up or down to a close one, right? Still, don't perfectly explains a descrepancy in numbers I got. Must be overlooking something. Just don't tell my math teacher please (partially kidding).

So Skyranger fuel ticks is 1500 divided by 7.6 (result of division of 760 speed max by 100). 197,368...
And max range is 197,368 multiplied by 760 first and then the result (150000) is divided by 12. Result is 12500 (nautical miles?). Still, NerdyPedia says max range is 13553 nm.

Round it down.
1500/7=214... Multiply by 760 (162640) and then divide by 12... wait a minute! That fits perfectly! 13553,3 miles (13553 rounded down again). Okay, I think got it. Yeah. That is EXACTLY what I've been looking for. Thanks a lot, Meridian. I hope you won't mind if I leave this post here as is, so other people won't have to train their brain like I had to?
« Last Edit: February 22, 2025, 07:58:06 pm by GO-shnick »