DanmakuJSON Parameter Types

TypeDescription
ActionSequence A list of actions
AngleRelation A string which specifies in which relation angle-values are calculated
bool A boolean value which can either be true or false
InterpolationType A string which defines how certain values are interpolated
RelationA string which specifies in which relation (absolute or relative) certain actions are executed
SpeedRelation A string which specifies in which relation speed-values are calculated
string Any character-sequence enclosed by quotation marks
StringMapA set of string-key-/string-value-pairs.
TargetTypeA string which specifies how a target will be determined
Term Any numeric value or a string which contains a mathematical expression (e.g.: "(4+5)*10")
VariableMap A set of string-key-/Term-value-pairs - used to pass variables.

Parameter-type ActionSequence

Several DanmakuJSON-elements accept a list of actions (enclosed by square-brackets) which can be executed at some point. Note, that each action inside the square-brackets have to be followed by a comma unless it is not the last item of the sequence.

Example

  • [ {wait: {duration: 1}}, destroy ]

Parameter-type AngleRelation

Some actions (like shoot) which override the initial angle of bullets, can specify in which relation the angle is calculated.
If a parameter of this type is omitted, it usually defaults to "relativeToSource".

Valid angle-relations

NameDescription
absolute The given angle will directly be applied without any modifications
cumulative The given angle-offset will be added for every successively fired bullet (usually used inside a repeat-action)
relativeToClosestTarget The given angle will be added to the angle between the bullet-source and the target which is closest to it
relativeToFarthestTarget The given angle will be added to the angle between the bullet-source and the target which is farthest away from it
relativeToRandomTarget The given angle will be added to the angle between the bullet-source and a randomly selected target
relativeToSource The given angle will be added to the current angle of the bullet-source

Parameter-type bool

A boolean parameter can only be true or false.
Note, that you shouldn't add enclosing quotation marks.

Examples

  • true
  • false


Parameter-type InterpolationType

Several actions which modify values over time (e.g.: changeSpeed, rotate), accept this parameter-type to specify the interpolation-algorithm.
If an InterpolationType-parameter is omitted, it usually defaults to linear.

Valid interpolation-types

NameDescription
linear A simple linear interpolation
easeInQuadratic Quadratic interpolation, accelerating
easeOutQuadratic Quadratic interpolation, decelerating
easeInOutQuadratic Quadratic interpolation, accelerating and decelerating
easeInCubic Cubic interpolation, accelerating
easeOutCubic Cubic interpolation, decelerating
easeInOutCubic Cubic interpolation, accelerating and decelerating
easeInQuartic Quartic interpolation, accelerating
easeOutQuartic Quartic interpolation, decelerating
easeInOutQuartic Quartic interpolation, accelerating and decelerating
easeInQuintic Quintic interpolation, accelerating
easeOutQuintic Quintic interpolation, decelerating
easeInOutQuintic Quintic interpolation, accelerating and decelerating
easeInSine Sine interpolation, accelerating
easeOutSine Sine interpolation, decelerating
easeInOutSine Sine interpolation, accelerating and decelerating
easeInExponential Exponential interpolation, accelerating
easeOutExponential Exponential interpolation, decelerating
easeInOutExponential Exponential interpolation, accelerating and decelerating
easeInCircular Circular interpolation, accelerating
easeOutCircular Circular interpolation, decelerating
easeInOutCircular Circular interpolation, accelerating and decelerating

Parameter-type Relation

Some actions (like rotate) which can handle certain values in different relations (absolute or relative) accept this parameter.

Valid relations

Name
absolute
relative

Parameter-type SpeedRelation

Some actions (like shoot) which override the initial speed of bullets, can specify in which relation the speed is calculated.
If a parameter of this type is omitted, it usually defaults to "absolute".

Valid speed-relations

NameDescription
absolute The given speed will directly be applied without any modifications
cumulative The given speed-offset will be added for every successively fired bullet (usually used inside a repeat-action)
relativeToSource The given speed will be added to the current speed of the bullet-source

Parameter-type string

A string can be any character-sequence which is enclosed by quotation marks

Examples

  • "Hello World"
  • "my_string"
  • "_123xyz"

Parameter-type StringMap

This parameter-type simply consists of string-key/string-value pairs.
Note, that you can omit the quotation marks on the left-hand-side of key/value-definitions.

Example

  • {MyString: "Hello World", "Foo": "Bar"}

Parameter-type TargetType

Some actions (like aim) which require a target, accept this parameter-type.
If a parameter of this type is omitted, it usually defaults to "closest".

Valid target types

NameDescription
closest The target which is closest to the bullet-source
farthest The target which is farthest from the bullet-source
randomA randomly picked target

Parameter-type Term

A term is a special parameter type for numerical values. The value of this parameter can be an integer, a decimal number or a string containing a mathematical expression.

Inside those expressions you can use the most common operators (+, -, *, /, %, ^) as well as local and global variables.

Local variables are referenced by a leading $ and can be defined with the set-action or they are passed as parameters by the call- or shoot-action. If a variable has not been defined before the expression is computed, it will result to 0.0. Note, that variable-names can only consist of the letters A to Z (lower- and uppercase).

Global variables are referenced by a leading #. You can simply define their values in the DanmakuController but you can also define your own functions to determine their values. Note, that there is the built-in global variable #random which returns a new random value between 0.0 and 1.0 every time it is referenced.

Examples

  • 4
  • 9999
  • 0.4
  • 3.14
  • "3+6.8"
  • "((-1234*9.0) / 2)"
  • "(99999 / $localVariable) * #globalVariable + 10.13"

Parameter-type VariableMap

This parameter-type is used to pass a set of variables.
It simply consists of string-key/Term-value pairs.
Note, that you must not add a leading $ to the variable-name on the left-hand-side. Also note, that you can omit the quotation marks on the left-hand-side of key/value-definitions.

Examples

  • {X: 4}
  • {"MyVar": 21.345, Foo: "4 + $SomeVar"}
  • {MyVar: "#random + (4 * -$X + (360.0 / 18))", X: "$Foo"}

Leave a comment