#1 2022-06-02 10:04:28

qk
Guest

Play song

Hi all,

Now I have a simple "bind j music ..." to play a song but would be better if it could be done on start, map loading, etc, so it loops always.

I've found this on the forum:

/// placed in worldspawn ()
world.sounds = rint (random () * 16) + 2;

I guess I may change it to:

world.sounds = 7;

Is this ok?

Regards.

#2 2022-06-02 15:57:23

Gila
Member

Re: Play song

What are you trying to do exactly? Is this for a mod you are making or just for playing some maps?

And where have you found that "world.sounds=..." thing?
If that is from QuakeC, then I can't find that in any of ID1 *.qc files.

I have no understanding of QuakeC but looks like random() returns random float value between 0.0 and 0.1, then that is multiplied by 16, then that result is rounded up to closest integer value and then 2 is added on top. So that would put "sounds" key value to 2, 3 or 4 in worldspawn, but where is that from anyway?

#3 2022-06-02 16:24:40

qk
Guest

Re: Play song

Hi,

Gila wrote:

What are you trying to do exactly? Is this for a mod you are making or just for playing some maps?

Is to play some maps with the same song. It works with the key binding, but it stops after getting killed and reloading the last save.

Gila wrote:

And where have you found that "world.sounds=..." thing?
If that is from QuakeC, then I can't find that in any of ID1 *.qc files.

It is from the last post here https://www.quaddicted.com/forum/viewtopic.php?id=66

Gila wrote:

I have no understanding of QuakeC but looks like random() returns random float value between 0.0 and 0.1, then that is multiplied by 16, then that result is rounded up to closest integer value and then 2 is added on top. So that would put "sounds" key value to 2, 3 or 4 in worldspawn, but where is that from anyway?

Yes, that is what it does. I was thinking in hardcoding the value on world.sounds so I don't have to play the song everytime.

Regards.

#4 2022-06-02 18:15:23

Andrew
Member

Re: Play song

Look in my modification for an example of the design of these files.
Any "*.ent" file for the map can be created in DarkPlaces (provided that the map starts in it) and then use this file with the QSS engine.

Part of the modification description:
- "*.ent" files have been made for all levels, which use certain music tracks (now all tracks from the list are used), skyboxes and a small fog;

Link to the topic:
https://www.quaddicted.com/forum/viewtopic.php?id=1018

Creating a "*.ent" file in DP:
In the console, after loading the level, enter the command "sv_saveentfile" and this file will be created in the "maps" folder.

Example of the beginning of the "*.ent" file:
{
"worldtype" "1"
"classname" "worldspawn"
"wad" "gfx/metal.wad"
"spawnflags" "1"
"sounds" "2" //track №2 in music folder - which one do you like to use
"message" "The Bad Place"
"sky" "nebula_" //sky in gfx/env folder
"fog" "0.03 0.3 0.1 0.1"
}
...

#5 2022-06-03 18:11:30

qk
Guest

Re: Play song

Hi Andrew,

Thanks for the detailed help. WIll follow your advice and digg on this trought the weekend.

Andrew wrote:

Look in my modification for an example of the design of these files.
Any "*.ent" file for the map can be created in DarkPlaces (provided that the map starts in it) and then use this file with the QSS engine.

Part of the modification description:
- "*.ent" files have been made for all levels, which use certain music tracks (now all tracks from the list are used), skyboxes and a small fog;

Link to the topic:
https://www.quaddicted.com/forum/viewtopic.php?id=1018

Creating a "*.ent" file in DP:
In the console, after loading the level, enter the command "sv_saveentfile" and this file will be created in the "maps" folder.

Example of the beginning of the "*.ent" file:
{
"worldtype" "1"
"classname" "worldspawn"
"wad" "gfx/metal.wad"
"spawnflags" "1"
"sounds" "2" //track №2 in music folder - which one do you like to use
"message" "The Bad Place"
"sky" "nebula_" //sky in gfx/env folder
"fog" "0.03 0.3 0.1 0.1"
}
...

#6 2022-06-04 08:53:42

Gila
Member

Re: Play song

Yeah going the way with external .ent flies seems the easiest one. Unless you really want to change that QuakeC code in world.qc and then you will have to recompile it, which would produce a progs.dat file. But in that case, you won't be able to play maps from mods that have their own progs.dat file.

