Jump to content

[1.0.x] [V1.9f] Kerbal Foundries wheels, anti-grav repulsors and tracks


lo-fi

What to work on next?  

1,282 members have voted

  1. 1. What to work on next?

    • More wheels
      123
    • More tracks
      453
    • Rover bodies
      241
    • Landing gear
      137
    • Landing legs
      108
    • Something completely different
      193


Recommended Posts

I am INVINCIBLE!!!!! Lots of cool new stuff about to happen and everything is in chaos. Usual prerelease status...

Does this mean H will break G? (Or i this a 1.9? :) )

Link to comment
Share on other sites

The repulsor module was a mess from adding in the gimbal, and the retract routines had become an unmaintainable mess. For some reason, they had stopped consuming EC - I couldn't work out why, so I re-wrote. Still in progress. Thanks for the hint on the sounds, that does make sense. I knew it didn't work, but hadn't got as far as figuring out why. I know ho to set up the effects node, but how do I use that in the engine module? Just refer to it by names? What about the path? Why does this have to be so hard?!?!?!

Hopefully nothing existing broken, but next will be 1.9 :D

Link to comment
Share on other sites

Gaalidas, DustFX is throwing Nullrefs all over the place:



NullReferenceException: Object reference not set to an instance of an object
at KerbalFoundries.KFDustFX.OnDestroy () [0x00000] in <filename unknown>:0
UnityEngine.Object:DestroyImmediate(Object, Boolean)
UnityEngine.Object:DestroyImmediate(Object)


:MoveNext()

Link to comment
Share on other sites

Riocrokite, I know this was something you were after:

I re-wrote the suspension stuff to make this to happen. It's now more modular, making landing legs much easier when I get round to building some.

Link to comment
Share on other sites

Riocrokite, I know this was something you were after:

http://youtu.be/yQJ2qA_Zhus

I re-wrote the suspension stuff to make this to happen. It's now more modular, making landing legs much easier when I get round to building some.

i'm coming back to hotel totally sun-burnt and I find this. Purely AWE-SOME ! \o/

greetings from Greece :)

Link to comment
Share on other sites

I've got a couple of bits to tidy up and double check, but if you're OK with the Unity scene and the config to guide you, you can start right away. I'll get everything updating into Git for you.

- - - Updated - - -

i'm coming back to hotel totally sun-burnt and I find this. Purely AWE-SOME ! \o/

greetings from Greece :)

Hehe. Never a dull moment here ;) hope you're enjoying your holiday!

Link to comment
Share on other sites

I've got a couple of bits to tidy up and double check, but if you're OK with the Unity scene and the config to guide you, you can start right away. I'll get everything updating into Git for you.

Sure, a unity scene and config should be plenty to figure it out :). Any chance of getting a pre-release .dll once you commit the feature to github?

Link to comment
Share on other sites

Cool. Yeah, we may have to do some testing. Trouble is, the latest .dll requires all the configs to be re-written, so I can't let it out into the wild as an interim update without being packaged with all the other stuff. You're always welcome to grab from the GitHub repo for testing, of course. Latest dev build resides in there, though code has been moved out to its own space to simplify things somewhat.

I will get there eventually! Feels like everything is in pieces at the moment, what with the rolling resistance stuff, vessel mass being passed to the colliders (which has made some surprising differences to the dynamics) and a major re-organisation of the modules. There are lots of part configs to look after theses days too! XD

EDIT: I ought to add that I've made some serious optimisations, though. Rather pleased with that.

EDIT2: Zodius, I've added you into the KSP422 repo. The scenes, source files and everything for my Unity setup is in there, so you can grab rigs for whatever you need. Everything else is up to date.

A few notes:

Many of the modules now take lists. For example, KFLookAt and KFSuspension.

In the case of KFLookAt, the format is:


MODULE
{
name = KFLookAt
targetName = Dummy002,Dummy003,Dummy004,Dummy005,Dummy006,Dummy007,Dummy008
rotatorsName = Strut02,Strut03,Strut04,Strut05,Strut06,Strut07,Strut08
activeEditor = true
}

The targets and rotators relate to each others index positions, so Strut02 looks at Dummy002, Strut08 looks at Dummy008. They look along Z+, rotate around X, and ONLY X - no need to worry about funny rotations if slightly off plane.

