While background events can improve the emphasis and fullness of a chart, track and note mods are how XDRV charts truly get their visual identity. Unlike background events, which can be added to either the .xdrv file or the .lua modfile, mods can only be done in the modfile via Lua programming.
In XDRV, mods can manipulate a variety of different fields in your chart. The most common values for charts to manipulate are camera motion, track speed, and track motion / scale. Many more unique fields can also be modded, including the scale and position of certain note types, the opacity and color of certain track elements, the field of the view of the camera, and more.
The first of these two modding functions, xdrv.Set, sets the value of a moddable field at a specified time. Set mods have no easing or duration, meaning that a field’s value will change within a single frame. The set function can also be used to set values before the scene is visible.
xdrv.Set
xdrv.Set(modName, value, beatOrTime, time)
Sets the value of a moddable field at a given time.
Parameters:
modName: string
The name of the moddable field to set.
value: number
The value to set that field to.
beatOrTime: string
Whether to measure timeValue as "beat"s or "time" in seconds.
timeValue: number
The beat or time in seconds to apply the mod at, depending on what beatOrTime is.
In application, set mods in a .lua modfile look like this:
xdrv.Set("camera_move_y",1,"beat",12)
-- At beat 12, set the y position of the camera to 1
xdrv.Set("speed",0.5,"beat",-12)
-- At time -12, set the speed of the track to 0.5
-- Time -12 is reliably before the game scene is visible, so
The second of the two modding functions. xdrv.Ease, changes a moddable field over some duration of time. Since ease mods require a start value and end value be input, seamless mods must use the same starting value as the last value the field was set to.
The rate at which this value changes is determined by the ease function applied to it. A variety of eases of In, Out, and InOut varieties are supported by XDRV. A list of the supported eases can be found on the XDRV chart documentation.
Mod Name
(Typical) Effect
Linear
Rate of change is constant throughout.
InEASE
Rate of change starts at zero and increases throughout the motion.
OutEASE
Rate of change starts higher and decreases to zero throughout the motion.
InOutEASE
Rate of change starts at zero, increases until halfway through the motion, and decreases back to zero by the end.
Alternatively, a graphical representation of most eases supported by XDRV can be seen on this easing function resource.
-- For our purposes, this is where the modfile ends :]
xdrv.Set("camera_fov",100,"beat",13)
As with background events, being able to write mods is a necessary skill for charters interested in making high-quality and game-ready XDRV charts. Making good mods is not just dependent on your programming skills, however; knowing how to leverage mods in a way that is visually appealing and/or challenging is a skill in of itself. Using mods optimally is the focus of the next section.