Jump to content

[WIP] Rover Engines v0.1 - LiquidFuel engines for rovers independent of the wheels


Recommended Posts

Rover Engines mod v0.1

LiquidFuel engines for rovers, separated from wheels

rT0RVtF.png

Rover Engines is a mod that adds LiquidFuel engines for rovers, independent of the wheels. On stock KSP, the top speed of a car is defined mainly by the torque curve, and the straight-line performance of a car is based only on the number of powered wheels compared to the mass of the car (see below).

In real life, the acceleration of a car is defined mainly by the power-to-mass ratio, and the top speed is on the point in which the drag force and wheel force are equal. In stock KSP, the power of a car is defined by the number of powered wheels, and mass and drag are the same thing, so the mass of the car compared to number of wheels is the only thing that matters for acceleration, and for top speed, you will be limited only by the torque curve.

Therefore, to win a racing challenge with stock KSP, you must make the lightest car possible with the maximal amount of powered wheels allowed, while trying to make the car very low, wide and short, to assist in cornering. (and RCS is not a major factor.)

But with FAR, Tweakable Wheels and this mod, car engineering in KSP is a lot more fun, and is something that requires skill, like spaceplane engineering.

Download v0.1

(Dropbox)

This mod comes with a modified version of TweakableWheels by OrbitusII. Install instructions are included in the download.

Special thanks to:

- OrbitusII, for allowing me to modify his mod.

- Snjo, for his jerry can part from Firespitter.

The engine part looks like an RTG, but much brighter. When turned on, it consumes LiquidFuel and produces a custom resource called EnginePower. There is also a copy of the black stock wheel that consumes EnginePower instead of ElectricCharge, and it has a different torque curve (much faster). The engines must be turned on/off either by right-clicking or action groups.

Just making a powerful engine will not make your car faster, you need to use TweakableWheels to adjust the percentage of torque (and consumption) of each wheel. Each engine can produce exactly enough EnginePower to feed one wheel at 100%.

The fuel is not automatically pumped to the engines, and you must do the pumping yourself if necessary. Keep in mind that fuel crossfeed never occurs through radial attachments, with the only exception being that an engine radially attached to a part can pump fuel from that part, if it has access to fuel.

Here is an album showing what works and what does not:

Javascript is disabled. View full album

On the back is a RTG for color comparison. The jerry can is from Firespitter.

Future Plans:

- Support for M1 wheels (the yellow ones)

- More fuel tanks

- Better torque curve, based on real engines

- Engines only working in an atmosphere with oxygen

- Transmission

- Ability to consume oxidiser (along with LiquidFuel), as 'Nitro'

- Realistic (but simplified) engine simulation with RPM, (auto) clutch, etc

- Engine Sounds, probably through this

Feel free to suggest more!

Known Issues:

- When turned on, engines always consume a fixed amount of fuel, even when wheels are not being throttled.

License:

RoverEngines is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

88x31.png

Edited by ThermalShark
Link to comment
Share on other sites

- Engines only working in an atmosphere with oxygen

One of the ways I've tried handling this is having my khorsepower producing engines require IntakeAir and therefore intakes. I'm hitting similar issues with fuel flow and I'm fairly certain intakes also require some velocity in order to perform well, presenting a challenge of how the hell do you get up to speed in the first place :P

Link to comment
Share on other sites

Interesting, but the idea of doing (always) some tweaking first each time I want to build a rover is more than boring, it could be great to have a bunch of plug-and-play settings ready to go.

For the reluctant fuel, Goodspeed pump does it on its own (it can move fuel "magically" even without crossfeed).

Engine which needs air/oxygen may be not too hard, as jet engines work more or less the same way.

Known Issues:

- When turned on, engines always consume the same amount of fuel, even when wheels are not being throttled.

mmm :huh: not really an issue, as a internal combustion engine will use a given amount of fuel/s according to its own speed.

Link to comment
Share on other sites

