I'm trying to make a mod that has a non uniform power delivery, like a slow revving 1 cylinder, or even a lot of motorbike v-twins. Is there a way to implement this into a vehicle? Maybe with the combustionEngine.lua file? I'm not savvy enough to figure this out on my own :/
By "uneven" I am assuming you don't mean a lumpy torque curve, but rather have a lumpy power delivery since there are so few power strokes? If there is an actual way to do this I am unaware of it currently unfortunately, however, unless your going for like an old hit and miss engine, even a normal motorcycle single cylinder at anything above 2,000 rpm's is smooth enough to not really notice much of a difference. Granted we can get into the point of big bang firing cycles for motorcycle racing and traction advantages and what not all day long, but that is a topic for a different day. My best guess is if something like this were to be implemented, it would have to be done through some LUA code at the moment... I don't know if there is actually a standard way to add something like this currently in the stock game, and if this feature does exist, then I have totally missed it somehow.
I'd guess that it'd be in the vehicle controller somehow, where it says the equivalent of throttleposition=poweroutput but you could interject a float based on time, and have that time be calculated from rpm.... I think this has helped me maybe figure it out myself.... but I still don't know lua
I unfortunately don’t understand LUA virtually at all, however, I do know that beam definitely tracks the rotation of the engine. If you take a look at any of the engine models in standard beam vehicles you can see that the pulleys spin with engine RPM. Now this isn’t just some random silly animation, but that animation is actually linked to the engine RPM, and thus, it’s literal rotation. So… in theory… if you could find a way to use that rpm, you could then multiply the throttle output by 0.5*sine((RPM*time)/2)+0.5 which… in theory… would give you a number that oscillates between 0 and 1 once every 2 revolutions of the engine. Is it perfect? No. This will give you only 50% of the power that your torque curve “should” have assuming it works at all… it also is a smooth curve as opposed to what an actual power/exhaust/intake/compression stroke would normally give. Normally 3 of those 4 strokes would actually give negative torque while what we have here will always give positive torque. If this actually ends up working though, I could help you come up with an equation that would match an actual 4 stroke power cycle much more closely.