Jump to content

Ground Effect Development Thread


Capital_Asterisk

Recommended Posts

I don't know how expensive the raycast is, but I see at least two other ways to get your AGL:

vessel.radarAltitude

vessel.altitude - vessel.terrainAltitude

These two should probably be the same.  Either should be much less expensive than doing the raycast.  The problem I see is that if you have a craft with a lot of lifting surfaces, control surfaces, etc, there will be increased overhead for each raycast.

I do understand that using a single value will not be as accurate as for individual parts, but personally, I would give up a little bit of accuracy for better performance.

I am watching this with extreme interest, feel free to ask for help if you need it

Link to comment
Share on other sites

16 hours ago, Capital_Asterisk said:

It shouldn't work with FAR at all, it uses its own values and ignores the stock aerodynamic values during flight. I'll add FAR compatibility before the official release.

Do you have FAR working for 1.5.1 for test? 

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 10/24/2018 at 9:07 PM, Me1_base said:

Do you have FAR working for 1.5.1 for test? 

Nope. Just tried for my career save(1.5.1) with FAR(LightHill) and the game crashed. 

I lost another shuttle, full of rescuees, right down on the runway because of the bouncing and skidding. Beside my poor landing skills, too much landing speed was the cause, I believe.

Desperately need this mod for the safe landing.

 

EDIT: the crash was not from this mod. Can open game without any problem, but the mod is not working.

Edited by JWS
Link to comment
Share on other sites

On 11/9/2018 at 6:41 PM, linuxgurugamer said:

@Capital_Asterisk  Any progress on this?

I'm still working on this, there has just been other things I've been working on (such as making a new aerospace simulator entirely). I think it's kind of important to have ground distance vary between parts; this allows some ekranoplan designs to stay stable without SAS. After a bit of research, I'd agree that that raycasting per wing per update can really kill performance. The newest commit has some conditions that prevent raycasting when not necessary, but I just got another idea while typing this. Instead of raycasting, radarAltitude and terrainNormal (or a few raycasts around the vessel) are used to approximate a flat plane below the vessel, and distance from that is calculated per part using only geometry. This might also work better as a VesselModule instead. That's the best solution I can think of so far.

Also, the state of FAR compatibility: the code is there but it doesn't work. The method I use is very hacky: get aero force from FAR module, scale, then apply it as force. I've successfully accessed the FAR PartModule, but AddForce behaves weirdly or (most likely) I don't know how FAR works and the aero force values it provides are not used in the way I think they are. Considering that this is going to be an aerodynamics mod for an aerodynamics mod, and how FAR is designed to make KSP more realistic, ground effect should instead be part of FAR itself.

Link to comment
Share on other sites

On 11/22/2018 at 6:48 PM, Capital_Asterisk said:

but I just got another idea while typing this. Instead of raycasting, radarAltitude and terrainNormal (or a few raycasts around the vessel) are used to approximate a flat plane below the vessel, and distance from that is calculated per part using only geometry.

Ummm, isn't that what I suggested here:

 

Link to comment
Share on other sites

  • 3 months later...

Sorry for being slow, but this mod has been almost completely redone using a VesselModule instead of a PartModule. The PartModule version has a couple flaws. The 12,000 raycasts per second kills performance, and the module is saved into crafts, which show up as invalid if the mod isn't installed.

New version calculates once per-vessel instead of per-wing. Performance is a couple thousand times faster, using only a single raycast. There are also some calculations that approximate the wingspan of the vessel, which scales the distance at which the effect start. Also, Module Manager is no longer required.

On 11/23/2018 at 4:46 PM, linuxgurugamer said:

Ummm, isn't that what I suggested here:

Sort of, but it considers the positions of the individual parts. This new version uses terrain distance and normal to create a Unity Plane where the ground would be. Ground distance is approximated using GetDistanceToPoint.

Link to comment
Share on other sites

There's a bug that causes vessels consisting of a single wing to enter the NaN dimension, breaking the game. So decoupling a wing from a stack separator, or having a wing explode off of a craft, would destroy everything. This has been fixed in the latest release. By now, I think it's time to post this on Add-on Releases.

On 3/20/2019 at 3:01 PM, linuxgurugamer said:

If this is in a good state, would you mind if I added it to CKAN?

Sure!

Link to comment
Share on other sites

Again, I found another bug that causes small vessels landed in water to explode violently. Wings get a huge increase of lift when they have a negative depth (underwater). I'll fix this soon. I don't know whether to trust myself or not when I say something is ready for release.

