1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Question about the Music Soundtrack

Discussion in 'Rhye's and Fall - Dawn of Civilization' started by Joij21, May 12, 2020.

  1. Joij21

    Joij21 Prince

    Joined:
    Jul 21, 2016
    Messages:
    432
    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)?
     
  2. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,304
    Gender:
    Male
    Location:
    Leblanc
    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.
     
    Publicola likes this.
  3. Joij21

    Joij21 Prince

    Joined:
    Jul 21, 2016
    Messages:
    432
    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.
     
    Leoreth likes this.
  4. freethink

    freethink Warlord

    Joined:
    Dec 17, 2011
    Messages:
    247
    Location:
    Great Light House
    Were my Music pull requests ever included :)?
     
  5. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    34,304
    Gender:
    Male
    Location:
    Leblanc
    I need to review things before I include them, and I never got to it.
     

Share This Page