Extracting .ENT file and changing it in text editor is way easier, and also it can be done in any mod, you just need an engine that can read the entity information from external .ENT files. Quakespasm and it's variants (Spiked, vkQuake, Ironwail, etc?) all can do this. Just might need to check a cvar in console, I think it's "external_ents" and should be set to "1".

I had an idea long time ago to adapt Quake 64 soundtrack this way to Mission Pack levels :) But still didn't get around to it.

#7 2022-06-05 09:56:37

qk
Guest

Re: Play song

Hi,

I've downloaded Darkplaces from the engines archive to extract the .ent file as said. As soon as it started it did nothing, only a black screen appeared and then system hung up.

I removed it, I don't want to mess my setup so could anyone post a start.ent file to make the changes?

OTOH, is there a way to play the song after loading a game, tried bind f3 "menu_load;music ..." but it doesn't work. This could be the easy path, because it is enough with a "music ..." in autoexec.cfg to get it always playing. It only stops after loading a saved game.

Cheers.

#8 2022-06-06 20:03:53

Andrew
Member

Re: Play song

Guys, take the "*.ent" files of all levels from my mod and don't suffer. Put your tracks and the sky there, whatever you like. By default, there are no "*.ent" files in DP. They need to be done manually for each level.

Here is this line that I added to the "quake.rc" file:

music menu_theme // this is the name of the track that is played in the menu, you can use any track name

#9 2022-06-09 20:22:00

qk
Guest

Re: Play song

Hi,

Downloaded the mod and got it working.

Now, should I edit all the .ent files to play the song or is there a simple way?

Andrew wrote:

Guys, take the "*.ent" files of all levels from my mod and don't suffer. Put your tracks and the sky there, whatever you like. By default, there are no "*.ent" files in DP. They need to be done manually for each level.

Here is this line that I added to the "quake.rc" file:

music menu_theme // this is the name of the track that is played in the menu, you can use any track name

Cheers.

#10 2022-06-10 14:36:47

Andrew
Member

Re: Play song

qk wrote:

Hi,

Downloaded the mod and got it working.

Now, should I edit all the .ent files to play the song or is there a simple way? ......

Unfortunately, the game at the running level plays tracks that have the name "track00; 02-11" (don't use "01", last number "11", in all mods this rule applies to tracks and any numbers), but for some reason these rules don't apply to the game menu. So I named the track "menu_theme" (came up with the name of the track), put it in the "music" folder and added a line to the "quake.rc" file, and everything worked. I didn't even expect it myself. )))

To change the track name, simply edit the "*.ent" file you need and write down the track number in the "sounds" line, for example "6" - this will mean that the level will play the "track06.mp3/ogg" file in a circle. Note that for the "QSS" engine some levels have a different file name. I have already encountered this problem and the guys from this forum helped me.

e1m1@c49d.ent;
e1m2@0caa.ent;
e1m4@958e.ent;
e2m2@fbfe.ent;
e2m3@237a.ent;
e2m7@10a8.ent

If you don't want to mess with "*.ent" files, just after loading the level, write "music track00; 02 ... nn" in the console and the music will change, but when loading the save, the music will reset to standard.

Last edited by Andrew (2022-06-10 15:09:44)

#11 2022-06-11 10:22:54

qk
Guest

Re: Play song

Hi,

Andrew wrote:

If you don't want to mess with "*.ent" files, just after loading the level, write "music track00; 02 ... nn" in the console and the music will change, but when loading the save, the music will reset to standard.

Then I don't need the mod. I already have a "music ..." in autoexec.cfg and a key binding to play it. The only problem is, as you say, loading a game.

I've been reading some quakec docs and found something interesting here:
[link]https://tomeofpreach.wordpress.com/2014 … detection/[/link]

It seems there is a function RestoreGame() called after a game is loaded so it would be enough to compile my own progs.dat to get it working.

RestoreGame() function:
{
    <playmysong>
}

I would need to know it this may work or it will get me nowhere?

Cheers.

#12 2022-06-27 12:24:43

qk
Guest

Re: Play song

Hi,

I was about to installl quakec and other tools to solve this but didn't want to pollute my workspace nor build a new VM to play with, so I solved it the easy way.

Just muted the music while playing and wrote a script to play the song and change it on map loading when needed.

Cheers.

Board footer