Jump to content

Porting thrust effects of ModuleEngines to ModuleEnginesFX?


trias702

Recommended Posts

Hello,

I am trying to port an old KSP mod engine which uses ModuleEngines to ModuleEnginesFX so that I can make use of some of the newer modules which only work with ModuleEnginesFX. Porting the actual engine stats is quite straightforward, but where I'm having extreme difficulty is porting over the thrust exhaust effects. The old way of defining thrust effects in ModuleEngines was like this:

fx_exhaustFlame_blue = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, running
fx_exhaustLight_blue = 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, running

Here, both effects are being bound to the "running" engine state, and the numbers are offsets for x, y, z, angle_x, angle_y, angle_z. My question is, how do I perfectly port over both of these effects and bind them correctly to "running" using the new ModuleEnginesFX system? Try as I might, I cannot get it to work, in that my engine generates no thrust flame/plume/light or sound at all when the throttle is used. The issue, I think, is with the EFFECTS{} declaration, but also something going wrong with FXModuleAnimateThrottle, which I don't understand anything about, as I think it has something to do with the model .mu file, and since I don't know anything about that file, perhaps I'm doing something wrong. I have read that using fx_exhaustFlame_blue and fx_exhaustLight_blue requires PREFAB_PARTICLE in the new system, so I have used that. 

Here is the current EFFECTS{} declaration I have. The node I'm trying to replicate from the old system is "running", but perhaps I have done something wrong with the other nodes too?

