Particle effects (and its many incarnations)

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

I did some search and collect on the particle-related effects. Let's just say there are a lot of options, most of which could do with a bit of documentation.

I was able to fetch the options below from the code, with the exeption of <ParticleCloud style="ring" />, which I scraped from the wiki's effect page.

Chances are, the a code below does not list all the options available and I'm pretty sure that some options only listed at one type could be used in some other types as well.

Code: Select all

<ItemType UNID="&itFoo;"
        name="a particle weapon"
        (...)
        >
    
    <Image imageID="&rsFoo;" imageX="0" imageY="0" imageWidth="96" imageHeight="96"/>
    
    <Weapon
            type=                   "particles"
            
            (...)
            
            particleCount=          "1d11+44"
            particleEmitTime=       "5-12"
            particleSplashChance=   "50"
            particleSpreadAngle=    "1"
            particleSpreadWidth=    "25" 
            >
        <Effect>
            <Particle
                    style=          "plain"
                    minWidth=       "3" 
                    maxWidth=       "6"
                    primaryColor=   "0xfc, 0xe8, 0x87"
                    secondaryColor= "0x85, 0x0c, 0x0f"
                    />
            <Particle
                    style=      "flame"
                    minWidth=   "3" 
                    maxWidth=   "3-7"
                    />
            <Particle
                    style=      "smoke"
                    maxWidth=   "3-7"
                    />
            
            <Shape
                    color=              "0x00, 0xfc, 0x00"
                    directional=        "true"
                    opacity=            "140"
                    scaleLength=        "16"
                    scaleLengthInc=     "1"
                    scaleWidth=         "2"
                    >
                <Point x="-10"  y="-44"/>
            </Shape>
            
            <ParticleCloud
                    style=              "cloud"
                    emitRate=           "10-15"
                    emitSpeed=          "1-4"
                    particleLifetime=   "10-15"
                    slowMotion=         "25"
                    >
                <ParticleEffect>
                    (...)
                </ParticleEffect>
            </ParticleCloud>
            
            <ParticleCloud
                    style=              "jet"
                    emitRate=           "10"
                    emitSpeed=          "5-10"
                    particleLifetime=   "10-15"
                    >
                <ParticleEffect>
                    (...)
                </ParticleEffect>
            </ParticleCloud>
            
            <ParticleCloud
                    style=              "ring"
                    emitDuration=       "8"
                    emitRate=           "10-12"
                    emitSpeed=          "1-6"
                    lifetime=           "12"
                    particleLifetime=   "10-15"
                    radius=             "60"
                    ringWidth=          "60"
                    cohesion=           "80"
                    viscosity=          "70"
                    wakePotential=      "50"
                    >
                <ParticleEffect>
                    (...)
                </ParticleEffect>
            </ParticleCloud>
                    
            <ParticleCloud
                    style=              "splash"
                    emitDuration=       "8"
                    emitRate=           "10-12"
                    emitSpeed=          "1-6"
                    lifetime=           "12"
                    particleLifetime=   "10-15"
                    >
                <ParticleEffect>
                    (...)
                </ParticleEffect>
            </ParticleCloud>
            
            <ParticleComet
                    length=         "30"
                    particleCount=  "60"
                    primaryColor=   "0x80, 0xf0, 0x40"
                    secondaryColor= "0x80, 0xff, 0xff"
                    width=          "3"
                    >
                <Events>
                    <GetParameters>
                        {
                            particleCount: 60
                            }
                    </GetParameters>
                </Events>
            </ParticleComet>
            
            <ParticleExplosion
                    particleCount=      "2d4"
                    particleLifetime=   "20"
                    particleSpeed=      "25"
                    >
                <Image imageID="&rsDebris1;" imageX="0" imageY="0" imageWidth="4" imageHeight="4" imageFrameCount="8" imageTicksPerFrame="3"/>
            </ParticleExplosion>
            
            <!-- as used in projectiles -->
            <ParticleJet
                    emitRate=               "10"
                    emitSpeed=              "55"
                    particleLifetime=       "10-30"
                    spreadAngle=            "3"
                    particleSplashChance=   "100"
                    >
            
            <!-- as used in explosions -->
            <ParticleJet
                    emitRate=           "15-30"
                    emitSpeed=          "10-16"
                    fixedPos=           "true"
                    particleLifetime=   "10-30"
                    spreadAngle=        "3"
                    tangentSpeed=       "3d2-3"
                    XformTime=          "10"
                    >
                <ParticleEffect>
                    <Particle
                            style=          "plain"
                            minWidth=       "1"
                            maxWidth=       "2"
                            primaryColor=   "#c0c0f0"
                            secondaryColor= "#8080a0"
                            />
                </ParticleEffect>
                
                <Events>
                    <GetParameters>
                        {
                            particleLifetime: 40
                            }
                    </GetParameters>
                </Events>
            </ParticleJet>

            <SmokeTrail
                    spread=             "10"
                    particleLifetime=   "29"
                    emitDuration=       "100"
                    emitRate=           "50"
                    emitSpeed=          "65"
                    >
                <ParticleEffect>
                    <Particle
                            style=          "plain"
                            minWidth=       "1"
                            maxWidth=       "1"
                            primaryColor=   "0xff, 0xed, 0xcd"
                            secondaryColor= "0xff, 0xed, 0xcd"
                            />
                </ParticleEffect>
            </SmokeTrail>
        </Effect>
        
        <Fragment
                count=              "1d4+4"
                type=               "particles"
                
                (...)
                
                particleCount=      "5d6"
                particleEmitTime=   "5-12"
                particleSpreadAngle="0"
                particleSpreadWidth="25"
                >
            <Effect>
                (... see above effect element ...)
            </Effect>
        </Fragment>
    </Weapon>