IntakeAir can be a curse and a curse, it seems like a great idea to link your engine to it, but intakes behave very poorly in general, and even worse at low velocity. Basically at low speed they have this habit of just for some reason one out of a handful of frames being empty, and if your logic doesn't account for that then your engine flames out because your intake decided not to have any air in it because you weren't going fast enough to get over it's rounding errors. There are better ways to go about it, such as processing the atmosphere yourself to determine if the engine should be allowed to work. You can find the has oxygen tag directly somewhere (but don't ask me where), and then get the atmospheric pressure or maybe dynamic pressure and your velocity to determine a multiplier for your intake considerations; that should all be relatively cheap to do and would allow you to simulate stuff like ram-air intakes with a few more considerations such as forward-vector vs intake-vector, without having to deal with KSP's nonsense. Alternately InterStellar Mod implements it's own system for this exact reason. That got deeper and faster than I expected....

So in regards to:

- Engines that automatically produce the right amount of EnginePower

There are a handful of ways to achieve this, three come to mind.

1. Have a bin full of EnginePower, and use a PID controller to try and keep it at a given level. This is just really unsatisfying and doesn't let you make the engine truely intelligent, it's just trying to keep a glass half full while you drink out of it, also it's kind of a pain.

2. Parse EVERYTHING and replicate the consumption logic to calculate what that thing should be doing given the inputs it's currently receiving. You will be so bald that your hair will never grow outward again, and then your brain is full of hair and that just sounds.... sweaty.

3. Replace Part with a class that adds a thing to stand between all the other code and RequestResource() so that you can record all the resource transactions and use that to determine what you need

4. Make your own wheel system so you don't have to do any of that

Luckily I've already done 3! http://forum.kerbalspaceprogram.com/threads/79175-Virgin-Kalactic-Responsive-Fuel-Burning-Generator-and-RequestResource%28%29-upgrade

If you like, take a look at BetterPart.dll, the way you use it is to in your partmodule do somevariable = DictionaryManager.GetTrackResourceForVessel(vessel);, and then somevariable.getConsumption("EnginePower") will tell you how much of EnginePower was consumed last frame, record it every frame and keep some number of samples for your logic to determine what's needed, then set up some logic.

You can see my attempt at that in AdvGenerator.dll, but what you're trying to do clearly has a wider scope than my throttle logic.

Link to comment
Share on other sites

Basically at low speed they have this habit of just for some reason one out of a handful of frames being empty, and if your logic doesn't account for that then your engine flames out because your intake decided not to have any air in it because you weren't going fast enough to get over it's rounding errors

One workaround coming to my mind is to add a tank which can hold a big amount of IntakeAir resource (even if it's small :) ), kind of 100-1000 units, so it will serve as a buffer during such hard time.

Link to comment
Share on other sites

Interesting, but the idea of doing (always) some tweaking first each time I want to build a rover is more than boring, it could be great to have a bunch of plug-and-play settings ready to go.

The tweaking is from the TweakableWheels mod, made by OrbitusII, not me. And you can simply choose to not tweak it, as the default values are the same as for a stock wheel.

For the reluctant fuel, Goodspeed pump does it on its own (it can move fuel "magically" even without crossfeed).

Actually the need to pump fuel is not a problem to me, it is part of the challenge of building a car.

mmm :huh: not really an issue, as a internal combustion engine will use a given amount of fuel/s according to its own speed

What i said was that the engine always consumes a fixed amount of fuel as long as it turned on, no matter how fast you are going or if you are even driving at all, and that is definitely a problem.

Link to comment
Share on other sites

IntakeAir can be a curse and a curse, it seems like a great idea to link your engine to it, but intakes behave very poorly in general, and even worse at low velocity. Basically at low speed they have this habit of just for some reason one out of a handful of frames being empty, and if your logic doesn't account for that then your engine flames out because your intake decided not to have any air in it because you weren't going fast enough to get over it's rounding errors. There are better ways to go about it, such as processing the atmosphere yourself to determine if the engine should be allowed to work. You can find the has oxygen tag directly somewhere (but don't ask me where), and then get the atmospheric pressure or maybe dynamic pressure and your velocity to determine a multiplier for your intake considerations; that should all be relatively cheap to do and would allow you to simulate stuff like ram-air intakes with a few more considerations such as forward-vector vs intake-vector, without having to deal with KSP's nonsense. Alternately InterStellar Mod implements it's own system for this exact reason. That got deeper and faster than I expected....

