User Tools

Site Tools

Urban Games

modding:playlists

Playlists

Playlists allow to create a list of music tracks that the game can play in the background while playing.
The configuration of playlists are located in the res/config/playlist folder and have to end with a .plist.lua suffix and file extension. The script needs to have a data() function that returns a struct like this:

function data()
return {
  name = _("Train Fever"),
  tracks = {
    {
      name = "Cricket Post - Admiral James T.",
      fileName = "Admiral James T. - 01 - Cricket Post.ogg",
      yearFrom = 1950, -- only play this track beginning from the year 1950
      yearTo = 2000, -- only play this track until the end of year 2000
    },
    {
      fileName = "Admiral James T. - 02 - Lower East.ogg"
    },
    {
      fileName = "Admiral James T. - 03 - Love Train.ogg"
    },
      ...
  },
  order = 1,
}
end

The playlist struct has three properties:

  • name the display name of the playlist used in the games settings menu
  • tracks a list of track structs
    • name the display name of the track used in the music player
    • fileName reference to an audio file relative to res/audio/music/
    • yearFrom starting year when the track should play (inclusive)
    • yearTo last year the track should be played (inclusive)
  • order determines the position in the playlist selection in the games settings

Playlists can be selected in the Audio tab of the settings.

Limit Tracks to Years

The list of the tracks will update everytime the year changes. During this update the game selects all available tracks for the actual game year. A value of 0 (zero) means that there is no limit for either yearFrom or yearTo.

modding/playlists.txt · Last modified: 2024/04/24 14:55 by martin