</ItemType>

There seems to be some overlap between the individual effects such as <ParticleComet />, <ParticleJet /> and the particle cloud styles such as <ParticleCloud style="jet" /> and <ParticleCloud style="splash" /> etc.
Anyone know if these are from different versions? Is one type deprecated? or preferred over the other?


Does anyone have any additional information to add?

Regards,
Pixelfck
Last edited by pixelfck on Wed Apr 22, 2015 4:56 pm, edited 2 times in total.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

by the way, firing the above code* (excluding the fragment) as a weapon give the following effect:

Image

(and severely slows down the game)

~Pixelfck

*) this code was never intended as anything other than an example.
Last edited by pixelfck on Tue Apr 21, 2015 10:33 am, edited 1 time in total.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
bzm3r
Militia Lieutenant
Militia Lieutenant
Posts: 100
Joined: Tue Oct 23, 2012 2:38 pm

(Shrike...where arrree youuuu?)

Thanks for making an effort in documenting this, Pixelfck.
User avatar
Song
Fleet Admiral
Fleet Admiral
Posts: 2830
Joined: Mon Aug 17, 2009 4:27 am

There is one other, possibly/probably deprecated setup that I can add to that: <Smoketrail>. Look at 0.99c and earlier XML code and you'll see it on station explosion fragments.When scaled up it produces a regular set of circles with its particle effects, as opposed to the randomness of ParticleJet (its replacement). Apart from that...that mostly seems alright. In SM&M++ it's used in the revised APA, and in TSB wolfy's used it on some railguns. Here's what it looks like (from an original prototype weapon ultimately dropped from Sm&M++ for not being fun enough):

Image

Note the slight "blurring" of the rings. This is because of a glitch/feature of the original smoketrail effect. Every so often (linked to lifetime) the effect pauses and doesn't emit any particles. This breaks up the effect. To get around this and get a contiguous effect, you use 3 or more of them, and slightly vary their lifetimes so they break at different points. This causes at least one smoketrail element to function at any given time and smoothens out the effect, at the cost of a bit of blurring. It also adds to potential lag.

Particles can also accept different types of graphical effects: the PK25 uses an image, and my remake of the QAC uses starbursts to make up a particlejet behind the main projectile:
QACFinal.png
QACFinal.png (7.94 KiB) Viewed 5171 times
This is handled through the effect tag just like you would for a weapon.

In addition, a more complex particle effect can be gained by combining multiple engine effects and/or graphical elements together. The SM&M++ Ion9 uses the stock effect, plus a small version of the effect used for stars:
Ion9.png
Ion9.png (52.91 KiB) Viewed 5171 times
In theory, I think particles can accept most of the engines effects, so bolts, moltenbolts, balllightnings, etc. For complex work, using a shape is best...but I've never been able to code them, so I haven't.


In addition, as you've shown with the demonstration weapon, you can improve the look of particle effects by combining multiple particle effects together (as opposed to using a single one made of multiple elements, as in the Ion9). My version of the APA does this, using dense "core" of a particlejet (probably several actually, I need to optimise this gun still), then multiple smoketrails (to get around the aforementioned glitch) for the main "trail", surrounded by a light spray from particle jets:
APATweaked.png
APATweaked.png (60.89 KiB) Viewed 5171 times
'