KFSuspension works in a similar way - it accepts lists of WheelColliders:


MODULE
{
name = KFSuspension
colliderNames = WCL,WCR
susTravName = SusTravInner
susTravAxis = y
}

Only one suspension Traverse object is support per module declaration, though. This is because it's designed to average the travel of how ever many WheelColliders it's given and move the single susTrav object accordinly (this is how I got the swing axle to work).

ONE THING TO NOTE (I know we've discussed it, but just in case you forget!)

The names of objects are searched using StartsWith(). This might seem odd, but this is how I get asymmetric parts in KSP. I have handed parts inside one parts. The code destroys the unused one then the other modules get to go and find their objects. So for each hand, you have objects that might be called WC01Left and WC01Right, one of which gets destroyed before any objects are searched for. Of course, in the config in a MODULE looking for such an object, you'd just tell it to look for WC01 and whichever version is left after one hand being destroyed will get found. I know I won't have to spell out what happens if you have objects named WC, WC001, WC002 and you try finding WC... Just something to be careful of, but it opens up some really interesting part design possibilities.

Edited by lo-fi
Link to comment
Share on other sites

Gaalidas, DustFX is throwing Nullrefs all over the place:



NullReferenceException: Object reference not set to an instance of an object
at KerbalFoundries.KFDustFX.OnDestroy () [0x00000] in <filename unknown>:0
UnityEngine.Object:DestroyImmediate(Object, Boolean)
UnityEngine.Object:DestroyImmediate(Object)


:MoveNext()

Hey, I got no clue there. Last time that happened to me it was because I wasn't compiling in .net 3.5. Either way, it worked last time I tested the last code update I did, so unless you've been fiddling around... -shrugs-

- - - Updated - - -

Riocrokite, I know this was something you were after:

http://youtu.be/yQJ2qA_Zhus

I re-wrote the suspension stuff to make this to happen. It's now more modular, making landing legs much easier when I get round to building some.

Those things are seriously awesome.

Link to comment
Share on other sites

Hey, I got no clue there. Last time that happened to me it was because I wasn't compiling in .net 3.5. Either way, it worked last time I tested the last code update I did, so unless you've been fiddling around... -shrugs-

- - - Updated - - -

Those things are seriously awesome.

I second that.

- - - Updated - - -

These in track form could be the most epic part at all. They should be made not that sturdy, though. :)

Link to comment
Share on other sites

No, I've not messed with that for ages. Looks like it's failing to remove the OnPause and OnUnPause hooks, but I can't figure out why. Targeting .net 3.5.

Pics of anything in-particular, Mekan1k?

Ooooo, track versions might be tricky. There are limits to how much I can bodge the visual trickery!

- - - Updated - - -

DustFX is failing to stop the wheel impact sounds:


void OnPause()
{
Debug.LogError("Enter OnPause");
isPaused = true;
Debug.LogError("Set isPaused");
kfdustFx.particleEmitter.enabled = false;
Debug.LogError("disabled particle emitter");
if (wheelImpact && (!Equals(WheelImpactSound, null) || !Equals(WheelImpactSound.audio, null)))
WheelImpactSound.audio.Stop();
Debug.LogError("disabled sound");
}

output_log says this:


Game Paused!

(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)


Enter OnPause

(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)


Set isPaused

(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)


disabled particle emitter

(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)


NullReferenceException: Object reference not set to an instance of an object
at KerbalFoundries.KFDustFX.OnPause () [0x00000] in <filename unknown>:0


at EventVoid.Fire () [0x00000] in <filename unknown>:0


at FlightDriver.SetPause (Boolean pauseState) [0x00000] in <filename unknown>:0


at PauseMenu.Display () [0x00000] in <filename unknown>:0


at PauseMenu.Update () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

So it's happy up until the debug statement Debug.LogError("disabled particle emitter"); then bugs out trying to stop the wheel impact sound. Is that something you've played around with? I can't recall doing so myself.

Now, I think I've found the culprit:


