MusicLogic

Overview

This page describes the functionality and use of the Music Logic, which is adaptive to game-specific needs.

Music Logic

Music Logic is a game-dependent module that can have several inputs to change its internal state. Those Music Signals are manually placed within game code with a single line of code.

The signals drive points of input which are processed by the Music Logic code and passed on to the MusicLogicGraph. By traversing along the MusicLogicGraph, the Music System receives commands to change themes or moods.

The Music Logic needs to be activated by one of the triggers described below. When activated, the Music System should not be used by any other code or scripted events.

There are several entities or triggers that are used to control music:

  • Some can be found in the EditorControlledSounds section.
  • Others are located in the Flow Graph.
  • MusicLogicControl is a Flow Graph node that can change input values and activate or deactivate the Music Logic.

The Music Logic can be easily adapted to game specific needs:

  • Add or remove MusicLogicEvents in game code or lua.
SendMusicLogicEvent(eMUSICLOGICEVENT_PLAYER_WOUNDED);
MusicLogic.SetEvent(MUSICLOGICEVENT_ENEMY_HEADSHOT);
  • Add MusicLogicEvents in flowgraph by using the Music:LogicEvents node
  • Change points of an MusicLogicEvent in Game\Libs\MusicLogic\musiclogicinputs.xml (using Text Editor)
  • Music Logic Inputs are the criteria that controls the ML behavior. Following parameters are available:
    • name (Name of the input)
    • decay (Number of points that get deducted per second, for increasing counters, add a negative number. This parameter is optional)
    • maxValue (the max. value of the parameter. Optional.)
  • Music Logic Events define how the values of ML Inputs change. Following parameters can be used:
    • name (name of the event)
    • input (the input that gets affected by this event)
    • operation (mathematical operation to change a value: set, increment, decrement)
    • value (the value that gets set, added or deducted to/from the current value of the input)
  • Change MusicLogicGraph, which is placed in the Data Base View in the MusicLogic Tab.