These particles are emitted at the same speed that the projectile travels, so they look like the projectile is leaving them behind as it travels. This is also true for the picture I put for smoketrails up at the top.

To demonstrate the method of using Smoketrail, here's a code snippet. The actual gun currently uses this set of code, repeated three times. The final gun will optimise this a bit to speed things up:

Code: Select all

<SmokeTrail
									spread=			"10"
									particleLifetime="29"
									emitDuration=	"100"
									emitRate=		"50"
									emitSpeed=		"65"
									>
								<ParticleEffect>
									<Particle
								style=			"plain"
								minWidth=		"1"
								maxWidth=		"1"
								primaryColor=		"0xff, 0xed, 0xcd"
								secondaryColor=		"0xff, 0xed, 0xcd"
								/>
								</ParticleEffect>
							</SmokeTrail>
							<SmokeTrail
									spread=			"5"
									particleLifetime="31"
									emitDuration=	"100"
									emitRate=		"50"
									emitSpeed=		"65"
									>
								<ParticleEffect>
									<Particle
								style=			"plain"
								minWidth=		"1"
								maxWidth=		"1"
								primaryColor=		"0xff, 0xed, 0xcd"
								secondaryColor=		"0xff, 0xed, 0xcd"
								/>
								</ParticleEffect>
							</SmokeTrail>
						
						<SmokeTrail
									spread=			"4"
									particleLifetime="30"
									emitDuration=	"100"
									emitRate=		"50"
									emitSpeed=		"65"
									>
								<ParticleEffect>
									<Particle
								style=			"plain"
								minWidth=		"1"
								maxWidth=		"1"
								primaryColor=		"0xff, 0xed, 0xcd"
								secondaryColor=		"0xff, 0xed, 0xcd"
								/>
								</ParticleEffect>
							</SmokeTrail>
Note that the particle lifetime has a range of 3 between the three smoketrails, with the desired lifetime as the mean. This is usually enough to handle things. If using this sort of effect, playing around with differential lifetimes will probably be required to get what you want. However, as an old, old, OLD way of doing things this may not continue to work in the future.


Keep in mind always that the more complicated a particle effect is, and the more of them you throw around, the more the game has to render and the more likely it is that you will lag the game (especially on higher graphics settings). Use complex effects only on low ROF weapons that are unlikely to crowd the screen with shots, and try to do the job as simply as possible. In addition, particles have quite unusual hit detection and damage properties that are hard to work with at times. Weapons that fire particles (as opposed to weapons with particle effects) also tend to cause problems with the sound mixer and hit-detection system that can cause extreme lag if the weapon is excessive. Application of common sense usually deals with this.

....Also, only the really powerful guns (or exotics) should get over-the-top effects. That's one way to show that something is powerful *before* it OHKs the player.


Finally, making explosions out of particle effects is very, very difficult. It will usually severely lag the game if you're making something look good. I've managed it, once, but it wasn't very optimised and I dropped it eventually. I'm thinking about trying again with a different set of effects though.
Mischievous local moderator. She/Her pronouns.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

ohh, nice thread !
I want to join too:
I was playing around with smoketrails and remade the Kytryn Launcher for WE6:
Image

also, I tried to fiddle with random weapons, weapons that have size and colour changes at every shot:
Image
bzm3r
Militia Lieutenant
Militia Lieutenant
Posts: 100
Joined: Tue Oct 23, 2012 2:38 pm

digdug wrote:ohh, nice thread !
I want to join too:
I was playing around with smoketrails and remade the Kytryn Launcher for WE6:

also, I tried to fiddle with random weapons, weapons that have size and colour changes at every shot:
Wow, that random shot weapon effect has real potential!

digdug, can you post the code snippets too?
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

You can change any parameter by script, so with:

Code: Select all

<Events>
    <GetParameters>
        (block nil
            ; your code here
            {
                primaryColor:   "#c0c0f0"
                }
            )
    </GetParameters>
</Events>
You can change colours.

~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

not sure if I still have it, but eventually I can write another one.
Basically, I'm using a variable in each parameter of GetParameters that I randomize at each shot. The trick is to use style= "creator" so that the dynamic shots of <Ray> are recalculated every time the weapon is fired.
Post Reply