Question about the Music Soundtrack

Joij21

🔥Hail Satan!🔥
Joined
Jul 21, 2016
Messages
3,191
Location
currently presiding over Hell
I'm planning on making my own music modmod but I'd like to know how the dynamic soundtrack is able to change based on religion. Is it done through python? Or does it do so through the religion defines in the XML? I've checked the era defines and see that the alternate tracks count as other eras, but how exactly do they behave as the same era (like for instance entering the medieval era as a Christian or Muslim)?
 
I don't want to make things too complicated for you, but the short of it is that you are never "in" any of those extra eras that contain the alternate playlists. They are only drawn from when the game selects your soundtrack music to play.

The logic for this is defined in the DLL:
Code:
EraTypes CvPlayer::getSoundtrackEra()
{
   ReligionTypes eStateReligion = getStateReligion();
   EraTypes eCurrentEra = getCurrentEra();

   if (eStateReligion == CONFUCIANISM || eStateReligion == TAOISM)
   {
       if (eCurrentEra == ERA_CLASSICAL || eCurrentEra == ERA_MEDIEVAL || eCurrentEra == ERA_RENAISSANCE)
       {
           return (EraTypes)ERA_EAST_ASIA;
       }
   }
   else if (eStateReligion == BUDDHISM || eStateReligion == HINDUISM)
   {
       if (eCurrentEra == ERA_CLASSICAL || eCurrentEra == ERA_MEDIEVAL || eCurrentEra == ERA_RENAISSANCE)
       {
           switch (getCivilizationType())
           {
           case CHINA:
           case MONGOLS:
           case JAPAN:
           case KOREA:
               return (EraTypes)ERA_EAST_ASIA;
           default:
               return (EraTypes)ERA_SOUTH_ASIA;
           }
       }
   }
   else if (eStateReligion == ISLAM || eStateReligion == ZOROASTRIANISM)
   {
       if (eCurrentEra == ERA_MEDIEVAL || eCurrentEra == ERA_RENAISSANCE)
       {
           return (EraTypes)ERA_MIDDLE_EAST;
       }
   }
   else if (eStateReligion == NO_RELIGION)
   {
       if (eCurrentEra == ERA_MEDIEVAL)
       {
           return (EraTypes)ERA_CLASSICAL;
       }
   }

   return eCurrentEra;
}
What do you want to do? Selection of pieces and putting the XML together is the tedious aspect for me, I can easily add another soundtrack era playlist to support that if it makes sense and you do not want to mess with the DLL sources.

Note: I've taken this code from the rewrite branch, I just realised that it might be a little different than the current develop code. But the general idea is the same.
 
Well I was actually going to make a modmod for Caveman2Cosmos but I like the dynamic soundtrack this mod uses. Also would it be possible for the playlist to be changed by a building instead of a religion? Caveman2Cosmos gives a free cultural building that defines the civilization as European, Asian, Oceanian, etc. in the capitol. I was planning on making an Ancient track for Europe, Asia, the Middle East, Oceania, Africa, North America, and South America. Likewise I was going to do the same for the Classical, Medieval, Renaissance, and Industrial eras. Everything after that would use a unified soundtrack. As far as music is concerned I have already been amassing a large collection of mp3 files.
 
I need to review things before I include them, and I never got to it.
 
I don't want to make things too complicated for you, but the short of it is that you are never "in" any of those extra eras that contain the alternate playlists. They are only drawn from when the game selects your soundtrack music to play.

The logic for this is defined in the DLL:
Code:
EraTypes CvPlayer::getSoundtrackEra()
{
   ReligionTypes eStateReligion = getStateReligion();
   EraTypes eCurrentEra = getCurrentEra();

   if (eStateReligion == CONFUCIANISM || eStateReligion == TAOISM)
   {
       if (eCurrentEra == ERA_CLASSICAL || eCurrentEra == ERA_MEDIEVAL || eCurrentEra == ERA_RENAISSANCE)
       {
           return (EraTypes)ERA_EAST_ASIA;
       }
   }
   else if (eStateReligion == BUDDHISM || eStateReligion == HINDUISM)
   {
       if (eCurrentEra == ERA_CLASSICAL || eCurrentEra == ERA_MEDIEVAL || eCurrentEra == ERA_RENAISSANCE)
       {
           switch (getCivilizationType())
           {
           case CHINA:
           case MONGOLS:
           case JAPAN:
           case KOREA:
               return (EraTypes)ERA_EAST_ASIA;
           default:
               return (EraTypes)ERA_SOUTH_ASIA;
           }
       }
   }
   else if (eStateReligion == ISLAM || eStateReligion == ZOROASTRIANISM)
   {
       if (eCurrentEra == ERA_MEDIEVAL || eCurrentEra == ERA_RENAISSANCE)
       {
           return (EraTypes)ERA_MIDDLE_EAST;
       }
   }
   else if (eStateReligion == NO_RELIGION)
   {
       if (eCurrentEra == ERA_MEDIEVAL)
       {
           return (EraTypes)ERA_CLASSICAL;
       }
   }

   return eCurrentEra;
}
What do you want to do? Selection of pieces and putting the XML together is the tedious aspect for me, I can easily add another soundtrack era playlist to support that if it makes sense and you do not want to mess with the DLL sources.

Note: I've taken this code from the rewrite branch, I just realised that it might be a little different than the current develop code. But the general idea is the same.
If I were to add "eCurrentEra == ERA_Industrial" to these, would the ethnic soundtracks keep playing through the industrial era?
 
Yes. But you need to recompile the DLL.
 
Yes. But you need to recompile the DLL.
Thanks, so I guess then I'm not going to do it, since I'm not set up to do DLL. I would recommend that for 1.17, you extend the ethnic soundtracks into the industrial era, I don't think it really makes sense for 19th century China to be hearing European classical music. If you'd like, I can find extra songs for the soundtracks.
 
Top Bottom