So in regards to:

There are a handful of ways to achieve this, three come to mind.

1. Have a bin full of EnginePower, and use a PID controller to try and keep it at a given level. This is just really unsatisfying and doesn't let you make the engine truely intelligent, it's just trying to keep a glass half full while you drink out of it, also it's kind of a pain.

2. Parse EVERYTHING and replicate the consumption logic to calculate what that thing should be doing given the inputs it's currently receiving. You will be so bald that your hair will never grow outward again, and then your brain is full of hair and that just sounds.... sweaty.

3. Replace Part with a class that adds a thing to stand between all the other code and RequestResource() so that you can record all the resource transactions and use that to determine what you need

4. Make your own wheel system so you don't have to do any of that

Luckily I've already done 3! http://forum.kerbalspaceprogram.com/threads/79175-Virgin-Kalactic-Responsive-Fuel-Burning-Generator-and-RequestResource%28%29-upgrade

If you like, take a look at BetterPart.dll, the way you use it is to in your partmodule do somevariable = DictionaryManager.GetTrackResourceForVessel(vessel);, and then somevariable.getConsumption("EnginePower") will tell you how much of EnginePower was consumed last frame, record it every frame and keep some number of samples for your logic to determine what's needed, then set up some logic.

You can see my attempt at that in AdvGenerator.dll, but what you're trying to do clearly has a wider scope than my throttle logic.

I was originally going to do the 1st before release, but it turned out too complicated so i scrapped it. I am going to take a look at your mod later, but before i will do the first three things on the list. Seems to be exactly what i need though.

I am also trying to find a way to access the WheelCollider of a rover wheel, so i can make a telemetry mod. That would help a lot with the development of Rover Wheels when i start making a realistic engine simulation. But i may decide to not use the stock ModuleWheel, and instead use from another mod or create my own, as that would give me a lot more freedom. I still want to make the telemetry mod though. :)

Link to comment
Share on other sites

Since a year ago there had been quite a few mods about *realism* wheels, engines and track, but they're all dead because the developer's left. I figure you're ambitious judged from the dev plan. If you want this to be an important "realism vehicle" mod, I think you should make it copyleft so that other developers can work on it.

Actually the TweakableWheels is under CC-ANS 4.0 which clearly states "share alike". Having "You may not redistribute and/or modify this mod without permission" is bad manner.

Now I'm glad people are interested in developing this, here's some ideas regarding the current release:

1) Use MM. There's absolutely no need to pack redundant parts like jerrycan.

2) I think RollKage has some nice models for piston engines, their developer's more into 3-d art instead of physics. You should talk to them about collaboration

3) There needs to be some regulator code for "engine power". I think the simplest way is to go around the resource system: it's not designed for this kind of purpose. You can make each piston have a "engine" part module, to calculate power and fuel consumption based on throttle probably. Each "wheel" has a "wheel" part module, which sums up the power and distribute it, and set the correct torque each tick.

4) Never use resource air intake. Use code to determine oxygen and atmosphere and turbocharger etc.

Link to comment
Share on other sites

Since a year ago there had been quite a few mods about *realism* wheels, engines and track, but they're all dead because the developer's left. I figure you're ambitious judged from the dev plan. If you want this to be an important "realism vehicle" mod, I think you should make it copyleft so that other developers can work on it.

