[WIP][REFERENCE] Effects specifications

Discussion in 'Mod Discussions' started by SXX, September 23, 2013.

  1. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    Effects specifications
    This thread is work in progress and it's won't include too detailed explanation of every parameter present in game, but only something I'm test myself, but I'm think somebody from Uber can fill the blanks spaces easily.

    All effects used in PA defined in .json files located in /PA/media/pa/effects/specs directory. Unlike units blueprints they don't need to be listed anywhere to be used.

    Important notices:
    • First time effects are loaded by the game not on base "menu" loading (like most of game content like shaders, textures), but on start of game. So for example you'll only get JSON parsing errors right before planet loading.
    • Some of modders who change other part of game know that it's usually working well with missing shaders for example. Missing/broken effect will crash PA.

    Currently effect specs usually looks like that:
    Code:
    {
      "emitters":[
          {
            "spec":{
                "shader":"particle_transparent",
                "baseTexture":"/pa/effects/textures/particles/something.png",
                "rampTexture":"/pa/effects/textures/particles/uncompressed/no_ramp.png"
            },
            "emissionRate":500,
            "lifetime":0.0,
            "maxParticles":1
          },
          {
            "spec":{
                "shader":"particle_transparent",
                "baseTexture":"/pa/effects/textures/particles/something.png",
                "rampTexture":"/pa/effects/textures/particles/uncompressed/no_ramp.png"
            },
            "emissionRate":500,
            "lifetime":0.0,
            "maxParticles":1
          }
      ]
    }
    All files except mouse click effects only have "emitters" array which may have any number of emitters in it.

    Mouse click effects ("default_click.json" and "default_launch_target.json") also use "color" array so they looks like that:
    Code:
    {
      "emitters":[
          {
            "spec":{
                "shader":"particle_transparent",
                "baseTexture":"/pa/effects/textures/particles/ring.png",
                "rampTexture":"/pa/effects/textures/particles/uncompressed/no_ramp.png"
            },
            "emissionRate":500,
            "maxParticles":1,
            "lifetime":0.5,
          },
          {
            "spec":{
                "shader":"particle_transparent",
                "baseTexture":"/pa/effects/textures/particles/softdot.png",
                "rampTexture":"/pa/effects/textures/particles/uncompressed/no_ramp.png"
            },
            "emissionRate":500,
            "maxParticles":1,
            "lifetime":1.0
          }
      ],
      "color":[
          1.0,
          0.67,
          0.15
      ]
    }
    I cut both examples, so it's should be a bit more easy to understand them.

    Attributes
    General
    "spec": Check spec section bellow.

    "emissionRate": Integer. Rate of particle emission for all active emitters of this type. For example: if you set this attribute to 1 in "default_click.json" file and then make multiple clicks ring effect for each click will appear with with some delay after each other. I'm still unsure what period of time it's use, but it's less than a second.
    "maxParticles": Integer. Maximum particles for each active emitter. Example: If you have 10 fabbers and you set this option to 100 in "fab_spray.json" each of those builders will able to emit 100 particles, so you'll have 1000 particles in total.
    "endDistance": Integer. Maximum distance from camera whereby effect still visible. Supposedly in meters.

    Section "spec"
    I have few ideas why uber split those settings into one section, but I'm not fully understand it yet.
    "shader": String. Possible values:
    • particle_transparent
    • particle_transparent_ramp
    • particle_add
    • particle_add_ramp
    "facing": String. Possible values:
    • axialY
    • EmitterZ
    • velocity
    "red", "green", "blue": Integer. Those set color of particle.
    "alpha": ...
    "size": ...
    "baseTexture": String. Path to PNG file used as texture for each particle.
    "rampTexture": String. Path to PNG file.


    ... More will be added soon ...
    Last edited: September 23, 2013
  2. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
  3. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    Necroing this thread :)

    When using an effect in a unit json file, you have to specify a "type", example :
    Code:
    "fx_offsets" : [{
                "type" : "enabled",
                "filename" : "/pa/units/land/teleporter/teleporter_event_horizon.pfx",
                "bone" : "bone_innerRingMaster",
                "offset" : [0, 0, 0],
                "orientation" : [0, 0, 0]
            }
    ]
    The different types I know are :
    • idle = always displayed
    • enabled = only displayed when enabled, which is specific to some units like Teleporters / Halleys / ...
    • build = only displayed when unit is building (factory / launcher)
    • moving = only displayed when unit is on the move
    Are there any other which may not be used yet ?
    I'm particularly looking for one, "poweredOn", which displays only when unit is powered. "poweredOff" could be useful too.

    Tagging the effect master @bgolus
  4. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    There's "moving_forward" is when the unit is moving forward, not up or down or getting pushed to the side / back, etc. It's used on fighter jets and bombers so they don't play the jet effect while bobbing in place.

    The "fx_offsets" list are on/off states that don't handle the event of those states changing, this is specifically for use with looping effects. However there's also the "events" list that has both audio and particle effects that can be spawned on events including on the moment some of those states toggle.

    The "enabled" type should also cover when a unit is powered on or off, and under "events" there are matching "enabled" and "disabled" keys to handle this. See the teleporter.json for example usage.

    And yes it's terrible that these are split up the way they are with completely different ways to define them.
  5. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    Unfortunately, it doesn't seem to be the case by default, according to my limited testing (and someone else's), unless we're doing something wrong.

    Our use case is quite simple, have a blinking light displayed on powered on radar, like :
    [​IMG]
    This is already possible using :
    Code:
    "fx_offsets" : [{
                "type" : "idle",
                ...
            }
        ]
    but obviously, it also displays when radar is powered off, which is not ideal.

    So I took example of the teleporter as you suggested and added :
    Code:
    "events" : {
            ...
            "enabled" : {
                "audio_cue" : "/SE/Buildings/teleporter_enabled",
                "effect_spec" : "/pa/units/land/teleporter/teleporter_power_on.pfx bone_root"
            },
            "disabled" : {
                "audio_cue" : "/SE/Buildings/teleporter_disabled",
                "effect_spec" : "/pa/units/land/teleporter/teleporter_power_down.pfx bone_root"
            },
            ...
        }
    to the radar.json events (replacing the teleporter original bone by bone_root for the radar)
    Unfortunately, nothing happens upon disabling / enabling the power of the radar. Not even the sound.

    I didn't test all units / buildings, but the only one I know which work with "enabled" fx_offsets / events are the Halley and the teleporter (thought the catalyst too, but I just checked and it's not).

    Anyway, for our radar use case, since it's looping, it would require to be set at "fx_offsets" and not "events"
  6. Planktum

    Planktum Post Master General

    Messages:
    1,060
    Likes Received:
    510
    PA needs more effects!
  7. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Try setting the fx offset type to "endable", not "idle". Idle is always on when not dead or being built.

    I can see the enabled / disabled events not working though.
    Quitch likes this.
  8. Killerkiwijuice

    Killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    enable*

    ༼⌐■ل͜■༽
    Remy561 likes this.
  9. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Curse you iPhone! (and I think it's "enabled")
  10. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    That's one of the first thing we tried (before even you told us about the events), and it works only for some buildings like Halley / Teleporter :(
    I also tried a few random words like "powered" and such, but yeah :p
  11. Alpha2546

    Alpha2546 Post Master General

    Messages:
    977
    Likes Received:
    1,561
    First of all @bgolus I'd like to thank you for the time you take to respond to these questions :) .

    I got another question. So we added some particle effects to orbital units. Now the problem is that as soon as they'll leave the planet to travel to another planet the particle effects stays on the planets where they we're build.

    Now I'm almost sure I can fix this by using the move type instead of the idle type however I prefer that the effect stays on all the time ( so also when they don't move). Is it possible to use something like the idle effect and that the particle effects will be removed as soon as they go into orbit and be added back on when they reach a different planet?
    Fr33Lancer likes this.
  12. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Those both sound like bugs, I can look into fixing those at some point.
    Quitch, mjshorty, squishypon3 and 3 others like this.
  13. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    In the latest release (76456) effects getting stuck on units that go to other planets is fixed. I also added the new fx offset type "energy" which is enabled and disabled based on if the unit has enough energy to run.
    Quitch, Remy561, Fr33Lancer and 4 others like this.
  14. Alpha2546

    Alpha2546 Post Master General

    Messages:
    977
    Likes Received:
    1,561
    Have a hug:oops:. I just checked out the ubercannon effect and it looks really good @bgolus . Thanks for fixing that bug and for the extra offset type :) . @Fr33Lancer are definately going to check it out!

    Thanks again!
    Remy561 and Fr33Lancer like this.

Share This Page