On 3/24/2019 at 8:12 AM, plausse said:

How does this play with FAR these days? I'm obviously very excited.

Sorry, but I decided to discontinue FAR support for a couple of reasons:

  • Solution would be like writing a separate mod, as FAR completely replaces stock aerodynamics.
  • Rewriting and replacing parts of FAR is hacky and inelegant
  • An aerodynamics mod for an aerodynamics mod wouldn't be good
  • FAR source code is slightly difficult to understand

As I mentioned in a previous post, ground effect (the phenomenon) should instead be added as a feature to FAR itself.

 
 
Link to comment
Share on other sites

  • 6 months later...
On 3/25/2019 at 3:01 PM, Capital_Asterisk said:

 

Again, I found another bug that causes small vessels landed in water to explode violently. Wings get a huge increase of lift when they have a negative depth (underwater). I'll fix this soon. I don't know whether to trust myself or not when I say something is ready for release

Wondering the state of the mod, I don’t see any recent updates on Github

Link to comment
Share on other sites

  • 7 months later...
On 9/9/2018 at 7:21 AM, Capital_Asterisk said:

First post, I've just been looking around the forums for some help, though you might recognize me from the /r/kerbalspaceprogram discord server. I'm not really sure if I'm doing things properly. Plenty of testing, cleaning, and a few tweaks is needed for this mod to be considered complete. I also have a mod that creates particles on separations, and one that ejects kerbals when the cabin explodes. This was the only mod that seemed successful.

Were these ever released anywhere?

Link to comment
Share on other sites

Sorry about the double post, but this is a separate thing from my previous post.

@Capital_Asterisk Do you think it would be possible to make a multiplier for the ground effect available to module manager so users can define it on a per part basis? I really want to create some alexander lippisch style wing in ground effect craft, which have optimized reversed delta wings in an anhedral angle, almost like a hover craft skirt, which perform far better in ground effect than traditional wing shapes. I basically want to use MM to create duplicates of the stock wings, intended to be used in this different orientation, with a 2 x multiplier on the ground effect.

 

In reality they enter ground effect at a larger % of their wing span than regular wings do. The Ekranoplan was able to achieve ground effect at about 10% of it's wingspan, while most of the WIG crafts shown in this link are able to achieve it at about 50% of their wing span....I imagine just applying a multiplier to the effect would be easier than altering the calculation of wingspan and altitude, but I'm not a programmer. I love that ksp mods so often abstract aspects of physics from reality in order to  be more playable or for performance reasons, so either a per part lift multiplier, or a per part altitude % mechanic would be fine with me.

http://www.hassanhameed.com/?page_id=1108

X-113:
ac932489_X-113_lippisch-1.jpg
 

WIG-Lippisch-RFB-x-114.jpg

Edited by Errol
Link to comment
Share on other sites

  • 2 weeks later...
On 5/22/2020 at 11:40 AM, Errol said:

Sorry about the double post, but this is a separate thing from my previous post.

@Capital_Asterisk Do you think it would be possible to make a multiplier for the ground effect available to module manager so users can define it on a per part basis? I really want to create some alexander lippisch style wing in ground effect craft, which have optimized reversed delta wings in an anhedral angle, almost like a hover craft skirt, which perform far better in ground effect than traditional wing shapes. I basically want to use MM to create duplicates of the stock wings, intended to be used in this different orientation, with a 2 x multiplier on the ground effect.

...

Seems like something worth adding after not touching this mod for more than a year. It's definitely possible by just multiplying the calculated lift value with a coefficient from a config. I think all I have to do is add a new PartModule that does nothing but store that coefficient, and a bunch of other stuff to deal with it. This should make it possible to have a wing part that has a very low base lift, but goes really high in ground effect. Another quick and easy way is to just clip wings into each other so there's more lift, but it would end up flying instead of staying on the ground.

One of the big problems with this mod, is that it can't decrease the induced drag, which increases with lift. The thing where the lift vectors become more vertical in ground effect doesn't seem to be possible with stock KSP wings. The lift force is stuck perpendicular to the wing or I just didn't try hard enough. I seem to be in the mood for working on random projects, so I might make some updates to this mod very soon. Using ModularFlightIntergrator seems promising, just hoping I don't have to completely rewrite the aero model.

On 5/18/2020 at 12:04 PM, Errol said:

Were these ever released anywhere?