EFFECTS
	{
		disengage
		{
			AUDIO
			{
				channel = Ship
				clip = sound_vent_soft
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		engage
		{
			AUDIO
			{
				channel = Ship
				clip = sound_vent_medium
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		flameout
		{
			PREFAB_PARTICLE
			{
				prefabName = fx_exhaustSparks_flameout_2
				transformName = T_T
				oneShot = true
			}
			AUDIO
			{
				channel = Ship
				clip = sound_explosion_low
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		running
		{
			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
			}
			PREFAB_PARTICLE
			{
				name = exhaustFlame
				prefabName = fx_exhaustFlame_blue
				transformName = T_T
				emission = 0.0 0.0
				emission = 0.01 0.1
				emission = 0.075 0.25
				emission = 1.0 1.0
				speed = 0.0 0.35
				speed = 1.0 1.0
				localRotation = 1,0,0,-90  // oddly enough, this seems to equal 0,1,0 in the old system
			}
			PREFAB_PARTICLE
			{
				name = exhaustLight
				prefabName = fx_exhaustLight_blue
				transformName = T_T
				emission = 0.0 1.0
				emission = 0.01 1.0
				emission = 0.075 1.0
				emission = 1.0 1.0
				speed = 0.0 1.0
				speed = 1.0 1.0
				localRotation = 0,0,1,-90   // no clue if this is correct
			}
		}
	}

I then bind the "running" effect in the ModuleEnginesFX declaration like so:

MODULE
	{
		name = ModuleEnginesFX
		engineID = DeuteriumTritium
		thrustVectorTransformName = T_T   // the old, legacy declaration called it this, which I'm guessing connects with the .mu file somehow?
		exhaustDamage = True
		runningEffectName = running   // binding for the EFFECTS{} declaration
		ignitionThreshold = 0.1
		minThrust = 0
		maxThrust = 3500
		heatProduction = 280
		fxOffset = 0, 0, 0
		...

Finally, I have copied over the FXModuleAnimateThrottle declaration as it was in the old file. This module I do not understand at all, why is it required? From my very limited understanding, I think that the model .mu file defines some kind of render object which maps to graphical detail as the throttle moves. This render object has an explicit name, which for this part, according to the old code, is called "e22", and I'm guessing that FXModuleAnimateThrottle needs to somehow bind to this object such that it correctly displays the effects of the throttle going up? Anyway, here is the code I'm using, taken from the old part:

	MODULE
	{
		name = FXModuleAnimateThrottle
		animationName = e22
		dependOnEngineState = True
		responseSpeed = 0.5
		engineName = DeuteriumTritium
	}

 

So that's basically my ported over file in a nutshell. When loaded into a game, the engine works correctly, in that thrust is generated and the vessel moves in space, however, there is no exhaust/plume effect, and no sound at all of the engine running. If anyone could please help me to understand how to port over the original effects of fx_exhaustFlame_blue and fx_exhaustLight_blue such that they work for ModuleEnginesFX exactly like they used to work for ModuleEngines, I would be extremely thankful.

Link to comment
Share on other sites

4 hours ago, trias702 said:

Hello,

I am trying to port an old KSP mod engine which uses ModuleEngines to ModuleEnginesFX so that I can make use of some of the newer modules which only work with ModuleEnginesFX. Porting the actual engine stats is quite straightforward, but where I'm having extreme difficulty is porting over the thrust exhaust effects. The old way of defining thrust effects in ModuleEngines was like this:


fx_exhaustFlame_blue = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, running
fx_exhaustLight_blue = 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, running

Here, both effects are being bound to the "running" engine state, and the numbers are offsets for x, y, z, angle_x, angle_y, angle_z. My question is, how do I perfectly port over both of these effects and bind them correctly to "running" using the new ModuleEnginesFX system? Try as I might, I cannot get it to work, in that my engine generates no thrust flame/plume/light or sound at all when the throttle is used. The issue, I think, is with the EFFECTS{} declaration, but also something going wrong with FXModuleAnimateThrottle, which I don't understand anything about, as I think it has something to do with the model .mu file, and since I don't know anything about that file, perhaps I'm doing something wrong. I have read that using fx_exhaustFlame_blue and fx_exhaustLight_blue requires PREFAB_PARTICLE in the new system, so I have used that. 

Here is the current EFFECTS{} declaration I have. The node I'm trying to replicate from the old system is "running", but perhaps I have done something wrong with the other nodes too?


EFFECTS
	{
		disengage
		{
			AUDIO
			{
				channel = Ship
				clip = sound_vent_soft
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		engage
		{
			AUDIO
			{
				channel = Ship
				clip = sound_vent_medium
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		flameout
		{
			PREFAB_PARTICLE
			{
				prefabName = fx_exhaustSparks_flameout_2
				transformName = T_T
				oneShot = true
			}
			AUDIO
			{
				channel = Ship
				clip = sound_explosion_low
				volume = 1.0
				pitch = 2.0
				loop = false
			}
		}
		running
		{
			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
			}
			PREFAB_PARTICLE
			{
				name = exhaustFlame
				prefabName = fx_exhaustFlame_blue
				transformName = T_T
				emission = 0.0 0.0
				emission = 0.01 0.1
				emission = 0.075 0.25
				emission = 1.0 1.0
				speed = 0.0 0.35
				speed = 1.0 1.0
				localRotation = 1,0,0,-90  // oddly enough, this seems to equal 0,1,0 in the old system
			}
			PREFAB_PARTICLE
			{
				name = exhaustLight
				prefabName = fx_exhaustLight_blue
				transformName = T_T
				emission = 0.0 1.0
				emission = 0.01 1.0
				emission = 0.075 1.0
				emission = 1.0 1.0
				speed = 0.0 1.0
				speed = 1.0 1.0
				localRotation = 0,0,1,-90   // no clue if this is correct
			}
		}
	}

I then bind the "running" effect in the ModuleEnginesFX declaration like so:


MODULE
	{
		name = ModuleEnginesFX
		engineID = DeuteriumTritium
		thrustVectorTransformName = T_T   // the old, legacy declaration called it this, which I'm guessing connects with the .mu file somehow?
		exhaustDamage = True
		runningEffectName = running   // binding for the EFFECTS{} declaration
		ignitionThreshold = 0.1
		minThrust = 0
		maxThrust = 3500
		heatProduction = 280
		fxOffset = 0, 0, 0
		...

Finally, I have copied over the FXModuleAnimateThrottle declaration as it was in the old file. This module I do not understand at all, why is it required? From my very limited understanding, I think that the model .mu file defines some kind of render object which maps to graphical detail as the throttle moves. This render object has an explicit name, which for this part, according to the old code, is called "e22", and I'm guessing that FXModuleAnimateThrottle needs to somehow bind to this object such that it correctly displays the effects of the throttle going up? Anyway, here is the code I'm using, taken from the old part:


	MODULE
	{
		name = FXModuleAnimateThrottle
		animationName = e22
		dependOnEngineState = True
		responseSpeed = 0.5
		engineName = DeuteriumTritium
	}

 

So that's basically my ported over file in a nutshell. When loaded into a game, the engine works correctly, in that thrust is generated and the vessel moves in space, however, there is no exhaust/plume effect, and no sound at all of the engine running. If anyone could please help me to understand how to port over the original effects of fx_exhaustFlame_blue and fx_exhaustLight_blue such that they work for ModuleEnginesFX exactly like they used to work for ModuleEngines, I would be extremely thankful.

The FXModuleAnimaterThrottle  replaces ModuleAnimateHeat  and on the FX it matters where you place them in the cfg KSP is picky about that on somethings

EDIT- O and T_T as you have posted would be the name of the transformer in unity

Edited by Mecripp2
Link to comment
Share on other sites

9 hours ago, MeCripp said:

The FXModuleAnimaterThrottle  replaces ModuleAnimateHeat  and on the FX it matters where you place them in the cfg KSP is picky about that on somethings

That's good info, thank you. So where in the CFG file should I place the FXModuleAnimateThrottle section? Currently I have it just after the ModuleEnginesFX section.

9 hours ago, MeCripp said:

EDIT- O and T_T as you have posted would be the name of the transformer in unity

Ok, just like I suspected. May I ask what the animationName = e22 is referring to? Is e22 the animation object in Unity/Blender for the .mu of this engine?

Link to comment
Share on other sites

3 hours ago, trias702 said:

That's good info, thank you. So where in the CFG file should I place the FXModuleAnimateThrottle section? Currently I have it just after the ModuleEnginesFX section.

Ok, just like I suspected. May I ask what the animationName = e22 is referring to? Is e22 the animation object in Unity/Blender for the .mu of this engine?

Well just guessing because not sure what mod your using but looks like its the heat FX on the engine some engines glow like there getting hot if you look stock didn't even fix all there stuff 

	MODULE
	{
		name = ModuleAnimateHeat
		ThermalAnim = TF1Heat            <----------------
    }

Would be replaced by 

	
MODULE
	{
		name = FXModuleAnimateThrottle
		animationName = TF1Heat          <---------------
		responseSpeed = 0.001
		dependOnEngineState = True
		dependOnThrottle = True
	}

Haven't seen  these modules be really pick but the effects they can be picky sometime there before ModulEnginesFX and some are placed after if you can PM me with what mod or send a file would help to look at it as it was.

Link to comment
Share on other sites

I think I have figured out the core issue, of the thrust effects not showing up. I was using GTI's multi engine module (which allows 3+ different engine modes), and apparently, if you use that (or the regular MultiModeEngine), you cannot have each ModuleEnginesFX point to the same EFFECTS{} node. You must have a different node for each ModuleEnginesFX, even if both engines use identical effects.

I had this:

running
		{
			AUDIO
			{
				...
			}
			PREFAB_PARTICLE
			{
				...
			}
			PREFAB_PARTICLE
			{
				...
			}
		}

Paired with this:

ModuleEnginesFX
{
	engineName = mode_1
	runningEffectName = running
	...
}

ModuleEnginesFX
{
	engineName = mode_2
	runningEffectName = running
	...
}

ModuleEnginesFX
{
	engineName = mode_3
	runningEffectName = running
	...
}

Which is bad apparently. The way to make this work is to create a separate running_mode_1, running_mode_2, running_mode_3, EFFECTS node and link it that way. If you do this, then it works. It's just a bit wasteful though since running_mode_1, running_mode_2, and running_mode_3 have identical code.

 

However, even getting this working correctly, I still note that using PREFAB_PARTICLE for the thrust effect in ModuleEnginesFX does not make it look that same as the old system for ModuleEngines. The thrust plume is not as a big and thick as having it declared in the old way for ModuleEngines:

fx_exhaustFlame_blue = 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, running
fx_exhaustLight_blue = 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, running

Does anyone know how I can make it look exact? I tried changing the emissive, speed, and energy properties of the PREFAB_PARTICLE, but they don't make the plume thicker/brighter, just longer.

Also, does anyone know the difference between runningEffectName and powerEffectName for ModuleEnginesFX in terms of when they should be used? I understand runningEffectName maps to the old "running" category, which is basically when the engine is running, but what's the difference between that and powerEffectName?

Link to comment
Share on other sites

17 minutes ago, sebi.zzr said:

Maybe this can help a little:

 

That is quite helpful thank you. My take away from that thread was that getting the plume to be the right thickness/intensity is mainly a game of trail and error, which I understand.

One thing I don't understand from your post in that other thread is how you mapped x,y,z,angX,angY,angZ from the old system to the new one:

fx_exhaustFlame_blue = 0.0, -2.2, 0.0, 0.0, 1.0, 0.0, running
fx_exhaustLight_blue = 0.0, -2.2, 0.0, 0.0, 0.0, 1.0, running

=>

PREFAB_PARTICLE
{
	name = flame1
	prefabName = fx_exhaustFlame_blue
	transformName = thrustTransform
	...
	localOffset = 0,0,1  // was 0.0, -2.2, 0.0, 0.0, 1.0, 0.0 under the old system
	localRotation = 1,0,0,-90  // was 0.0, -2.2, 0.0, 0.0, 1.0, 0.0 under the old system

}
PREFAB_PARTICLE
{
	name = flame2
	prefabName = fx_exhaustLight_blue
	transformName = thrustTransform
	...
	localOffset = 0,0,1   // was 0.0, -2.2, 0.0, 0.0, 0.0, 1.0 under the old system
	localRotation = 1,0,0,-90   // was 0.0, -2.2, 0.0, 0.0, 0.0, 1.0 under the old system
}

According to the line you posted (http://wiki.kerbalspaceprogram.com/wiki/CFG_File_Documentation#FX_definitions) the old system numbers were: 

x, y, z, angx, angy, angz, activate, deactivate

That same site states that the new system, localOffset = X, Y, Z and I would assume localRotation is also X, Y, Z

So how come 

0.0, -2.2, 0.0 => localOffset 0,0,1

and

0.0, 1.0, 0.0 => localRotation 1,0,0,-90

This would seem to indicate that localOffset/localRotation is not in fact X, Y, Z since it doesn't map to the old system X, Y, Z (on a 1:1 basis). I understand everything else except this last issue, of how to reconcile localOffset/Rotation with the old values. Did the mappings change or do they mean entirely different things now?

 

Link to comment
Share on other sites

23 hours ago, trias702 said:

One thing I don't understand from your post in that other thread is how you mapped x,y,z,angX,angY,angZ from the old system to the new one:

Like i explained in other post,i didn't map anything.I started with the converted .cfg and inspected it in game and then made the adjustments.There is no formula,if you convert 100 .cfg then maybe some pattern will start to show,but it's mostly trial and error.

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