Jump to content

[0.90][WIP]Intake Build Aid


LordFjord

Recommended Posts

Intake Build Aid

previously called Synced jet flameouts

This is the dev thread, release thread is over here.

So, what is this all about? What does it do?

It changes no parts and no game behaviour. What it does is rearranging the parts of your jet-powered rocket, plane or SSTO, specifically its intakes and engines within the ship's part list. So basically just a reordering task.

But why? Because of Kasuha's wonderful work on resource flows, specifically the intakes and jet engines part of it.

When you usually build a jet powered vessel, you are more focussed on the design and funcionality and not on the order of placing the parts.

When flying on the edge to space, where the air gets thin, this usually results in an asymmetric flameout of your airbreather engines, resulting in the dreaded "spin of death". When placing intakes and engines in a specific order, this can be prevented almost completely, resulting in less crashes, more dV in orbit and whatnot. So far I haven't found any mod that tackles this task (if there is one, please point me towards it).

I still do not understand what this mod does

You build your airbreather engine powered vessel like usual, then you hit the magic key (see below) and your vessel will be able to fly at higher altitudes before a flameout of the engine happens. If you also match intake and engine numbers, chances are good that if a flameout happens at high altitude, then on all engines and at the same time.

This is not cheating, just applying some building tricks that people smarter than me found out.

So a typical example of:

- engine

- engine

- intake

- intake

becomes:

- intake

- engine

- intake

- engine

Usage

The mod can do 3 things:

- point at a intake or airbreather engine and hit F6 -> the respecitvely assigned intakes and engines will be highlighted ( intakes blue, engines red )

- hit F7 -> the mod rebuilds the engine/intakes in an optimized order, it will attempt to distribute the intake area equally to all engines

- manual assignment of intakes to engines. To do this, point at an intake and hit F8, then the next intake and F8, and so on. The next engine that you point at and hit F8 will get all the previously marked intakes assigned to.

No pics no clicks

Some examples:

Javascript is disabled. View full album

Settings

Settings.cfg in the mod folder. You can reassign the 3 Keys and choose between the custom highlight shader seen in the pics or the default KSP highlight mechanics with different colors.

Version History

0.4 (2014.12.19)

----------------

Updated for KSP version 0.90

Renamed mod from SyncedJetFlameouts to IntakeBuildAid

3 modes: intake/engine highlighting, intake/engine balancing, manual assignment of intakes to engines

Key settings can be changed via editing the settings.cfg file.

Alternative (default KSP) part highlighting method I found randomly. The useCustomShader setting can set if the highlight display is via default KSP methods or a custom, more visible shader.

Fixes in logic to find intakes or engines

0.3 (2014.11.26)

----------------

New algorithm based on distributing intakes based on their intake area. Biggest intakes are distributed first, smaller ones after this. The engine with the least amount of assigned intakearea will get the next intake assigned.

A message will be displayed after hitting alt-F showing what the mod did. Either nothing (no intakes or airbreather engine) or a list of assigned intakes to engines with the total intake area assigned to the engine.

I find that this algorithm works very well. I would like to have more feedback on this from YOU :)

0.2 (2014.11.22)

----------------

Improved intake detection via resources, improved engine detection via propellant (intakeair + liquidfuel required).

Intakes are now assigned by type. Algorithm works best with matching intakes per type to engines, for example 4 shock cores, 2 radial intakes for 2 RAPIERS.

0.1 (2014.11.21)

----------------

Proof of concept, only shock cone intakes and turbojet engines are handled, don't try with RAPIER or basic jets (will come soon, don't worry)

Limitations

As this is a proof of concept, the mod so far ONLY handles the shock core intakes and the turbo jet engines. Other intakes and engines are ignored. Now it supports all intakes and airbreather engines

Staging and turning engines/intakes on / off manually can change the airflow significantly. The mod probably won't be able to handle all those possible cases.

Plans

I intend to support all engines and all intakes, preferably in a way that it works with modded stuff without configuration, but I will need to learn a bit more about KSP for that. It should be possible though. done

I also would like to show some message to the user that the mod either did something or nothing because of <whatever condition failed>. done