void DustAudio()
{
if (!wheelImpact || Equals(WheelImpactSound, null) || Equals(wheelImpactSound, string.Empty))
return;
<SNIP>

Something you can look into? I've got so much to do!!

Link to comment
Share on other sites

Well, i dont really understand your code in terms of how it works for tracks, but isnt it possible to have the wheel functionality as is with a track model? Maybe just 2 wheels per side on that arms for optics, with just the wheel behavior as seen in this vid?

Link to comment
Share on other sites

Tell you what, I'll do another modding live stream on Wednesday and explain how it all works :) It looks so simple, but this is a far cry from how any other wheels functions - I've used some crazy bodges!

Don't worry, Gaalidas. The correct check is


if (!wheelImpact || Equals(wheelImpactSound, string.Empty))
return;

Link to comment
Share on other sites

Due to the fact that i am father of 2 children i cant promise to see that livestream, will there be a record of it?

- - - Updated - - -

Just maybe i consider changing my mod target, but still standing at the beginning...but i am not satisfied with most of the landing gear and wheels stock KSP provides...^^

Link to comment
Share on other sites

Tell you what, I'll do another modding live stream on Wednesday and explain how it all works :) It looks so simple, but this is a far cry from how any other wheels functions - I've used some crazy bodges!

Don't worry, Gaalidas. The correct check is


if (!wheelImpact || Equals(wheelImpactSound, string.Empty))
return;

Wait... where did you find the blunder?

- - - Updated - - -

Now, I think I've found the culprit:


void DustAudio()
{
if (!wheelImpact || Equals(WheelImpactSound, null) || Equals(wheelImpactSound, string.Empty))
return;
<SNIP>

Something you can look into? I've got so much to do!!

Spoke too soon. There's the culprit.

EDIT: Oddly enough, this worked perfectly fine in all my tests. I'll correct it though, hopefully it will work out alright in the end.

- - - Updated - - -

Alright, so, I remember (thought couldn't find the post) where you asked about the sounds and how to reference them. I dug up the config for the B9 HX-series engine as an example.

So, you already know how to set up the effect node for a sound, but the way to reference that sound is actually quite simple. Note, I think you might have to use the FX version of the engine module for this to work right, though I could be wrong. Mess with with it a bit.


EFFECTS
{
power_closed
{
AUDIO
{
channel = Ship
clip = sound_rocket_hard
volume = 0.0 0.0
volume = 1.0 1.0
pitch = 0.0 0.2
pitch = 1.0 1.0
loop = true
}
}
power_plasma
{
AUDIO
{
channel = Ship
clip = sound_rocket_hard
volume = 0.0 0.0
volume = 1.0 1.0
pitch = 0.0 0.2
pitch = 1.0 1.0
loop = true
}
}
engage
{
AUDIO
{
channel = Ship
clip = sound_vent_medium
volume = 1.0
pitch = 2.0
loop = false
}
}
disengage
{
AUDIO
{
channel = Ship
clip = sound_vent_soft
volume = 1.0
pitch = 2.0
loop = false
}
}
flameout
{
AUDIO
{
channel = Ship
clip = sound_explosion_low
volume = 1.0
pitch = 2.0
loop = false
}
}
}

So, in the above code you have all of the effect nodes (I stripped out the smokescreen stuff to save space). In the engine config you get this:


MODULE
{
name = ModuleEnginesFX
engineID = ClosedCycle
powerEffectName = power_closed
thrustVectorTransformName = nozzle_transform
exhaustDamage = true
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 19080 // 21200 * 0.9
heatProduction = 390
useEngineResponseTime = True
engineAccelerationSpeed = 1.60
engineDecelerationSpeed = 2
PROPELLANT
{
name = LiquidFuel
ratio = 0.9
DrawGauge = True
}
PROPELLANT
{
name = Oxidizer
ratio = 1.1
}
atmosphereCurve
{
key = 0 323 // 308 * 1.05
key = 1 281 // 268 * 1.05
}
}

MODULE
{
name = ModuleEnginesFX
engineID = HybridPlasma
powerEffectName = power_plasma
thrustVectorTransformName = nozzle_transform
exhaustDamage = true
ignitionThreshold = 0.1
minThrust = 0
maxThrust = 4280 // 4761 * 0.9
heatProduction = 500
useEngineResponseTime = True
engineAccelerationSpeed = 1.60
engineDecelerationSpeed = 2
PROPELLANT
{
name = ElectricCharge
ratio = 16.5
}
PROPELLANT
{
name = LiquidFuel
ratio = 0.9
DrawGauge = True
}
PROPELLANT
{
name = Oxidizer
ratio = 1.1
}
atmosphereCurve
{
key = 0 840 // 800 * 1.05
key = 1 230 // 220 * 1.05
}
}

From what I can tell, states such as "engage" and "flameout" are default within the engine module (I plan to look at the code later to find uot if those can be re-targetted) and so you need not reference those effects directly from the engine config, but can redefine the sounds simply by making an EFFECT node that uses the same name as that standard engine state. This includes the running effect, if your engine uses the standard running effect. However, as you can see in the config, you can re-target certain states of the engine as they did with the HX-series (especially since it's a dual-mode engine) by using the parameter "powerEffectName" and specifying the node within the EFFECTS node that corresponds to what audio/effect preset they want to use.

So, like in the old system where you would have simply re-targetted the sound file with "sound_file_name = engine_state" without having to re-target anything in the engine config, the EFFECT system allows you to do pretty much the same... just with more work involved, and more power at your fingertips.

EDIT: I took a look at the stock ModuleEnginesFX module in ILSpy and discovered this:


[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] flameoutEffectName = .([COLOR=#00008b]140586[/COLOR]);
[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] runningEffectName = .([COLOR=#00008b]140635[/COLOR]);
[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] powerEffectName = .([COLOR=#00008b]140650[/COLOR]);
[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] engageEffectName = .([COLOR=#00008b]140603[/COLOR]);
[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] disengageEffectName = .([COLOR=#00008b]140616[/COLOR]);
[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] directThrottleEffectName = .([COLOR=#00008b]141801[/COLOR]);
[KSPField]
[COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] spoolEffectName = .([COLOR=#00008b]141830[/COLOR]);

If you ignore those numeric targets that ILSpy couldn't make sense of, you still get a good idea of all the engine states that you could re-direct to a different effect node. For instance, if you wanted the APU unit to be able to run in an air-breathing mode and a vacuum mode, based on need, you could redirect the different engine configs to use "powerEffectName = Open_power_effect" and "powerEffectName = Closed_power_effect" (open cycle and closed cycle respectively) along with two different nodes under EFFECTS.

interestingly enough, I haven't witnessed any custom parts using things like "directThrottleEffectName" or "spoolEffectName" which I'm unsure what would be, honestly, but i think the engine modders need to start looking at all the possibilities. I am also unsure how the engine module determines what the current status of the engine is in order to know what effect to reference. I suspect it's somehow based on an animation state in the model, but it could also be environmental situations and fuel availability of various sorts based on what the engine is requesting and whatnot. Overall it's fairly complicated and way above my paygrade at this time.

Edited by Gaalidas
Link to comment
Share on other sites

Cheers dude, I got it. I've converted the APU to the newer ModuleEnginesFX. Not sure about the sound - maybe needs a little more mashing in Audacity before it's acceptable, but it's better than the inane screech of the jet sound effect.

I noticed you did some culling of zeros in the configs! I've done a bit of messing with the tangents on the floatcurves, and found the "auto" mode to be pretty satisfactory for simple curves like we're using. Not specifying the entry and exit angles for each point activates that mode, which id why I started changing. Also in need of update in the configs is weight, cost, and a few other bits I can't remember - Riocrokite was kind enough to produce a spreadsheet that we'll have to dig out. There'a also the rolling resistance curves, which are only applied to the medium wheels and medium tracks properly IIRC. I'll have to come up with a generic set of number that works well for tracks and wheels so at least they can be plugged into the configs for tweaking at a later date. Still seems like there's a lot to do, but keep ticking jobs off the list.

Link to comment
Share on other sites

It's just like:

lo-fi:

"Hey Gaalidas there is something ive not gone through, wassup with this"

Gaalidas (with sparks impacting from his head directly into the keyboard):

"OUTPUT

OUTPUT

OUTPUTOUTPUOUTPUTOUTPUTOUTPUTOUTPUTOUTPUT

OUTPUTOUTPUTOUTPUTOUTPUTOUTPUTOUTPUT

OUTPUTOUTPUTOUTPUT

'Spoiler:'

OUTPUTOUTPUTOUTPUTOUTPUTOUTPUTOUTPUT

OUTPUT!"

Wakarimasen, ka? :D

Its hilarious to follow you both through this thread, thank you. :)

- - - Updated - - -

Ofcourse no offence intended.

- - - Updated - - -

Nah i failed the last post...in reverse its nothing else Oo

Edited by Tyren
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...