I don't want this to be considered a "realism" mod, i made this mainly to fix some problems with stock wheel racing that i pointed out in the OP. I am ready to sacrifice realism for simplicity of use, even though that doesn't mean i don't want stuff like transmission.

Actually the TweakableWheels is under CC-ANS 4.0 which clearly states "share alike". Having "You may not redistribute and/or modify this mod without permission" is bad manner.

Thanks, i updated the license now.

1) Use MM. There's absolutely no need to pack redundant parts like jerrycan.

2) I think RollKage has some nice models for piston engines, their developer's more into 3-d art instead of physics. You should talk to them about collaboration

3) There needs to be some regulator code for "engine power". I think the simplest way is to go around the resource system: it's not designed for this kind of purpose. You can make each piston have a "engine" part module, to calculate power and fuel consumption based on throttle probably. Each "wheel" has a "wheel" part module, which sums up the power and distribute it, and set the correct torque each tick.

4) Never use resource air intake. Use code to determine oxygen and atmosphere and turbocharger etc.

1) I didn't understood what you said. What Module Manager has to do with the jerrycan? Isn't it just a utility to edit other configs at load time? (not that it isn't awesome)

2) It has very nice models, but i need pistons to be separate so that the player has freedom over layout and placement.

3) Currently, each piston is a separate part, and there is a RoverEngine module on each of them, and they produce as much EnginePower as they can (while turned on).

Here is my plan for fixing the current issue and paving the way for the "realistic engine simulation":

A "Engine core" part, with various sizes, to which the player needs to attach all pistons. The engine simulation will be on the core, with the pistons serving only for determining the power of the engine. The core will be the part that creates (and stores) EnginePower, and also the part that consumes LiquidFuel. Later, RPM simulation will be done on the core too, and transmission on a separate part (a "gearbox").

This brings the (technical) benefits of having things centralized on one part, while still with the benefits of versatility for the user, as the number of pistons is customizable. It also does not allow the player to just put pistons all across the vehicle at impossible places.

I am looking for an alternative to stock KSP ModuleWheels, because it would allow for a lot more freedom. Do you know anything i could use? (besides creating my own, which would take a lot of time and effort.)

4) Why is IntakeAir that bad?

Link to comment
Share on other sites

First about realism: I'm talking about physical model here. Since the goal is to create a simulation of a piston engine and transmission etc, this is realism by definition. In the end you could have everything overpowered, but that's configurable.

1) For example for the wheel you can use, there's no need to have duplicate models. Much simpler this way


+PART[roverwheel]
{
//...
}

or rather use @PART, by installing the mod people mean to use it. And using @PART won't break save when people delete the mod.

3) Having a central part or not, calculating power is the easy part. How to distribute torque to each wheels is bit complicated. That's why I recommend having a partmodule in wheels to set torque every tick. For example ,

torqueCurve

{

key = 0 80 0 0

key = 55 30 0 0

key = 80 0 0 0

}

This is totally arbitrary. No matter how you tweak them they'll be off at some point. What I have in mind is :

what happens each tick:

a) engine calculates RPM based on wheel diameter, surface speed and gear ratio

B) engine calculates torque based on RPM and throttle/control axis, and sets the fuel consumption

c) each wheel calculates torque distributed to itself, multiplied gear ratio

d) each wheel sets torqueCurve like (for example the torque is 26.4)

torqueCurve

{

key = 0 26.4

key = 1000 26.4

}

Also you can check out Snjo's FSWheels, or TT multiwheels, both have side slip I think

4) See the discussion in the first page of Advanced Jet Engine thread.

Seems to me the whole "IntakeAir" thing is like a quick and dirty hack to make jet engine work in a rocket's physical model. However it's physically wrong and brings far more problems than benefits. Now over a year later in 0.23 they make jet engines automatically throttle down when intake is slow -- still wrong

Edited by camlost
Link to comment
Share on other sites

  • 5 months later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...