Regarding GUI, I have some ideas:

- when pointing at an engine and pushing some key, highlight all intakes that are assigned to the engine

- when pointing at an intake and pushing some key, highlight the assigned engine

- "big maybe": allow assignments of intakes to engines manually. So you can highlight some intakes multiselect-style, then point at an engine and press some key to assign them to the engine. Maybe also display the sum of intakeVolume/sec

I think having at least the first two would be pretty cool. The 3rd would make it perfect. done

- A UI for better display of engines and its assigned intakes in a list, manual reordering via up/down buttons on the intakes, I've seen some other mods tackle reordering tasks this way.

- Find out if its possible to do this in flight.

- maybe add solar panels / ion engine support as they are affected by the same "flameout" mechanics as air intakes and airbreather engines - this would be low priority as the issue is practically nonexistant.

- some toolbar support

- support engine air intake ratio weighting in algorithm (so far all airbreathers are treated alike).

Download

See release thread

Source

GitHub

License

Beerware, just cause :cool:

Edited by LordFjord
plans for next version
Link to comment
Share on other sites

Oh heck yeah, I've been pining for something like this. Thanks so much for starting this project. :)

Some thoughts from a non-programmer:

Will the plugin break symmetry for engines or intakes placed with it? It seems to me it must to work properly but I could be wrong.

Regarding how an uneven multiple of intakes should be handled, perhaps the plugin could check for a centerline mounted engine and apply the odd number of intakes there?

Ideally the plugin would take into account different intake types, putting two ram intakes on one engine and two structural intakes on another would be non-optimal. Perhaps the plugin should try to evenly distribute intake area rather than number of intakes.

It should probably mentioned in the description that distributing intakes evenly does not prevent asymmetric flameout, instead it only delays it. Otherwise you'll get barraged with complaints that engines still flameout asymmetrically.

Link to comment
Share on other sites

Thanks for the ideas and feedback!

In fact I didn't intend to make this for new players but for lazy people like myself ;) I know how this thing works but its such a hassle to adjust the intakes and engines after a plane is finished. And the editor isn't very user-friendly about removing and readding partially clipped parts.

To the different types of intakes: I intend to group intakes by type and distribute them equally to the engines. Luckily the 3 airbreather engines in the game have all the same air consumption so I don't need to take that into account as well.

To the symmetry issue: I don't think that it breaks symmetry, as it is a property of each part in the craft file - and after I move it within the part list it still contains the same links to other parts and properties as before.

Uneven and leftover intakes are tricky. I will need to put a lot more thought into distributing the intakes. So far the mod only works if the numbers match - like 8 intakes for 4 engines. With my current approach and algorythm they also must match by intake type. I'm not sure what to do with the leftover intakes, for example when you have 4 shock cones, 4 engines and 2 radially mounted intakes. Where should the last 2 go?

I could either distribute them by best effort, then 2 engines would be left with less air and would flame out sooner, or I could do what I do now: nothing.

As menioned, I only just started with KSP modding and I have no idea how for example I could determine the "centerline mounted engine" and if there is one at all ;)

I'll take small steps, first intakes by type, then some messages to the user and so on. Once the mod becomes useful, I would encourage integrating this with some more widely used mod that tackles similar areas, editor extensions for example ;)

@Red Iron Crown: I didn't see your mod request but this was something I intended to make anyway :) Cheers

Link to comment
Share on other sites

@Red Iron Crown: I didn't see your mod request but this was something I intended to make anyway :) Cheers

No worries, I wrote that request a while ago and it dropped like a stone without a single reply so I thought no one was interested in it. That's why you starting this is such a pleasant surprise. :)

Link to comment
Share on other sites

Little update for version 0.2 (see 1st post):

Improved intake detection via resources, improved engine detection via propellant (intakeair + liquidfuel required).

Intakes are now assigned by type. Algorythm works best with matching intakes per type to engines, for example 4 shock cores, 2 radial intakes for 2 RAPIERS. It also tries to assign engines and intakes when the numbers do not match, but the result is not optimal (yet).

