Ambience Component

From wiki
Jump to: navigation, search

Category:Component Modding are all optional properties that can be added to any file. Components are useful in extending the original files with even more information, such as the cost of the item or whether the block can be broken by a weapon.

On this page, we go over the Ambience component, signified by the following;

"ambience": {
  =Content=
}

Ambience components are used to add additional information to Sounds. In particular, they specify that the sound should have the following properties.

  • The ability to be played as an ambient sound for the current Weather.
  • The additional properties to go along with the ability to be player.


When and How to use

Ambience components are used whenever you want to make a sound as part of the ambience. In a number of cases, this component is not needed though it can be useful for adding more life to the current Weather.

To start off with first, you should head through Sound#Adding New Sounds To Staxel in order to set up a file with sounds in it already. Once that is done, you can add the following below the last property of the file;

  "ambience" : {
    "frequency" : 800,
    "freqVariance" : 400,
    "volume" : 1.0,
    "volumeVariance" : 0.0,
    "pitchVariance" : 0.5,
    "distance" : 10.0,
    "distanceVariance" : 20.0
  }

These all look like a bunch of numbers, but they all play a different role. This file can take a bit of mucking around to get the "right" values. A small tip is to make this file, then come back and edit it after a day has passed.

"frequency" is the time in milliseconds that it will play a new sound. Be careful with making this too frequent, especially if there are not many sounds. "freqVariance" is the additional random time that gets added or subtracted from frequency. Be careful about making this larger than frequency. "volume" is how loud the sound will be played. "volumeVariance" is the amount of volume which is randomly added or subtracted from "volume". "pitchVariance" is the amount of variance in the pitch of sounds. This will require a bit of fooling around to get right. "distance" is how far away the sound should be played. (A value of 10 is 10 tiles away). "distanceVariance" is how much random extra distance is added or subtracted from "distance".


Config Options

All config options must be inside the body of;

"ambience": {
  =Config Here=
}


"distance"

Valid options (Float): A positive decimal number.

Default Value: If not specified, will play the sound as if it was at the player's location.


The amount of space between the player and the sound. This will end up changing volume and other things.


"distanceVariance"

Valid options (Float): A positive decimal number.

Default Value: If not specified, will have no variance.


The range of distance, -"distanceVariance" to "distanceVariance", around the distance that the sound is emitted


"frequency"

Valid options (Integer): A positive integer number.

Default Value: No default value is specified. Always need to provide your own.


This is the amount of time, in millisenconds, between two plays of the sounds in the group.


"freqVariance"

Valid options (Integer): A positive integer number.

Default Value: If not specified, will have no variance.


This is the range, -"freqVariance" to "freqVariance", around the base frequency that the sound will be played at.


"pitchVariance"

Valid options (Float): A positive decimal number.

Default Value: If not specified, will have no variance. (The default value is 0.5)


The amount that the played sounds pitch will change between plays of the sound.


"volume"

Valid options (Float): A positive decimal number.

Default Value: If not specified, will play at full volume. (Full volume being 1.0)


This option tells the game exactly how loud to play the sound. Applied on top of the original sound volume in the sound group.


"volumeVariance"

Valid options (Float): A positive decimal number.

Default Value: If not specified, the volume will not vary.

This is the range, -"volumeVariance" to "volumeVariance", around the base volume's value. Only affects the "volume" value in ambience.