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

How to add a minor civilization?

Discussion in 'Rhye's and Fall Modmods' started by Bonci, Jan 28, 2011.

  1. Bonci

    Bonci Chieftain

    Joined:
    Oct 22, 2005
    Messages:
    738
    Location:
    Tridentum - Italia
    I'm trying to add a minor civilization (like celtia/byzantium and independents) to the game, I've read Jarkov's guide on how to add a civilization and i tryed to change the minimum to get the civ to work.
    So I added it in the wbs, in the consts.py and in rhyes.cpp and .h, i also increased the maxciv constant in CvDefines.h.

    Now the civ shows up if i open the wb but if i add a city for them the game crashes...i also added a city spawn in barbs.py but it never happens.

    What am I missing? :(
     
  2. Black Whole

    Black Whole Dancing Condor

    Joined:
    Dec 21, 2005
    Messages:
    534
    Location:
    Theatre of Dreams
    Okay, I know, that adding civs is quite annoying, I try to help as much as possible. From what I have understood, there could be several reasons: You didn't modify StoredData.py and RiseandFall.py (maybe Communications.py), did you? This could be necessary too... And just because it could be interesting for you: CvPlayer.cpp, CvInfos.cpp, CvGame.cpp (basically every file which has 'Rhye' in them) could be used for values modifying the minor civ (so it is weaker than regular players). For further diagnostic info, we would need a little bit more details :).
    And as for Barbs.py, could you just post the code you used?
     
  3. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    Sorry to play tech support in asking stupid questions, but did you recompile the DLL after you changed the C++ files?
     
  4. Jarkov

    Jarkov Chieftain

    Joined:
    Oct 23, 2010
    Messages:
    158
    Have you added it in the XML?
     
  5. Bonci

    Bonci Chieftain

    Joined:
    Oct 22, 2005
    Messages:
    738
    Location:
    Tridentum - Italia
    yeah! so i managed to add a minor civiliziation (i forgot to add one initializer in one array in consts.py) and it worked until i tried to add ten more :p
    then the game started crashing directly during the loading XD I guess i have to add them more gradually...

    thanks for your help :D

    oh and another quick question: i gave Jerusalem to the minor civ but when judaism should be founded the game crashes (i know the problem is this because if i give another city the game runs fine). Where can i remove the auto founding of judaism?

    here the code for the spawn of jerusalem:

    Code:
    iIsrael = con.iIsrael
    pIsrael = gc.getPlayer(iIsrael)
    
    self.foundCity(iIsrael, lJerusalem, "Yerushalayim", iGameTurn, 2, con.iArcher, 3)
     
  6. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    Have you enabled Python exceptions and logging? What messages appear in your error logs?
     
  7. Jarkov

    Jarkov Chieftain

    Joined:
    Oct 23, 2010
    Messages:
    158
    I think this is somewhere in a file called Religion.py.
     
  8. Bonci

    Bonci Chieftain

    Joined:
    Oct 22, 2005
    Messages:
    738
    Location:
    Tridentum - Italia
    sorry for the question :( but where do i find them?

    @Jarkov: thanks I found the code and commented it, but the game still crashes...there must be something else.

    Now the civ spawns correctly but I wanted to let the player contact it so i put a 0 in the "MinorNationStatus" thing in wbs. But now when i meet the civ, all the interface messes up...isn't it possible to have a "Rhyes minor civ" behave like a normal civ? :cry:
     
  9. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    Why make it a minor civ if you want it to behave like a normal civ? :confused:
     
  10. Bonci

    Bonci Chieftain

    Joined:
    Oct 22, 2005
    Messages:
    738
    Location:
    Tridentum - Italia
    not totally like a normal civ...i mean that i want it to conduct diplomacy like a normal civ. I don't want it to stay at war with everyone like a normal minor civ...
     
  11. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    You enable exception pop-ups and logging in the CivilizationIV.ini file. This is where you set most game settings, by the way.

    The actual logs are in \My Documents\My Games\Beyond the Sword\Logs\ and are called PythonErr.log and PythonErr2.log.

    There might be logs for SDK errors also, but that is currently beyond my horizon.
     
  12. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    Honest curiosity - what's the other difference between minor and major civs?
     
  13. Jarkov

    Jarkov Chieftain

    Joined:
    Oct 23, 2010
    Messages:
    158
    They aren't playable (of course, but this means they aren't represented in most of the lists or switches where the major civs are), they don't have spawn dates, they have most techs and units and buildings disabled, they will automatically make peace or declare war to major civs.
     
  14. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    Okay, now that you say it :) The disabled diplomacy is just the aspect you notice most while playing.
     
  15. Bonci

    Bonci Chieftain

    Joined:
    Oct 22, 2005
    Messages:
    738
    Location:
    Tridentum - Italia
    additionally they aren't affected by stability, don't have warmaps,settlermaps etc...
    My hope is that they don't need so much work as normal civs. So maybe if i add a bunch of minor civs they won't add too much to the loading times :)

    thanks Baldyr, i found the logs and solved (i hope) the problem! (in StoredData.py added a field to lPlagueCountdown)
     
  16. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    Can you please post the changes you made to add the minor civ? Also can you link to the guide by Jarkov that you mentioned? Thanks.
     
  17. Bonci

    Bonci Chieftain

    Joined:
    Oct 22, 2005
    Messages:
    738
    Location:
    Tridentum - Italia
    First I have to say that I'm still experiencing some random crashes so what I'm going to tell you is not complete (I still haven't found where the problem is).

    SDK
    - in cvrhyes.cpp add one field to turnPlayed and civSpreadFactor and increase the dimension of the arrays.
    - in cvrhyes.h add a define for your civ (before barbarians) and increase the dimension of turnPlayed and civSpreadFactor.
    - in cvdefines.h increase MAX_CIV_PLAYERS by one.
    - i also added some cases in cvcity.cpp to prevent minor civ cities to flip too often.

    PYTON
    - in consts.py add a field to l0ArrayTotal and initialize a iciv variable for your civ (before barbarians but after mayor civs...should be in the same place where you defined the civ in cvrhyes.h), search all the file and add fields to the arrays where independents are mentioned.
    - in storeddata.py add fields everywhere there should be the complete list of civs (not where only mayor should be in) pay attention because i suspect that my random crashes depend on something i forgot here.
    - to spawn the minor civ i use Baldyr's PyScenario

    WBS
    add your civ in the same position you defined it in consts.py and add a new team

    XML
    i used modular civs from civgold here and they work fine (you should add tags for the embassy thing)

    i hope this can help you...and sorry for my bad english *_*
     
  18. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    You could mod a clean copy of RFC:E/M without the PyScenario application, just to make sure there is no incompatibility here with using additional minor Civs.

    Minor civs can be spawned with the Barbs module - just follow the examples for the other spawns. You can always convert the actual spawn code into a PyScenario script later.
     
  19. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    Thank you for the replies. As an experiment I will attempt to add Hittites to harass the Babylonians.
     

Share This Page