I am still working on a different assignment logic that does the best effort to cover all cases.

The current algorythm works as follows:

- it finds all engines and intakes, the intakes are grouped by type

- it stips the vessel of all found parts

- it goes through all engines, calculates how many intakes per type can be assigned to an engine (at least one intake per engine here)

- if the intake per type and engine numbers match, all are assigned equally.

- if the numbers do not match, the first engines will end up with more intakes - per type. So if you have a shock cone, a radial intake and an engine pod intake with 2 turbo jets, all of the intakes will be assigned to the 1st turbo. This is the part where the logic needs improvement

Im looking forward to feedback.

Link to comment
Share on other sites

I... I... Need this! I've literally only been using planes lately, and I had to assign action groops to shut down engines as they started to flame out. And you're telling me that because of this mod I no longer actually have to? Long live (looks up name) LordFjord!

Link to comment
Share on other sites

You could consider symmetric pairs of engines. Let's say we have two pairs of engines and 6 intakes. Then it should be a fine solution to give the first pair of engines two intakes each. The engines of the second pair will flameout first. By that time each engine of the first pair will use all the air from its two intakes, so no air will 'overflow' to the next engine in the list. If there is a single engine without symmetry, assign any single or leftover intakes to this.

Symmetric pairs of engines and intakes (with at most one single engine) should cover most cases of planes. When engines flameout in pairs, you keep yaw-stability which is the most important. There might still be moments in the pitch-axis but you can't generally avoid those with an arbitrary plane and some odd number of engines and intakes.

Link to comment
Share on other sites

I am still pondering what kind of intake/engine distribution would work best.

I did some tests and experiments (FOR SCIENCE!), see the results here.

I think I will go with a weighted distribution of intakes - based on their intakeVolume/sec value. Then I will start assigning the intakes to the engines, from the biggest to the smallest intakes. The engine with the least amount of assigned intakeVolume will get the next intake assigned.

This would still work with matching intakes/engines as in my 1st examples, but also on more complex intake configurations.

For example, take 3 turbojets, 2 ram intakes and 4 long radial intakes.

The 1st and 2nd turbojet would each get a ram, as those are the biggest intakes. The 3rd turbojet would get all 4 long radial intakes, because it has the least assigned intakevolume -> this would lead to a synced flameout of all 3 engines.

I think, even when the intakeVolumes do not match exactly, this is still a "best effort" configuration and still a lot better than without putting any thought to intake/engine configuration. This way each engine most likely gets at least some air, flameouts would happen later.

Link to comment
Share on other sites

A completely different idea: what about offering an interface so the player can enter the distribution? Including some intelligent visualization of the results. Maybe even visualize how the center of thrust shifts as the air gets thinner...

Link to comment
Share on other sites

Regarding GUI, I have some ideas:

- when pointing at an engine and pushing some key, highlight all intakes that are assigned to the engine

- when pointing at an intake and pushing some key, highlight the assigned engine

- "big maybe": allow assignments of intakes to engines manually. So you can highlight some intakes multiselect-style, then point at an engine and press some key to assign them to the engine. Maybe also display the sum of intakeVolume/sec

I think having at least the first two would be pretty cool. The 3rd would make it perfect.

So far the alt-F is fixed and I don't like it that way.

I will need to look up how make some config files for mods - so people can configure their key setup there OR find a way to hook into the KSP's native key configuration and add it there.

@pellinor:

take a look at Coffeeman's mod Show all fuels. It also displays intake airflow for engines. I think I will keep my mod in the area of the builders and only handle SHP/VAB stuff. Also, does the center of thrust really shift as the air gets thinner? That would be new to me. It moves when your engine thrusts change (and for example flame out, of course.

Edited by LordFjord
Link to comment
Share on other sites

New version 0.3 is up, see details and some example pics in the 1st post.

Regading the logic behind the scenes the mod works really good now, but I intend to add more graphical voodoo to it in the next version. Stuff like posted in the "plans" section.

Link to comment
Share on other sites

