Jump to content

How does the new particle system work?


CaptRobau

Recommended Posts

Could that be why my game has grindingly slow lag now?

Or it is caused by those evil mods... they trend to slow down quite the game quite a lot^^

Anyway, back to topic. This is some stuff i found out about particles and effects in general, mostly via object browser "research":

- There is an Attribute called "EffectDefinition" that you can find on a bunch of different effect classes. Note that these classes are based on EffectBehaviour. The attribute has a "name" field that will become important

- Part does have an EffectList "Effects", just like it has Lists for Fields, Actions, Events that directly map to ConfigNodes, thus it should be possible to define them for our parts parts however we want

- Oppose to the other Lists mentioned earlier, EffectList does not offer any way to get a reference to a specific effect. But you can at least run an effect via EffectList.Event(string[, float]). Part.Effect(..) is most likely a shortcut for that.

- ModuleEnginesFX has a bunch of ...EffectName fields (KSPFields), that will most likely relate to the attribute's name property already mentioned.

That much about the new effect system ModuleEnginesFX appears to be using. Its a pretty similar concept to a lot of other stuff already available in KSP. Note that there also is an older FX system that is based on FXGroup. See part.findFxGroup(..).

The new system seems pretty straightforward, since it should be easy to create new effects (class based on EffectBehavor with attribute EffectDefinition) and configure them for a specific part via its config. I kind of like it and hope we'll see more modules using it in the future (the only other module that currently has some "...EffectName" fields is ModuleEffectTest...)

Back to particles. Just choose on Effect class that emits particles (or even create your own one) and configure it however you like. By their name, the following FX classes sound promissing: ModelMultiParticleFX, ModelParticleFX, ParticleConfigFX, PrefabParticleFX

The new Rapier engine appears to be the only currently existing stock "example", so check out its config file! It is using both PREFAB_PARTICLE aka PrefabParticleFX and MODEL_MULTI_PARTICLE aka ModelMultiParticleFX.

ps: No idea why they need all-caps effect-names and couldn't just use the class names, like they do for parts & modules.

Link to comment
Share on other sites

ps: No idea why they need all-caps effect-names and couldn't just use the class names, like they do for parts & modules.

My guess is that those are final (or w/e it's called in C#; it's final in Java anyways) integers/doubles/etc. and are therefore all caps with underscore for space.

Link to comment
Share on other sites

  • 1 month later...
OP was never really answered - is there no documentation on this system anywhere?

Really there is no step by step documentation for taking full advantage of it yet, that will come in time. Those who know... are busy doing, no time for teaching yet.

To make full use of this, you really need to write code to control it, using some cfg editing will only get you so far.

An Example:

6fa61k.png

As for performance... I've had about 20 of these fires burning all at once. (and each overall effect contains 3 particle emitters, local and world.) My timer is still in the green, I haven't felt the need to take note of the FPS yet. The only time I get into a yellow timer is when I'm zoomed right into the center of the particle effect, which is rare.

Edited by InfiniteDice
Link to comment
Share on other sites

Well I won't be writing plugins, I'm just an artist. I guess I'll just be sticking with vanilla effects on my engines.

Well not to despair there are people making a few helper mods for making the custom effects a bit easier.

Read this thread: http://forum.kerbalspaceprogram.com/threads/65754-HotRockets!-Particle-FX-Replacement

There are a lot of posts but you'll get some info on what's going on there.

Link to comment
Share on other sites

Well I won't be writing plugins, I'm just an artist. I guess I'll just be sticking with vanilla effects on my engines.

The KSP particle emitter in part tools is pretty straightforward if you have them installed, and implementing a particle effect for an engine just requires using the new 'ModuleEngineFX' as in the Rapier. If you look at the .cfg in that you should see how the effects are set up generally.

If you do make a custom particle emitter, it just needs to be exported as a .mu file and you can call it up for your engine effects using ' MODEL_MULTI_PARTICLE'. I've not checked how many custom particles emitters you can stick on one engine, but I know each .mu will only work with one in it.

Link to comment
Share on other sites

Well, it's not straight forward to me ;p

For instance, what does the emission and speed variables control? Why are there multiple ones and why two sets of numbers after them? For example:

		
emission = 0.0 0.0
emission = 0.66 0.0
emission = 0.69 1.55
emission = 1.0 1.65
speed = 0.0 1.45
speed = 1.0 0.55

I've got no idea what those numbers are doing. Obviously they are controlling particle emission and speed, but in what way? There are a lot of variables to mess with, but nobody is saying squat about what they mean or can do.

Link to comment
Share on other sites

That's wrong. I can have 1000 particle emitters in one mu file. The limitation is with using ModuleEngineFx. As I just stated above, there are 3 in that effect shown.

I was thinking just within the stock implementation.

Well, it's not straight forward to me ;p

		
emission = 0.0 0.0
emission = 0.66 0.0
emission = 0.69 1.55
emission = 1.0 1.65
speed = 0.0 1.45
speed = 1.0 0.55

First number is the engine throttle, second number basically acts like a multiplier on the relevant stats of the particle emitter it's working on:

emission = (throttle)1.0 (stat multiplier thing)2.0

Emission is the number of particles emitted, speed is the velocity. They work to change the particle emission characteristics as defined in the emitter that's chosen (and usually saved in a .mu file).

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