Superchargers 2.0 (hear me out on this)
fsendventd opened this issue ยท 8 comments
I came up with a better way to make them work, and they'll become useful as people like Vini make aircraft that could take advantage of them. Either a new part type would be added (more immersive but harder to code) or a couple JSON variables would be added (less immersive but easier to code), but they'd both essentially do the same thing. "superchargerFuelConsumption" would determine how much extra fuel the engine uses because of the supercharger.
I know what you're thinking: "Why not just add more fuel consumption?"
Well, here's why. "superchargerEfficiency" would be another variable, and setting it to 1 (for 100 percent) would make the supercharger produce twice as much power as just adding fuel consumption for the same actual fuel consumption (e.g. supercharger consumes 0.25 fuel but is 100% efficient, so it's like adding 0.5 fuel consumption in terms of power). At 0 it would be entirely useless, and at 0.5 it would be the same as adding fuel consumption. This value would also affect engine wear, though, so setting it to 1 would make the engine wear out very quickly (obviously 0 is the standard here, as if it was 0.5 like for efficiency then people could make engines that never wear out by setting the supercharger efficiency to 0).
"But Fsend," you ask, "who cares about fuel economy?"
Fuel economy isn't all that superchargers are good for. Making an engine supercharged would also allow it to partially bypass engine size constraints by making part slots only take the base fuel consumption for the min/max calculations. Obviously this would require trust on the pack authors' end to make sure people don't do stupid stuff like make a 0.1 FC engine with a 10 FC-equivalent supercharger that would still fit in motorcycles, but I bet most PAs are smart enough to not do that. This allows for vehicles to gain higher-power engines without modifying the JSON, for if people want to make packs with tuned parts for certain vehicles.
Oh, and one more thing. "superchargerBoost" would be a third variable, probably defined in PSI. It would be added to the altitude calculations once the pressure starts to drop, preventing engines from losing power quickly at high altitudes. This would make high-flying bombers and fighter escorts possible more easily.
Two-speed superchargers could be added, with a switch on the panel to go between low altitude gear and high altitude gear (additional superchargerFuelConsumption and superchargerBoost variables would be required for other gears), but this is an optional feature that isn't integral to the ticket.
Anyway, I hope this one makes more sense than my original request. I did take a look at the code and most of these variables (with the possible exception of the boost, as I couldn't find the altitude calculations) look like they could be added fairly easily. Vini already made a supercharged vehicle, and the one of the next vehicles I want to make will also have one, so it would get used. Turbos may or may not come in a separate ticket, as they operate differently and would be harder to code.
Making an engine supercharged would also allow it to partially bypass engine size constraints by making part slots only take the base fuel consumption for the min/max calculations.
I was against superchargers, but I have to admit, this is a very good point. I think the json definitions you propose is a good idea. This may be something easy enough for me to try to implement. I'm sure don has plenty on his plate, so I'll try looking into this probably tomorrow.
Good job fsend, you converted me.
In that case, I'll leave this one to DPL. I've got enough on my plate without screwing up engine code.
@DrprofLuigi Any progress on this?
@DonBruce64 @DrprofLuigi So... is this dead, or does nobody care enough to add it over what they think would be better right now? I just can't work with Java, if that part was easier then I'd do it myself. But it's so weird, and nothing ever extracts properly, and I can never remember how to make it run a dev world, and even if I got it to work I'd never be able to put in a PR...
Anyway, is anyone still working on this?
So I actually took a shot at implementing it myself this morning. Forge was a pain, as usual, but I got it set up. Was missing some sound libraries so I had to make fake empty ones to get vehicles to spawn, buuuut...
It worked. The force calculations seem to be taking the supercharger fuel consumption into account, and my efficiency variable is working as well. I need to make damage factors work, though, but that should be easy.
Only issue I ran into is that whenever I try to add anything to the code that actually removes fuel from the fuel tank of a vehicle (so that the superchargers can make engines actually use more fuel), the engines just won't use any fuel. It might be smart to create a method to get the total fuel consumption of the vehicle and use that instead of having the entire equation written out everywhere...
Implemented in V18.0.0. But not by me! @fsendventd, you want the honor of closing your first Git Ticket?