Implementing active music in Spring
Moderator: Moderators
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
That works for when combat has just finished (although I'd prefer value of units/buildings killed/lost as opposed to direct numbers), as determined by certain ammount of time (5s?) after the last shot is fired in a "combat" sequence (determined using process below)mongus wrote:How can you decide the tides scales?
(kills/s)/(deaths/s)>= 1 (win music)
(kills/s)/(deaths/s)< 1 (lose music) ?
Then all you have to do is have music for when no friendly shots are being fired (build/peacetime music)
And music for combat, determined by percentage of mobile, weapon equipped forces with a target they are engaging or attempting to engage within thier LOS
With these criteria we satisfy the 4 conditions mentioned further back in this thread.
I have a friend who liked TA who can make some decent tunes, I'll see if I can't get him to make us some generic music for these different situations, that way we'll have some spring dedicated music.
here is the music i made for TA:WD:
http://www.chryys.galacticgate.de/nKK/T ... 0theme.mp3
ok not the best^^ but it if a spring updates allows us to include ingame music i will focus on this style of music and could make more / more neutral songs for tawd (this is my second song with orchestral.. normally i create more electronic / techno -music)
ps.: i dont like the word "techno" because everybody answers "bum bum bum" if its mentioned
http://www.chryys.galacticgate.de/nKK/T ... 0theme.mp3
ok not the best^^ but it if a spring updates allows us to include ingame music i will focus on this style of music and could make more / more neutral songs for tawd (this is my second song with orchestral.. normally i create more electronic / techno -music)
ps.: i dont like the word "techno" because everybody answers "bum bum bum" if its mentioned
as much as i like alot of the music that has been posted, there are two reasons why we should stick with the original ta music:
1. it is specifically designed for battle/building etc. and sounds absolutely astounding
2. all the songs are composed with the same instruments, where as having many different songs by different artists would lead to clashes, and imo would ruin what should be a smooth transition between songs.
just listen to this track... gives me that warm and fuzzy first-time-i-ever-played-ta feeling all over again!
http://www.fileuniverse.com/Music/15-Au ... k%2015.mp3
sorry... i guess this is moving away from the actual music implementation side of things
1. it is specifically designed for battle/building etc. and sounds absolutely astounding
2. all the songs are composed with the same instruments, where as having many different songs by different artists would lead to clashes, and imo would ruin what should be a smooth transition between songs.
just listen to this track... gives me that warm and fuzzy first-time-i-ever-played-ta feeling all over again!
http://www.fileuniverse.com/Music/15-Au ... k%2015.mp3
sorry... i guess this is moving away from the actual music implementation side of things

I think the soundpack that the player uses should be entirely up to the player, Spring could just have on the site music packs. I say we should compile some spring specific music that fits well together as to avoid possible legal troubles later, as well as sponsor the original soundset until we're told to stop by waves and waves of lawyers that advance like so many pee-wees.
And yes, while originally meant as a thread for the implementation of the engine side of the active music, I don't think it's digressing too far to discuss what types of music should be acommodated (filetype, playertype, do we want to sponsor music?.) Just so long as we don't start arguing which early orchestral composers have better music for the game, we should be just fine.
And yes, while originally meant as a thread for the implementation of the engine side of the active music, I don't think it's digressing too far to discuss what types of music should be acommodated (filetype, playertype, do we want to sponsor music?.) Just so long as we don't start arguing which early orchestral composers have better music for the game, we should be just fine.
to avoid any legal trouble *shakes fist angrily* the first step should be to merely implement the code, and provide the music files seperately. having copyrighted music more trouble than having copyrighted units, sounds and so forth, so i think it would be a good idea to have it as an optional download, perhaps on fileuniverse... they already have the whole soundtrack there, however i would like to replace those crappy 128kps files with my high quality rips 

-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
I think mp3 is the best option for the player, simply because of its ease of use, and its relative prominance.
As for the algorithm for determining when things are played, I think that while you are on the right direction (both mongus and icedragon), both of your proposals have several weaknesses.
The major common weakness is that there are a number of occasions when the wrong music type will play. For example, in a game where I have teched up early, and have many advanced units, but an enemy player is simply overwhelming me with level one units. The kill ratio would be in my favour, but he could still be winning...
Another issue is that battle music could well be "shunted out" by victory/defeat music very quickly, despite an ongoing battle.
Therefore, I suggest that music should be run on a loop (that is, a loop that loops through different atmospheres, while picking randomly within those subheadings), which can skip certain things as dictated by Spring.
I've used a combination of both your ideas, as well as some of my own to work out what I think is a good algorithm:
Buildtime {loops randomly}
if a unit is killed , then
tension OR buildtime {looping randomly}
if no unit is killed ('Ceasfire') for X amount of minutes then
buildtime {loops randomly} else
{if no Ceasefire is detected after X amount of minutes, then the battle is obviously continuing}
battle {looping randomly}
If Ceasefire, then
Tension OR buildtime {winding down as the battle moves off} else if
Winning Death toll then {I would determine the unit death toll by checking if 2/3 of the units killed are for/against the player, within the defined X amount of time between checking for ceasefire periods}
Victorious OR Battle music {you want to have both}
if Losing Death toll then
Defeat OR Battle music
-------------
I hope that makes sense.
The idea is that the music loops between different playing segments, rather than only playing this, or only playing that, etc.
A vital part of the player is that songs fade out, rather than cut to different sequences, even if in mid-song. This is something which OTA missed, and it is rather grating to have songs cut in and out.
--------------
And shnorb, as the others have said, I intentionally avoided saying that the OTA music should be used (as good as it is), because of copyright issues. Of course, using the system I propose (that is, Spring reads the music from a director called TASpring/soundtrack, and subdirectories such as TASpring/soundtrack/Battle, TASpring/soundtrack/tension, etc) it would be very easy to simply download those files and then put them in, or even download those files, and mix them in with some Wagner and Beethoven.
As for the algorithm for determining when things are played, I think that while you are on the right direction (both mongus and icedragon), both of your proposals have several weaknesses.
The major common weakness is that there are a number of occasions when the wrong music type will play. For example, in a game where I have teched up early, and have many advanced units, but an enemy player is simply overwhelming me with level one units. The kill ratio would be in my favour, but he could still be winning...
Another issue is that battle music could well be "shunted out" by victory/defeat music very quickly, despite an ongoing battle.
Therefore, I suggest that music should be run on a loop (that is, a loop that loops through different atmospheres, while picking randomly within those subheadings), which can skip certain things as dictated by Spring.
I've used a combination of both your ideas, as well as some of my own to work out what I think is a good algorithm:
Buildtime {loops randomly}
if a unit is killed , then
tension OR buildtime {looping randomly}
if no unit is killed ('Ceasfire') for X amount of minutes then
buildtime {loops randomly} else
{if no Ceasefire is detected after X amount of minutes, then the battle is obviously continuing}
battle {looping randomly}
If Ceasefire, then
Tension OR buildtime {winding down as the battle moves off} else if
Winning Death toll then {I would determine the unit death toll by checking if 2/3 of the units killed are for/against the player, within the defined X amount of time between checking for ceasefire periods}
Victorious OR Battle music {you want to have both}
if Losing Death toll then
Defeat OR Battle music
-------------
I hope that makes sense.
The idea is that the music loops between different playing segments, rather than only playing this, or only playing that, etc.
A vital part of the player is that songs fade out, rather than cut to different sequences, even if in mid-song. This is something which OTA missed, and it is rather grating to have songs cut in and out.
--------------
And shnorb, as the others have said, I intentionally avoided saying that the OTA music should be used (as good as it is), because of copyright issues. Of course, using the system I propose (that is, Spring reads the music from a director called TASpring/soundtrack, and subdirectories such as TASpring/soundtrack/Battle, TASpring/soundtrack/tension, etc) it would be very easy to simply download those files and then put them in, or even download those files, and mix them in with some Wagner and Beethoven.
I would still prefer value of units lost/won as opposed to direct numbers. Let's say you send 5 waves of 25 gunships at your opponent. your first two waves are completely destroyed, your 3rd wave destroys most of his defenses, and your 4th and 5th wave take out strategic targets before being shot down (fusion reactors, commander, factories.) Now while you just lost the battle as far as direct numbers of units go, you have won the war in destroying a great value of his buildings, thus victory music should be playing over defeat music.
I really don't care about having victory or defeat music. I just want a difference between building and battle! Of course, small battles with a few units dying would not trigger the the battle music, but say a certain overall number of units die within a certain time period, and triggers the battle music.
However, if we're going to splurge on this it would be even cooler to have a detector in place which takes notice when you send a large number of units to attack something, or near an enemy's base (Say, so many units are sent to a destination that is inside the attack range of a majority of the opposing player's defenses.) Of course, it would wait several seconds (Or even up to a minute?), just in case you decided to change your mind, and I suppose some code would have to be in place to only play music if the player has unrevealed units there, as such could be exploited when looking for a radar jammed hidden base.
However, if we're going to splurge on this it would be even cooler to have a detector in place which takes notice when you send a large number of units to attack something, or near an enemy's base (Say, so many units are sent to a destination that is inside the attack range of a majority of the opposing player's defenses.) Of course, it would wait several seconds (Or even up to a minute?), just in case you decided to change your mind, and I suppose some code would have to be in place to only play music if the player has unrevealed units there, as such could be exploited when looking for a radar jammed hidden base.
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
IceDragon, I like the idea of judging victory/defeat based on importance (perhaps build time or metal cost?) but that could well be a bit complicated.
What my (admittedly very basic) scheme did was that instead of using "this player has killed more units than his enemy", I used ratios. So when the ratio of kills to losses is greater than 1:3, defeat music plays, or the opposite.
That way, when the battle is "hanging in the balance" (that is, the ratio is vaguely even), battle music will continue to play.
If you are winning, and losing units at a ratio of 1 to 3, then I think the defeat music deserves to play, to highlight the horrible nature of war
Neuralize, I don't think the music should be either as simple (only defeat-battle) or as complicated (looking at movement lists, etc) as you propose.
The simple method simply ignores a large amount of atmosphere. There is a big difference between a battle raging, and you being on the victorious side, and a battle which you have to win at all costs, or surrender the game.
At the sime time, the music program should slot in seamlessly into Spring, or it shouldn't be included. There shouldn't be any visible lag (associated with using complex calculations to work out what music to play), especially online - this is absolutely essential.
What my (admittedly very basic) scheme did was that instead of using "this player has killed more units than his enemy", I used ratios. So when the ratio of kills to losses is greater than 1:3, defeat music plays, or the opposite.
That way, when the battle is "hanging in the balance" (that is, the ratio is vaguely even), battle music will continue to play.
If you are winning, and losing units at a ratio of 1 to 3, then I think the defeat music deserves to play, to highlight the horrible nature of war

Neuralize, I don't think the music should be either as simple (only defeat-battle) or as complicated (looking at movement lists, etc) as you propose.
The simple method simply ignores a large amount of atmosphere. There is a big difference between a battle raging, and you being on the victorious side, and a battle which you have to win at all costs, or surrender the game.
At the sime time, the music program should slot in seamlessly into Spring, or it shouldn't be included. There shouldn't be any visible lag (associated with using complex calculations to work out what music to play), especially online - this is absolutely essential.
true, im just sick of getting poor quality 128 mp3s i guess, but they shouldnt be the standard bitrate used for everything when you can get way better quality at such a small cost.[K.B.] Napalm Cobra wrote:128kbps is hardly crappy.
anyway, back onto the subject...
i think the idea of having battle music play when a large force is detected moving into enemy territory/defence range is cool, but would probably be ridiculously difficult to implement (correct?). to be honest, i just want something simple, that works well with what is happening.
also, dont forget that silence could be utilised as well. eg. when you are only down to a few units, the dreary and sad defeat music should slowly fade out into silence, as the enemy closes in, leaving explosions as the last thing heard before defeat.
EDIT: i still think the ta music works best, and that it should be considered as the standard music for the ta side of spring. yeah, yeah, i know, that it is copyrighted, but just the same as the other copyrighted material in the game you can claim that you must own the game to use it. but just to be sure the music files should stay on file universe (they will anyway).
Could the pathing be used to determine when battle is about to begin?
Thinking of debug mode (b) with .cheat activated (lets you see all paths for all moving units) so if a certain number of enemy paths are crossed by a certain number of your own, the game would fade to tension-battle music.
(Just guessing, don't have any coding skills to speak of)
Thinking of debug mode (b) with .cheat activated (lets you see all paths for all moving units) so if a certain number of enemy paths are crossed by a certain number of your own, the game would fade to tension-battle music.
(Just guessing, don't have any coding skills to speak of)
keeping in theme with the GPL-ness of spring, I propose the use of .ogg (MP3 and WMA still being patented). FLAC could be an option, but AFAIK it's even less well known than ogg.
The free formats (FLAC and ogg) are being actively squeezed out by the big players (WMP doesn't play .ogg, for instance) it's open source (free as in speech) projects where they're going to get their publicity and I think we should help (or course it shouldn't be too hard to make the game play music in whatever format it comes, there should be GPLed libraries about for that).
On the music itself, anyone fancy burning up some clock cycles on having a dynamically generated (from lots of little samples) version of Bolero by Ravel? adding and removing instruments as the tide of the battle changes?
Oher suggested music:
The hall of the mountain king - battles
the march of the dwarves - if you can get it to detect a mass movement of units with weapons which aren't on patrol or guard duties.
(both by grieg)
mars, the bringer of war, by holst. - battles /going to
Fingal's cave, mendelssohn -(not sure what for)
Scene from ActII of Swan Lake, Tchaikovsky - when you're smarting after a battle (detect beginning/end of battle, if units lost in the time greater than units killed, play)
O Fortuna, from Carmina Burana, Orff - victory, or the beginning of a battle
Fanfare for the common man, Copland - victory where units lost > units killed
Sabre dance, khatchaturian - when fleeing from battle
night on a bare mountain, Mussorgsky - battle
Finale from william tell overture, rossini - victory
Nimrod, Elgar - victory
Radetsky march, strauss - victory
Dance of the sugar-plum fairy, tchaikovsky - when your army consists entirely of peewees
Toccata, Bach - not sure where
Hungarian dance, Brahms - flurried base building
the Torreadors (from carmen), Bizet - victory
The light cavalry, suppe - skirmishing
Dies Irea, from requiem, Mozart - mop-up of battles battles (when average activity has peaked and is now dropping)
Lagrima, Terraga - defeat
Hungarian dance No16, Marinkovic & Peake - smarting from battle (or the first minute or so for defeat)
Rule britannia - victory if lots of naval units were involved
Anvil Chorus, Davies - building
Of course, if you want to dodge copyright issues, you could always go for AOE-esque midi files and make them from the score, most (if not all) of these actual pieces of music are well out of copyright. Alternatively, you could just get people to rip their TA CD's and slip the files into the right folders.
-Gurkha
The free formats (FLAC and ogg) are being actively squeezed out by the big players (WMP doesn't play .ogg, for instance) it's open source (free as in speech) projects where they're going to get their publicity and I think we should help (or course it shouldn't be too hard to make the game play music in whatever format it comes, there should be GPLed libraries about for that).
On the music itself, anyone fancy burning up some clock cycles on having a dynamically generated (from lots of little samples) version of Bolero by Ravel? adding and removing instruments as the tide of the battle changes?
Oher suggested music:
The hall of the mountain king - battles
the march of the dwarves - if you can get it to detect a mass movement of units with weapons which aren't on patrol or guard duties.
(both by grieg)
mars, the bringer of war, by holst. - battles /going to
Fingal's cave, mendelssohn -(not sure what for)
Scene from ActII of Swan Lake, Tchaikovsky - when you're smarting after a battle (detect beginning/end of battle, if units lost in the time greater than units killed, play)
O Fortuna, from Carmina Burana, Orff - victory, or the beginning of a battle
Fanfare for the common man, Copland - victory where units lost > units killed
Sabre dance, khatchaturian - when fleeing from battle
night on a bare mountain, Mussorgsky - battle
Finale from william tell overture, rossini - victory
Nimrod, Elgar - victory
Radetsky march, strauss - victory
Dance of the sugar-plum fairy, tchaikovsky - when your army consists entirely of peewees

Toccata, Bach - not sure where
Hungarian dance, Brahms - flurried base building
the Torreadors (from carmen), Bizet - victory
The light cavalry, suppe - skirmishing
Dies Irea, from requiem, Mozart - mop-up of battles battles (when average activity has peaked and is now dropping)
Lagrima, Terraga - defeat
Hungarian dance No16, Marinkovic & Peake - smarting from battle (or the first minute or so for defeat)
Rule britannia - victory if lots of naval units were involved

Anvil Chorus, Davies - building
Of course, if you want to dodge copyright issues, you could always go for AOE-esque midi files and make them from the score, most (if not all) of these actual pieces of music are well out of copyright. Alternatively, you could just get people to rip their TA CD's and slip the files into the right folders.
-Gurkha
very nice idea with the 1:3 loss musicWarlord Zsinj wrote:IceDragon, I like the idea of judging victory/defeat based on importance (perhaps build time or metal cost?) but that could well be a bit complicated.
What my (admittedly very basic) scheme did was that instead of using "this player has killed more units than his enemy", I used ratios. So when the ratio of kills to losses is greater than 1:3, defeat music plays, or the opposite.
That way, when the battle is "hanging in the balance" (that is, the ratio is vaguely even), battle music will continue to play.
If you are winning, and losing units at a ratio of 1 to 3, then I think the defeat music deserves to play, to highlight the horrible nature of war![]()
Neuralize, I don't think the music should be either as simple (only defeat-battle) or as complicated (looking at movement lists, etc) as you propose.
The simple method simply ignores a large amount of atmosphere. There is a big difference between a battle raging, and you being on the victorious side, and a battle which you have to win at all costs, or surrender the game.
At the sime time, the music program should slot in seamlessly into Spring, or it shouldn't be included. There shouldn't be any visible lag (associated with using complex calculations to work out what music to play), especially online - this is absolutely essential.
i am AGAINST taking normal classical music... it wont fit together
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
What do you think OTA's music is?
And if you listen to Jeremy Soule's pieces for OTA with a bit of knowledge of other classical pieces, you can hear that they are rather cliche, with bits taken from a number of different pieces (most being mentioned in this thread!). Which is not to say that is bad (I like the OTA music. It isn't Bach, but it's good fun), it just shows that classical music certainly does fit within Spring's frame.
And if you listen to Jeremy Soule's pieces for OTA with a bit of knowledge of other classical pieces, you can hear that they are rather cliche, with bits taken from a number of different pieces (most being mentioned in this thread!). Which is not to say that is bad (I like the OTA music. It isn't Bach, but it's good fun), it just shows that classical music certainly does fit within Spring's frame.