Also, does the center of thrust really shift as the air gets thinner? That would be new to me. It moves when your engine thrusts change (and for example flame out, of course.

Yes, by shifting center of thrust I was referring to the regime when there is not enough air for all engines. So in the beginning every engine will run at maximum thrust, so the CoT is an average weighted by engine thrust. When air is scarce (suppose no flameout yet), every engine is limited by its intake(s), hence the CoT is an average weighted by assigned intake area. The path between those border cases might be straight, or include more asymmetric situations (like one engine at full thrust and another near flameout). And the CoT will jump whenever an engine flames out.

I'd love a manual option, as you can set different priorities. You seem to optimize to have the first flameout as late as possible, while I would optiomize to make it symmetric even if it occurs earlier (supposing a typical spaceplane with symmetric pairs of engines). The player also just has more information he might use in some way, like engine thrust, Isp, placement and symmetry of engines, or stable/unstable axes of the craft. Or use plain trial and error.

Edit: as a consequence of the above CoT discussion, I'd suggest that you try to give each engine intakes according to its air consummation instead of distributing them uniformly. This might be tricky for engines with different trust curves and Isp ranges...

Edited by pellinor
Link to comment
Share on other sites

I assumed that the air intake consumtion of each jet engine is the same. Is this correct or am I looking at the wrong data?

From the Wiki:


PROPELLANT
{
name = IntakeAir
ratio = 15
}

This is the same for basic jets, turbojets and rapiers in airbreather mode.

I'd love a manual option, as you can set different priorities.

This is where I want to go actually. Next version hopefully will have a visual display of intakes and engines - depending over which you point your mouse and hit a key, and in the long run I would like to have a multiselect-style manual assignment possibility as well.

Link to comment
Share on other sites

As I understand, the fuel consummation is determined by thrust (depends on speed, so-called thrust curve of the engine) and Isp (depends on air density). Then these propellant ratios determine how the fuel consummation is divided into liquid fuel and intake air.

Link to comment
Share on other sites

I believe propellant consumption in Tons/second is Thrust/(Isp*9.82), with the different engines types following different Isp and thrust curves. All air breathers use IntakeAir and LiquidFuel in a proportion of 15:1 for propellant. From those two relationships the mass flow rate of intake air for an engine can be calculated.

The piece of the puzzle I'm less sure of is how IntakeAir supply is calculated, but I'd imagine it involves intake area, surface speed, and atmospheric pressure.

Edited by Red Iron Crown
Link to comment
Share on other sites

Thanks folks, that makes sense.

So for me the bottom line probably is: I'll keep it this way, looking at intake areas only - for now at least. I'll focus on the graphical voodoo and manual assignments next.

edit: I think I'll also rename this mod. Synced Flameouts sounds silly (sry, no native english speaker here). Might be better with IntakeAir Build Helper or something

Edited by LordFjord
Link to comment
Share on other sites

:blush: I haven't thought at all about mac and linux users. Sorry bout that.

Yes, so far it is hardcoded and I do not like it that way. Ideally I would like to have it integrated in KSP's key settings but I do not know (yet) how to do that. Alternatively in a config file.

I'm using this to check for the alt key:


Input.GetKey( KeyCode.LeftAlt ) || Input.GetKey( KeyCode.RightAlt ) || Input.GetKey( KeyCode.AltGr )

I do not know if this works on linux. Let me know if you'd prefer another key, maybe one of the F6-F8 keys, those are unused by default.

Link to comment
Share on other sites

Fun fact: did you know that the Aeris 4A's intakes each provide air to the engine on the other side? :D

Little teaser on the overlay stuff where I moved the mouse over one of the engines and pressed a key:

CNSZ7q7.jpg

Edited by LordFjord
Link to comment
Share on other sites

I moved the source to github. Sorry, no further news, I had some busy weeks and not much time for KSP lately. But I haven't given up. Still trying to figure out why some things work / don't work with unity - at least not the way I'd like it to behave.

So yeah, I'm trying to get the highlighting stuff work in a good way, also started work on the manual assignment of intakes to engines, but one thing after another.

The mod is certainly not ready for a release yet. I have like 100 questions to experienced modders...

Link to comment
Share on other sites

  • 2 weeks 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...