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

Technical documentation

Discussion in 'Rhye's and Fall: The Sword of Islam' started by embryodead, Jun 28, 2011.

  1. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    That's a fair enough reason then :)
     
  2. J. pride

    J. pride King

    Joined:
    Feb 23, 2011
    Messages:
    788
    I think that it would be pretty fun to play the Zengids atleast; I can think of atleat 2 UHVS that can work
     
  3. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    What is the purpose of the "barb regions" in the DLL?
     
  4. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    Those are provinces where players can't have cultural borders beyond level 2 (or 3, don't remember). This prevents exploits such as building cities in/near Thrace or Georgia to stop barbarians from spawning there.
     
  5. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    Thanks :)

    What is the difference between Normal and Broader regions? I noticed there actually grouped together in the game, ie in the region tooltip, you always see Broader, whether it's actually Normal or Broader.

    So far I only gathered that Normal regions give +5 for AIWars and Broader only +2. Then the major difference occurs in the case of respawn, since Normal regions can be flipped.

    Any other difference I missed?
     
  6. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Edead, thanks for this great guide, it was really helpful in importing some SoI features into my mod. My question is this: Do you have/ can you make a list of the all the areas in the code involved in making the kill the infidels option and in making the religious persecutor?
     
  7. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    It's RFC-compatibility/leftover really. From human player's POV there's pretty much no difference, that's why I streamlined Rhye's three zones into two. Apart from what you noted, there's also spawn plot search mechanic, i.e. if a civ can't spawn in its core, it will try to flip/spawn in normal area, then if that fails, a settler should spawn in free broader area (doesn't really happen in SoI). There are also tiny differences in stability mechanics, but nothing that should concern a player. Stuff like, city in Broader area is more likely to go indep than in Normal etc.

    I'll try to in 1-2 days when I get more time (the two are spread over a dozen files)
     
  8. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    Okay, thanks. I think I'll try my hands at changing this stuff, if only to understand its intricacies.
     
  9. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    Something else!

    In WorldBuilder, in the Terrains tab, I can select Salt Lakes and place them even though they're graphicalOnly in the XML. In my mod, they don't appear in WorldBuilder and it actually causes significant problems since they aren't skipped; the next entry in the XML is Coast, so in WB, Coast actually places Salt Lakes!

    Did you do something to fix that?

    EDIT: Tsk! Nevermind, I found your edited bit in the DLL, in CvGameTextMgr.cpp :)
     
  10. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    How hard would it be to set everything up for a second scenario, like the 600 AD one in RFC?
     
  11. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Edead, do you know when you might get around to that request I made earlier?
     
  12. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    The decision to massacre or not is done in the DLL (popup for the player, dice roll for the AI) and passed with onCityAcquiredAndKept to Python, where you can code whatever effects you want.

    DLL:
    Right-click on CvGameCoreDLL folder, select Search... and type "massacre".
    This will list all files involved in massacre the disbelievers part. Search for the same keyword inside files to find the particular snippets.

    massacreProb array in CvRhyes.cpp is % chance that the AI will massacre the disbelievers when able.

    Python:
    1. onCityAcquiredAndKept in CvRFCEventHandler.py - extend the argsList (new var: bMassacre); this also includes call to Religions.py, and you can ignore the iVictims variable as it's for Timurid UP
    2. onCityAcquiredAndKept in CvEventManager.py and any other files that use this event handler - just extend the argsList
    3. onCityAcquiredAndKept in Religions.py has the actual massacre code; note that it has a lot of SoI-specific stuff, e.g. piety, religions and civs, so you'll have to remove or modify some parts
    4. If you reuse the part with persecution order, remember to add it to Consts.py (tPersecutionOrder = order of most hated religions, for each religion)

    Religious persecutor - later.
     
  13. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    Use Rhye's code, i.e. (re)merge all code the that checks whether Egypt is playable both in C++ & python. There's some trickery involved, like separate arrays for early and late starts, but you'll see it all in those snippets.
     
  14. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Thanks edead, you're the best! :goodjob:
     
  15. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    Alright thanks embryodead, I'll check this out.
     
  16. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Edead, there's an area in the DLL that makes bMassacre false for Orthodox/ Catholics. How come, then, it's repeated in Religions.py?

    Code:
    for iReligion in lReligions:
    				if city.isHasReligion(iReligion) and iReligion != pOwner.getStateReligion() and not city.isHolyCityByType(iReligion):
    					if iReligion == con.iCatholicism and pOwner.getStateReligion() == con.iOrthodoxy: 
    						continue
    					if iReligion == con.iOrthodoxy and pOwner.getStateReligion() == con.iCatholicism: 
    						continue
    
    What's the point of the lines above, in other words?
     
  17. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    The DLL part is responsible for the popup, so there will be no popup if you're Orthodox and the city only has Orthodoxy and/or Catholicism.

    But if it has other religions as well, once you make the decision to massacre, the Python part does the actual killing, and the above lines just make sure that if you're Orthodox and the city has, say, Sunnis + Jews + Catholics, only Sunnis & Jews will be killed.
     
  18. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Oh cool, thanks!

    Will a search for the word purge work for finding all the inquisitor stuff?
     
  19. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    I'm not even using the word purge, instead, the persecutor is called either persecutor, prosecutor or inquisitor, since persecution mechanics are a mix of my own code with that from Charlemagne scenario and RFCE. It's probably the most messy code in SoI, I mean, it works great but I'm kind of sorry for the mess :p

    CvCustomEventManager.py
    - import Religions
    - self.rel = Religions.Religions() in __init__
    - all the stuff with number 7626 in it

    Religions.py
    - eventApply7626

    StoredData.py
    - lPersecutionData, lPersecutionReligions, getPersecutionData, setPersecutionData, getPersecutionReligions, setPersecutionReligions

    RFCUtils.py
    - showPersecutionPopup, doPersecution

    CvMainInterface.py
    - parts that start with "edead: start Charlemagne inquisitor code" and "edead: Inquisitor button"
    - make sure you import RFCUtils/utils and StoredData/sd

    Consts.py
    - tReligiousTolerance, tPersecutionOrder, iInquisitor, religion consts

    CvGameUtils.py
    - AI_unitUpdate, doInquisitorCore_AI, doInquisitorMove

    CvCityAI.cpp::AI_chooseUnit
    - the code by 3Miro & myself

    CvRhyes.h
    - all RELIGION_* enums, UNIT_PROSECUTOR, UNIT_PROSECUTOR_CLASS (consistency ftw), buildProsecutorProb array

    CvDllTranslator.cpp
    - all Religion icons

    CvUnitAI::AI_update
    - persecutor code by myself + comment block by Sephi; note that the whole python callback is basically disabled for game speed, unless the unit is a persecutor; it's important if your mod uses AI_unitUpdate callback (it shouldn't, it should be done in C++ but, the hack works fine and at this point I don't feel like moving it all to C++ just so the code it neat)

    It's really a perfect example of how NOT to code new features, but my excuse is that parts of it were added successively in a timespan of more than a year, and well, it works :D
     
  20. Linkman226

    Linkman226 #anarchy

    Joined:
    Sep 14, 2007
    Messages:
    2,493
    Thanks edead! Once again you're awesome! :goodjob:
     

Share This Page