Make the Hydrogen Engine sound depend on load

Garbius shared this feedback 3 years ago
Submitted

I find it a bit odd that the hydrogen engine just keeps on going at the same RPM, regardless of whether it's powering a light bulb or a small factory. Sure, it's technically possible, but wouldn't it be much cooler if you could hear if the engine is idling or struggling? Even more so when talking rovers and other vehicles.

I have made a patch that does this. It is done similarly to other blocks that have similar features (MyMotorBase and MyMotorSuspension) and should be possible to integrate without much effort. The patch was made as an extension class and requires some minor adaptions to fit. I can do it upon request, but I will not be able to test it.


Demo: https://youtu.be/j7neMLKoZf4

Replies (2)

photo
2

There is something that I have not mentioned: When going out of range of the audio, the block stops updating on tick. Therefore, we must mark it for update, perhaps in UpdateBeforeSimulation100. I did it in UpdateAfterSimulation100 because it was easier to patch but UpdateBeforeSimulation100 would be more consistent with other classes. I'm not sure this is the best way to do it, but it works.


if (_this.m_soundEmitter != null && Sandbox.Game.World.MySector.MainCamera != null)
{
    _this.MarkForUpdate();
}


Oh, and don't mind that "true ||" on line 28 in the previously attached file. It's an artifact that slipped through after testing.

photo
1

The hydrogen engines are power generators with a constant output, not motors like a common gasoline engine. They don't struggle or idle, but work in a steady pace all the time.

photo
2

It is indeed not like a common gasoline engine, nor a diesel engine since it runs on hydrogen gas. How that works is not exactly clear. The best explanation I have would be that the pistons would be moved by the energy released from fusing the hydrogen atoms, which raises even more questions.


Regardless of the fuel type, piston engines are similar on the most fundamental level and there is very little difference in engines used to power cars versus ones that are used to generate electricity. What I believe you are referring to would be that power generators generally run within a small RPM range in order to maintain a steady output frequency. They can most definitely struggle or idle depending on load, which can definitely be heard, since the amount of reacting fuel differs. This is due to the laws of thermodynamics and conservation of energy.

If the frequency isn't a factor, there is nothing that I know that would prevent a generator from adjusting throttle and RPM to maintain optimal fuel efficiency. This would most notably be the case in DC applications. From a gameplay perspective, it would add to the player experience to have this feature. As shown in the demo video, it works really well in cars. In my opinion it would also add a natural audio cue that tells me that my production facilities are working hard.

In short, I think it would be a cool feature that adds to the game experience and is technically plausible (except for the hydrogen fusion part, but that's outside the scope of this feature request).

photo
1

Not to mention that inverter-type generators that don't depend on constant crank rate to keep the output frequency constant are a thing.

photo
Leave a Comment
 
Attach a file