DRL > Requests For Features

More music?

<< < (3/6) > >>

Brewtal Legend:
What if I want more than one list? For instance, I want to play 1 of three different songs for the title screen, random songs from one list for each of the regular levels, random songs from a different list for special levels, and a smaller list for boss levels?

Would I have to create several different rand_music functions?

Game Hunter:

--- Quote from: Brewtal Legend on March 31, 2012, 17:50 ---What if I want more than one list? For instance, I want to play 1 of three different songs for the title screen, random songs from one list for each of the regular levels, random songs from a different list for special levels, and a smaller list for boss levels?

--- End quote ---

If you want multiple playlists, just create multiple input playlists and output them as multiple randomized playlists. For example:


--- Code: ---local title_playlist = { song1_path, song2_path, song3_path }
local reg_playlist = { a bunch of songs }
local spec_playlist = { a bunch of other songs }
local boss_playlist = { even more songs }

local titlemus = rand_music(title_playlist, 1)
local regmus = rand_music(reg_playlist, 20)
local specmus = rand_music(spec_playlist, 12)
local bossmus = rand_music(boss_playlist, 4)

--- End code ---

The number for specmus includes Phobos Base Entry and all 11 other special levels. Other than that, there are 20 "regular" levels (six in E1, seven each in E2 and E3), four boss levels (including HF), and the title. I think that covers everything! (Note that the "level8", "level16", and "level24" are probably never used in a normal game due to being replaced by boss levels, but you may want to include them anyway since they might be part of the music in A100 games. In this case, you'll want regmus to be 23 songs instead of 20.)

Brewtal Legend:
Finally got around to trying this out.

Are interlude and  hellgate still used? Intro is the phobos base entry level right?

This is what I have right now. About to try it in a minute:


--- Code: ----- You can get much higher quality Doom MP3 tracks from
-- http://www.sirgalahad.org/paul/doom/
-- To use them, edit config.lua, and change music.lua to musicmp3.lua
-- MP3's need to be put in a directory named mp3.

--music_array is a table of pathnames to songs (like what you'd put in

Music{})
--song_num is the total number of songs you want to output (size of

playlist)
local function rand_music(music_array,song_num)
local song_tot = table.maxn(music_array)
local song_count = 0
local music_list = {}
--if song_num > music_array, we want to loop through
--randomization of the array more than once
for i=1,math.ceil(song_num/song_tot) do
--if song_num < music_array, we want to loop less than

the full playlist
local loop_itr = math.min(song_tot,song_num)
song_num = song_num - song_tot
--make a temporary array of music
local song_list = music_array
for j=1,loop_itr do
--pick a random song from the temporary array...
idx = math.random(song_tot-j+1)
song = song_list[idx]
--...add it to the playlist...
music_list[song_count] = song
--...and remove it from the temporary array
table.remove(song_list,j)
song_count = song_count + 1
end
end
return(music_list)
end

local title_playlist = {
"mp3/PSX_Doom_Music/doom_titlescreen.mp3",
"mp3/cdoom.mp3",
"mp3/doom3.mp3",
"DSoP_00_WelcomeToHell(Intro).mp3",
}

local reg_playlist = {
"mp3/PSX_Doom_Music/doom_01hangar.mp3",
"mp3/PSX_Doom_Music/doom_02plant.mp3",
"mp3/PSX_Doom_Music/doom_03toxinrefinery.mp3",
"mp3/PSX_Doom_Music/doom_04commandcontrol.mp3",
"mp3/PSX_Doom_Music/doom_05phoboslab.mp3",
"mp3/PSX_Doom_Music/doom_06centralprocessing.mp3",
"mp3/PSX_Doom_Music/doom_07computerstation.mp3",
"mp3/PSX_Doom_Music/doom_08phobosanomaly.mp3",
"mp3/PSX_Doom_Music/doom_09deimosanomaly.mp3",
"mp3/PSX_Doom_Music/doom_10containmentarea.mp3",
"mp3/PSX_Doom_Music/doom_11refinery.mp3",
"mp3/PSX_Doom_Music/doom_12deimoslab.mp3",
"mp3/PSX_Doom_Music/doom_13commandcenter.mp3",
"mp3/PSX_Doom_Music/doom_16hellgate.mp3",
"mp3/PSX_Doom_Music/doom_17hellkeep.mp3",
"mp3/PSX_Doom_Music/doom_18pandemonium.mp3",
"mp3/PSX_Doom_Music/doom_22limbo.mp3",
"mp3/PSX_Doom_Music/doom_20unholycathedral.mp3",
"mp3/PSX_Doom_Music/doom_21mterebus.mp3",
"mp3/PSX_Doom_Music/doom_24hellbeneath.mp3",
"mp3/PSX_Doom_Music/fdoom_01attack.mp3",
"mp3/PSX_Doom_Music/fdoom_02virgil.mp3",
"mp3/PSX_Doom_Music/fdoom_03canyon.mp3",
"mp3/PSX_Doom_Music/fdoom_04combine.mp3",
"mp3/PSX_Doom_Music/fdoom_05catwalk.mp3",
"mp3/PSX_Doom_Music/fdoom_06fistula.mp3",
"mp3/PSX_Doom_Music/fdoom_07geryon.mp3",
"mp3/PSX_Doom_Music/fdoom_08minos.mp3",
"mp3/PSX_Doom_Music/fdoom_09nessus.mp3",
"mp3/PSX_Doom_Music/fdoom_10paradox.mp3",
}

local spec_playlist = {
"mp3/e1m1.mp3",
"mp3/e1m2.mp3",
"mp3/e1m3.mp3",
"mp3/e1m4.mp3",
"mp3/e1m5.mp3",
"mp3/e1m6.mp3",
"mp3/e1m7.mp3",
"mp3/e1m8.mp3",
"mp3/e1m9.mp3",
"mp3/Hangarmageddon.mp3",
"mp3/PA01Quake_Theme.mp3",
"mp3/Animal_Acoustic.mp3",
}

local boss_playlist = {
"mp3/PSX_Doom_Music/doom_credits.mp3",
"mp3/PSX_Doom_Music/final_doom_end.mp3",
"mp3/PSX_Doom_Music/psx_main_menu.mp3",
"mp3/PSX_Doom_Music/PSX_stats_screen.mp3",
}


Music = {
start     = rand_music(title_playlist, 1),
interlude = "mp3/PSX_Doom_Music/fdoom_04combine.mp3",
bunny     = "mp3/d2end.mp3",
intro     = "mp3/DSoP_00_WelcomeToHell(Intro).mp3",
hellgate  = "mp3/PSX_Doom_Music/doom_credits.mp3",

level2    = rand_music(reg_playlist, 20),
level3    = rand_music(reg_playlist, 20),
level4    = rand_music(reg_playlist, 20),
level5    = rand_music(reg_playlist, 20),
level6    = rand_music(reg_playlist, 20),
level7    = rand_music(reg_playlist, 20),
level8    = rand_music(reg_playlist, 20),
level9    = rand_music(reg_playlist, 20),
level10   = rand_music(reg_playlist, 20),
level11   = rand_music(reg_playlist, 20),
level12   = rand_music(reg_playlist, 20),
level13   = rand_music(reg_playlist, 20),
level14   = rand_music(reg_playlist, 20),
level15   = rand_music(reg_playlist, 20),
level16   = rand_music(reg_playlist, 20),
level17   = rand_music(reg_playlist, 20),
level18   = rand_music(reg_playlist, 20),
level19   = rand_music(reg_playlist, 20),
level20   = rand_music(reg_playlist, 20),
level21   = rand_music(reg_playlist, 20),
level22   = rand_music(reg_playlist, 20),
level23   = rand_music(reg_playlist, 20),
level24   = rand_music(reg_playlist, 20),

the_chained_court = rand_music(spec_playlist, 12),
halls_of_carnage  = rand_music(spec_playlist, 12),
hells_armory      = rand_music(spec_playlist, 12),
hells_arena       = rand_music(spec_playlist, 12),
spiders_lair      = rand_music(spec_playlist, 12),
city_of_skulls    = rand_music(spec_playlist, 12),
the_wall          = rand_music(spec_playlist, 12),
unholy_cathedral  = rand_music(spec_playlist, 12),
the_mortuary      = rand_music(spec_playlist, 12),
the_vaults        = rand_music(spec_playlist, 12),
the_lava_pits     = rand_music(spec_playlist, 12),

tower_of_babel    = rand_music(boss_playlist, 4),
hell_fortress     = rand_music(boss_playlist, 4),
dis               = rand_music(boss_playlist, 4),
victory   = "mp3/Motorhead - Hellraiser.mp3",
}



--- End code ---

Does it look right?

***Edit**
Just tried and the game crashed on start up. :(  Which part did I do wrong?

Game Hunter:
You're close: recall that the rand_music function returns an entire array of songs. If you don't mind having random repeats, you're free to simply use the following for each line, replacing the playlist variable as necessary:


--- Code: ---level2 = reg_playlist[ math.random(#reg_playlist) ]

--- End code ---

The purpose of rand_music is to ensure that there are no repeats until the playlist runs out of possible songs. This is the way I'd prefer to have songs randomized, which is why I made it as such. Instead of calling rand_music for each and every song, you'll want to do this instead:


--- Code: ---local title_mus = rand_music(title_playlist,1)
local reg_mus = rand_music(reg_playlist,23)
local boss_mus = rand_music(boss_playlist,4)
local spec_mus = rand_music(spec_playlist,11)

Music = {
    start = title_mus,
    ....
    level2 = reg_mus[1],
    level3 = reg_mus[2],
    ....
    level24 = reg_mus[23],
   
    the_chained_court = spec_mus[1],
    ....
}

--- End code ---

Hopefully that gives you enough of an idea.


--- Quote from: Brewtal Legend on April 17, 2012, 13:41 ---Are interlude and  hellgate still used? Intro is the phobos base entry level right?

--- End quote ---
"interlude" is, if I'm not mistaken, never used, so nothing to worry about there. "hellgate" is used for Phobos Anomaly (floor 8), so it should be part of the boss playlist. "intro" is, indeed, Phobos Base Entry.

Also note that "level8", "level16", and "level24" aren't used except for A100, but there's little reason not to put them in anyway.

EDIT: whoops typos

Brewtal Legend:
Ok. Thanks.
It still crashes. It makes it to the fullscreen query, but then crashes out. "Reason: invalid variant type cast"

Here is What I have now:


--- Code: ----- You can get much higher quality Doom MP3 tracks from
-- http://www.sirgalahad.org/paul/doom/
-- To use them, edit config.lua, and change music.lua to musicmp3.lua
-- MP3's need to be put in a directory named mp3.

--music_array is a table of pathnames to songs (like what you'd put in Music{})
--song_num is the total number of songs you want to output (size of playlist)
local function rand_music(music_array,song_num)
local song_tot = table.maxn(music_array)
local song_count = 0
local music_list = {}
--if song_num > music_array, we want to loop through
--randomization of the array more than once
for i=1,math.ceil(song_num/song_tot) do
--if song_num < music_array, we want to loop less than the full playlist
local loop_itr = math.min(song_tot,song_num)
song_num = song_num - song_tot
--make a temporary array of music
local song_list = music_array
for j=1,loop_itr do
--pick a random song from the temporary array...
idx = math.random(song_tot-j+1)
song = song_list[idx]
--...add it to the playlist...
music_list[song_count] = song
--...and remove it from the temporary array
table.remove(song_list,j)
song_count = song_count + 1
end
end
return(music_list)
end

local title_playlist = {
"mp3/PSX_Doom_Music/doom_titlescreen.mp3",
"mp3/cdoom.mp3",
"mp3/doom3.mp3",
"DSoP_00_WelcomeToHell(Intro).mp3",
}

local reg_playlist = {
"mp3/PSX_Doom_Music/doom_01hangar.mp3",
"mp3/PSX_Doom_Music/doom_02plant.mp3",
"mp3/PSX_Doom_Music/doom_03toxinrefinery.mp3",
"mp3/PSX_Doom_Music/doom_04commandcontrol.mp3",
"mp3/PSX_Doom_Music/doom_05phoboslab.mp3",
"mp3/PSX_Doom_Music/doom_06centralprocessing.mp3",
"mp3/PSX_Doom_Music/doom_07computerstation.mp3",
"mp3/PSX_Doom_Music/doom_08phobosanomaly.mp3",
"mp3/PSX_Doom_Music/doom_09deimosanomaly.mp3",
"mp3/PSX_Doom_Music/doom_10containmentarea.mp3",
"mp3/PSX_Doom_Music/doom_11refinery.mp3",
"mp3/PSX_Doom_Music/doom_12deimoslab.mp3",
"mp3/PSX_Doom_Music/doom_13commandcenter.mp3",
"mp3/PSX_Doom_Music/doom_16hellgate.mp3",
"mp3/PSX_Doom_Music/doom_17hellkeep.mp3",
"mp3/PSX_Doom_Music/doom_18pandemonium.mp3",
"mp3/PSX_Doom_Music/doom_22limbo.mp3",
"mp3/PSX_Doom_Music/doom_20unholycathedral.mp3",
"mp3/PSX_Doom_Music/doom_21mterebus.mp3",
"mp3/PSX_Doom_Music/doom_24hellbeneath.mp3",
"mp3/PSX_Doom_Music/fdoom_01attack.mp3",
"mp3/PSX_Doom_Music/fdoom_02virgil.mp3",
"mp3/PSX_Doom_Music/fdoom_03canyon.mp3",
"mp3/PSX_Doom_Music/fdoom_04combine.mp3",
"mp3/PSX_Doom_Music/fdoom_05catwalk.mp3",
"mp3/PSX_Doom_Music/fdoom_06fistula.mp3",
"mp3/PSX_Doom_Music/fdoom_07geryon.mp3",
"mp3/PSX_Doom_Music/fdoom_08minos.mp3",
"mp3/PSX_Doom_Music/fdoom_09nessus.mp3",
"mp3/PSX_Doom_Music/fdoom_10paradox.mp3",
}

local spec_playlist = {
"mp3/e1m1.mp3",
"mp3/e1m2.mp3",
"mp3/e1m3.mp3",
"mp3/e1m4.mp3",
"mp3/e1m5.mp3",
"mp3/e1m6.mp3",
"mp3/e1m7.mp3",
"mp3/e1m8.mp3",
"mp3/e1m9.mp3",
"mp3/Hangarmageddon.mp3",
"mp3/PA01Quake_Theme.mp3",
"mp3/Animal_Acoustic.mp3",
}

local boss_playlist = {
"mp3/PSX_Doom_Music/doom_credits.mp3",
"mp3/PSX_Doom_Music/final_doom_end.mp3",
"mp3/PSX_Doom_Music/psx_main_menu.mp3",
"mp3/PSX_Doom_Music/PSX_stats_screen.mp3",
}

local title_mus = rand_music(title_playlist,1)
local reg_mus = rand_music(reg_playlist,23)
local boss_mus = rand_music(boss_playlist,4)
local spec_mus = rand_music(spec_playlist,11)

Music = {
start     = title_mus,
interlude = "mp3/PSX_Doom_Music/fdoom_04combine.mp3",
bunny     = "mp3/d2end.mp3",
intro     = "mp3/DSoP_00_WelcomeToHell(Intro).mp3",
hellgate  = boss_mus[1],

level2    = reg_mus[1],
level3    = reg_mus[2],
level4    = reg_mus[3],
level5    = reg_mus[4],
level6    = reg_mus[5],
level7    = reg_mus[6],
level8    = reg_mus[7],
level9    = reg_mus[8],
level10   = reg_mus[9],
level11   = reg_mus[10],
level12   = reg_mus[11],
level13   = reg_mus[12],
level14   = reg_mus[13],
level15   = reg_mus[14],
level16   = reg_mus[15],
level17   = reg_mus[16],
level18   = reg_mus[17],
level19   = reg_mus[18],
level20   = reg_mus[19],
level21   = reg_mus[20],
level22   = reg_mus[21],
level23   = reg_mus[22],
level24   = reg_mus[23],

the_chained_court = spec_mus[1],
halls_of_carnage  = spec_mus[2],
hells_armory      = spec_mus[3],
hells_arena       = spec_mus[4],
spiders_lair      = spec_mus[5],
city_of_skulls    = spec_mus[6],
the_wall          = spec_mus[7],
unholy_cathedral  = spec_mus[8],
the_mortuary      = spec_mus[9],
the_vaults        = spec_mus[10],
the_lava_pits     = spec_mus[11],

tower_of_babel    = boss_mus[1],
hell_fortress     = boss_mus[2],
dis               = boss_mus[3],
victory   = "mp3/Motorhead - Hellraiser.mp3",
}



--- End code ---

If Hell gate and intro are both already covered in the boss and special levels, do they need to be specified at the beginning of the file? Would Hellgate be the boss would it be the same as? Should I start Hellgate at boss_mus [1] and go to boss_mus [2] for tower of babel?

For the title music, will it go to a different song when I start a new game without exiting?

****edit***
Tried again with the console version. The console version starts and everything seems to work fine except no title music plays at all. The graphics version crashes without starting.

****Edit 2***
ok. figured out why it started in console but not graphic. It's because I had "start     = title_mus," when I started graphic version, but I changed it to "start     = title_mus[1]," before I tried console. So I can get the graphic version to start that way, but I'm still not getting any title music. Everything else seems to work fine except the title music.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version