Announcement

Collapse
No announcement yet.

[C4:AC][XML Modding] Social Engineering (no experience needed)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [C4:AC][XML Modding] Social Engineering (no experience needed)

    Social Engineering needs you!

    I started a thread because I wasn't sure if there are XML modders out there waiting for tasks and they wouldn't be reading the Programming threads.

    I've got about 30 civicInfos--enough to test my code, but it needs about 100 more to be complete. This should be a high impact, rewarding task that could be completed in 1 day.

    I'm available for as much hand holding as you require.

    No sure how this collaboration supposed to work. And unfortunately we don't have a code control system yet.

    Attached is the CivicInfo xml. If someone volunteers for the task, I can post the whole mod if you want to be able see the results of your labor. Or you can just make the changes and pass it back to me.

  • #2
    You forgot the attachment.
    no sig

    Comment


    • #3
      At the moment I seem to be the only XML person but no way could I do it in a day.
      You have two choices in life; Explore and learn or Vegetate.
      There is a reason for everything.

      Comment


      • #4
        Ah, I didn't realize it rejects xml files.
        Attached Files

        Comment


        • #5
          So, from a fast read of the xml, I see there are 2 parts in the xml. First part is this:

          PHP Code:
          <CivicInfo>
              <
          CivicOptionType>CIVICOPTION_GOVERNMENT</CivicOptionType>
              <
          Type>CIVIC_POLICE_STATE</Type>
              <
          Description>TXT_KEY_CIVIC_POLICE_STATE</Description>
              <
          Civilopedia>TXT_KEY_CIVIC_POLICE_STATE_PEDIA</Civilopedia>
              <
          Strategy>TXT_KEY_CIVIC_POLICE_STATE_STRATEGY</Strategy>
              <
          Button>,Art/Interface/Buttons/Civics/Police_State.dds,Art/Interface/Buttons/Civics_Civilizations_Religions_Atlas.dds,5,2</Button>
              <
          TechPrereq>NONE</TechPrereq>

          ...

              <
          ACSocietyChanges>
                  <
          ACSocietyChange>
                      <
          ACSocietyType>CIVICOPTION_AC_SUPPORT</ACSocietyType>
                      <
          iACSocietyChange>2</iACSocietyChange>
                  </
          ACSocietyChange>
                  <
          ACSocietyChange>
                      <
          ACSocietyType>CIVICOPTION_AC_POLICE</ACSocietyType>
                      <
          iACSocietyChange>2</iACSocietyChange>
                  </
          ACSocietyChange>
                  <
          ACSocietyChange>
                      <
          ACSocietyType>CIVICOPTION_AC_EFFICIENCY</ACSocietyType>
                      <
          iACSocietyChange>-2</iACSocietyChange>
                  </
          ACSocietyChange>
              </
          ACSocietyChanges>
          </
          CivicInfo
          The second part, then, is this:

          PHP Code:
          <CivicInfo>
              <
          CivicOptionType>CIVICOPTION_AC_POLICE</CivicOptionType>
              <
          Type>CIVIC_AC_POLICE_-3</Type>
              <
          Description>TXT_KEY_CIVIC_AC_POLICE_-3</Description>
              <
          iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
              <
          iStateReligionGreatPeopleRateModifier>0</iStateReligionGreatPeopleRateModifier>
              <
          iDistanceMaintenanceModifier>0</iDistanceMaintenanceModifier>
              <
          iNumCitiesMaintenanceModifier>0</iNumCitiesMaintenanceModifier>
              <
          iExtraHealth>0</iExtraHealth>
              <
          iFreeExperience>0</iFreeExperience>
              <
          iWorkerSpeedModifier>0</iWorkerSpeedModifier>
              <
          iImprovementUpgradeRateModifier>0</iImprovementUpgradeRateModifier>
              <
          iMilitaryProductionModifier>0</iMilitaryProductionModifier>
              <
          iBaseFreeUnits>0</iBaseFreeUnits>
              <
          iBaseFreeMilitaryUnits>0</iBaseFreeMilitaryUnits>
              <
          iFreeUnitsPopulationPercent>0</iFreeUnitsPopulationPercent>
              <
          iFreeMilitaryUnitsPopulationPercent>0</iFreeMilitaryUnitsPopulationPercent>
              <
          iGoldPerUnit>0</iGoldPerUnit>
              <
          iGoldPerMilitaryUnit>0</iGoldPerMilitaryUnit>
              <
          iHappyPerMilitaryUnit>0</iHappyPerMilitaryUnit>
              <
          bMilitaryFoodProduction>0</bMilitaryFoodProduction>
              <
          iMaxConscript>0</iMaxConscript>
              <
          bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
              <
          bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
              <
          iLargestCityHappiness>0</iLargestCityHappiness>
              <
          iWarWearinessModifier>0</iWarWearinessModifier>
              <
          iFreeSpecialist>0</iFreeSpecialist>
              <
          iTradeRoutes>0</iTradeRoutes>
              <
          bNoForeignTrade>0</bNoForeignTrade>
              <
          iCivicPercentAnger>0</iCivicPercentAnger>
              <
          bStateReligion>0</bStateReligion>
              <
          bNoNonStateReligionSpread>0</bNoNonStateReligionSpread>
              <
          iStateReligionHappiness>0</iStateReligionHappiness>
              <
          iNonStateReligionHappiness>0</iNonStateReligionHappiness>
              <
          iStateReligionUnitProductionModifier>0</iStateReligionUnitProductionModifier>
              <
          iStateReligionBuildingProductionModifier>0</iStateReligionBuildingProductionModifier>
              <
          iStateReligionFreeExperience>0</iStateReligionFreeExperience>
              <
          iACCommerce>0</iACCommerce>
              <
          iUnbalancedSliderModifier>0</iUnbalancedSliderModifier>
              <
          iMorale>0</iMorale>
              <
          iMoralePlusModifier>0</iMoralePlusModifier>
              <
          iNewBaseProduction>0</iNewBaseProduction>
              <
          iGrowthModifier>0</iGrowthModifier>
              <
          bPopBoom>0</bPopBoom>
              <
          iAngryPerMilitaryAway>2</iAngryPerMilitaryAway>
              <
          bNoNerveStaple>1</bNoNerveStaple>
              <
          iEcoDisruptionModifier>0</iEcoDisruptionModifier>
              <
          iLifeformCaptureModifier>0</iLifeformCaptureModifier>
              <
          iEnemyProbeCostModifier>0</iEnemyProbeCostModifier>
              <
          iEnemyProbeSuccessModifier>0</iEnemyProbeSuccessModifier>
              <
          iProbeMorale>0</iProbeMorale>
              <
          bEnhancedSubversionOnly>0</bEnhancedSubversionOnly>
              <
          YieldModifiers/>
              <
          CapitalYieldModifiers/>
              <
          TradeYieldModifiers/>
              <
          CommerceModifiers/>
              <
          CapitalCommerceModifiers/>
              <
          SpecialistExtraCommerces/>
              <
          Hurrys/>
              <
          SpecialBuildingNotRequireds/>
              <
          SpecialistValids/>
              <
          BuildingHappinessChanges/>
              <
          FeatureHappinessChanges/>
              <
          ImprovementYieldChanges/>
              <
          ACSocietyChanges/>
              <
          WeLoveTheKing/>
          </
          CivicInfo

          This is a nice approach. At first I thought it was not a good idea to use the same tags for the civic choices and the society effects, but after thinking over it a while, your way will be a lot more mod-able.

          So, if I understand it right, you'll always have 4 + 8 civics enabled: The civics choices themselves in the 4 categories and one civic for each society value (+/- 8 categories). This enables us and/or modders to create a mix of the smacx and the civ model (ie: we can assign effects to both the society values AND the choices themselves).

          How much of the new effects did you code in yet (ie: popboom effects etc...) ? I can help with that part if it's needed.

          Oh, and we really need to make all these xml values optional so we only have to add the ones that actually do something
          no sig

          Comment


          • #6
            There are actually 4 + 10 civics.

            As the history of this thread shows, I also thought we shouldn't mix the two in the same XML, but realized how flexible it is.

            All of the functions are exposed thru Python for coding the effects. I kept myself contained to the Civics files until we get some source control, so only the effects that Civ4 already handled are working.

            Oh, and we really need to make all these xml values optional so we only have to add the ones that actually do something
            I've read other threads that discuss this. I'm not sure if Firaxis had a reason for making them all mandatory. It seems they did, since they are all that way, and many, many elements go unused.

            Comment


            • #7
              Originally posted by mdbill
              I'm not sure if Firaxis had a reason for making them all mandatory. It seems they did, since they are all that way, and many, many elements go unused.
              Some tags are not mandatory (my bSupply tag on units for example ), so it's no technological barrier. The only reason I can think of, is to help the modders to show what are all the possibillities, without having to write documentation for it.
              no sig

              Comment


              • #8
                XML files all the stuff should realy have been optional and considering the large number of Civic levels we can save a huge amount on the file size by leaving out all the unused tags and leting them default to zero (which the SDK will do naturaly for all pre-existing values and any sane person will do for new values).

                I see your set up is comming along nicely, I have some pointers on how I was planning it (before I got all distracted with other stuff that is).

                The CIVIC_AC_POLICE_-3

                is a text section that identifies the level but you still need a raw int with just that -3 in it for the game to know what effect to give the player.

                When the game loads it should look through each catagory and count the total, then loop through and find the highest and lowest values (say 4 and - 4) and difference them. Alocate an Array pointers of that size +1 (4 - -4 = 8 +1 = 9). Save the offset by subtracting the lowest value from zero (0 - -4 = 4) this is the value that will be added to the players level to get the proper array index (-2 Police + 4 = Array index 2). Then Assign each Effect level to the array in the same mannor checking for duplicates, if after that their are any Nulls left in the array that means the XML files were missing a level. You could abort, assign a default or make shure a Null Civic wont crash the game. Check the array once more to find a value which we will have defined as a global XML value called or something, for SMAC this is zero. Find the index of the effect with a zero value assign it to a Default offset for that Social Meter.

                This system will have the advantage of not needing to record the range of levels directly, moders could for example add a -5 level simply by creating an entry for it with that level value. Each Meter is configured individualy at load time and theirs no restrictions on what values can be used so long as no numbers are skiped.

                At run time you sum up a players level from their Civic options, Faction Bonuses and Wonder plus the Default offset to get the players overall level (note that Default offset and Faction bonus should just be assigned to the player at init and all subsequent changes modifiy the value up and down), if the total exceeds the max or min reduce it to fit in the constraints (the constraining is done only at the point of CALLING the value thus fixing the imfamous roll over bug). Now we also need to have an array for Cities as each City can deviate from the Base Player level (Childrens Crech, Golden Ages). Simply add local deviations and check for exceeded bounds again.
                Companions the creator seeks, not corpses, not herds and believers. Fellow creators, the creator seeks - those who write new values on new tablets. Companions the creator seeks, and fellow harvesters; for everything about him is ripe for the harvest. - Thus spoke Zarathustra, Fredrick Nietzsche

                Comment


                • #9
                  I'm not sure we're on the same page Impaler. The civicInfo array is self-manged without having to deal with array index math. We don't store the int -3 for the player's Police level, We store that he is at CIVIC_AC_POLICE_-3. Just the same as HEREDITARY_RULE, etc. was stored.

                  I don't yet see a need for a raw int either. The Police-3 effects are in that POLICE_-3 record.

                  We're planning on defining all possible levels for each meter, so that might be -5 - +9 for one and -8 - +5 for another. But like you said, you can just add another level any time if you want to mod it. But they need to remain sequential.

                  Faction bonuses are initialized in the Civilizations.xml

                  Comment


                  • #10
                    How do you intend to determine the players is IN Police -3? How would you control what effect the player is assigned to? If I am the Spartans and am running Police State you need to do the math and figure out what level to apply, you cant get around that. The actual assignment is no different only their needs to be a table and a system to determin what your Social Enginering Choices addup too.
                    Companions the creator seeks, not corpses, not herds and believers. Fellow creators, the creator seeks - those who write new values on new tablets. Companions the creator seeks, and fellow harvesters; for everything about him is ripe for the harvest. - Thus spoke Zarathustra, Fredrick Nietzsche

                    Comment


                    • #11
                      If your civ starts with CIVIC_POLICE_1 and then chooses Police State. They're bumped up 2 levels to CIVIC_POLICE_3. Effects stored in civicInfos for CIVIC_POLICE_1 are removed and effects for CIVIC_POLICE_3 are applied. If you build a wonder with Police+1 it bumps your civic option +1 so now you're in CIVIC_POLICE_4. (effects for 3 are removed and those for level 4 are added. It's not theoretical. I have it all working.

                      Some consideration needs to be done for cities which individually change the level, but it should work out.

                      Comment


                      • #12
                        Could you post your SorceCode, I still dont see how you managed this, how dose your code "know" that Police_4 is the apropriate setting after you got that +1? Did you simply hardcode every combination like so?

                        if (Player.Police_level = 4)
                        Player.doCivics(Police_4)
                        Companions the creator seeks, not corpses, not herds and believers. Fellow creators, the creator seeks - those who write new values on new tablets. Companions the creator seeks, and fellow harvesters; for everything about him is ripe for the harvest. - Thus spoke Zarathustra, Fredrick Nietzsche

                        Comment


                        • #13
                          I require the CivicInfos to be listed in order. They are read into and enum CivicTypes by the XML parser.

                          So something like m_paeCurrentCivics[iCivicOption} += 1
                          does the job.

                          I'm waiting until source code control to check=in my files. Some people expressed interest in improving the UI, etc and I don't want mods to my mod until it's safely versioned. Should be soon I hope.

                          Comment


                          • #14
                            mdbill, I'm going to be available for this soon. Do you have an IM service for easy contact?

                            Comment


                            • #15
                              Be sure and sign up for sourceforge now that our project is ready. Once I get my Civics work checked in, I'll be looking for you. I'll get back to you on the IM service.

                              Comment

                              Working...
                              X