nope. If I ever get the kerbal ejector working slightly better, it will be called Eject-A-Kerbal because the kerbals become ejecta. I might actually work on the decoupler particles one, just that the new way Unity and KSP deal with particle systems is hard to work with and is undocumented last time I checked.

Link to comment
Share on other sites

  • 2 weeks later...

So far, it seems I found another way to modify lift force without changing lift coefficients and without using ModularFlightIntergrator. The mod now applies forces directly to the wing parts, as well as modify the blue lift arrows. The normal FlightIntergrator puts the calculated lift force into ModuleLiftingSurface.liftForce, and KSP has a TimingManager that can be used to run an update function after the ModularFlightIntergrator has done its magic. liftForce is useful for calculations, and doing something like applying negative of this value using part.Rigidbody.AddForce cancels the force entirely.

Using a bunch of vector math, I was able to calculate induced drag and other excrements for a more realistic ground-effect effect.

This boi is too heavy to leave ground effect. Lift multipliers has been set really high for testing purposes, and the lift vectors are more vertical because of induced drag reduction.
screenshot433.png

I find KSP mod development very stressful due to slow performance, loading time, variables that have no description, and having to dig through the source code of existing mods to maybe find some useful techniques. There's a bunch of other projects that I enjoy working on, so this is kind of a low priority. I'll get the custom multiplier configs done in maybe a week for a new release.

Link to comment
Share on other sites

On 6/16/2020 at 4:39 AM, Capital_Asterisk said:

So far, it seems I found another way to modify lift force without changing lift coefficients and without using ModularFlightIntergrator. The mod now applies forces directly to the wing parts, as well as modify the blue lift arrows. The normal FlightIntergrator puts the calculated lift force into ModuleLiftingSurface.liftForce, and KSP has a TimingManager that can be used to run an update function after the ModularFlightIntergrator has done its magic. liftForce is useful for calculations, and doing something like applying negative of this value using part.Rigidbody.AddForce cancels the force entirely.

Using a bunch of vector math, I was able to calculate induced drag and other excrements for a more realistic ground-effect effect.

This boi is too heavy to leave ground effect. Lift multipliers has been set really high for testing purposes, and the lift vectors are more vertical because of induced drag reduction.
screenshot433.png

I find KSP mod development very stressful due to slow performance, loading time, variables that have no description, and having to dig through the source code of existing mods to maybe find some useful techniques. There's a bunch of other projects that I enjoy working on, so this is kind of a low priority. I'll get the custom multiplier configs done in maybe a week for a new release.

Thank you so much for your efforts. I only understood about 50% of what you said here, but it sounds like good news.

On a somewhat related note, do you have or would you consider a patreon account to help mitigate the stress of the clunky process for modding ksp? (I'd love to help make sure you always have a coffee or beer in hand, as per your preference, while working on ksp mods)

EDIT: also, I'm unable to see the screenshot you attached to this post, is that just on my end (my browser) or is it just the file name txt for others too?

Edited by Errol
Link to comment
Share on other sites

8 minutes ago, Errol said:

Thank you so much for your efforts. I only understood about 50% of what you said here, but it sounds like good news.

On a somewhat related note, do you have or would you consider a patreon account to help mitigate the stress of the clunky process for modding ksp? (I'd love to help make sure you always have a coffee or beer in hand, as per your preference, while working on ksp mods)

EDIT: also, I'm unable to see the screenshot you attached to this post, is that just on my end (my browser) or is it just the file name txt for others too?

I'm able to see it. Looks like it is hosted on Discord, maybe you need an account to see their content or something.

Anyway, It is a picture of a chubby little shuttle with only control surfaces that can just barely fly.

Link to comment
Share on other sites

Hmmm...weird, edge loads the image just fine, but firefox doesn't....oh well.....anyway, that is a super cool looking little stubby shuttle. I'm looking forward to making the smallest/slowest moving possible WIG, use the space centre as an obstacle course...

Link to comment
Share on other sites

  • 1 month later...
On 5/22/2020 at 11:40 AM, Errol said:

Do you think it would be possible to make a multiplier for the ground effect available to module manager so users can define it on a per part basis? ........

That's done now. Lift multiplier can be changed for a part by adding a ModuleGroundEffect to it.

MODULE
{
	name = ModuleGroundEffect
	groundEffectMultiplier = 200
}

New version with the induced drag reduction and stuff is released on the github page.

 

Link to comment
Share on other sites

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...