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

RevDCM + UniqueCivics merged - almost!

Discussion in 'Civ4 - SDK/Python' started by Ferocca, Apr 10, 2013.

  1. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Well I somehow managed to almost succesfully merge RevDCM:
    http://forums.civfanatics.com/showthread.php?t=262937
    with the Unique Civics mod:
    http://forums.civfanatics.com/showthread.php?t=414722

    In the Sevopedia for example, everything works already, except, which seems very weird to me, the section that shows the improvements. I am 90% sure it causes the real major bug: no unit action buttons in the interface (and therefore the 'southern interface' is useless anyway, while you of course need it to play). Python exceptions told me the unit interface does not show because it cannot draw the action buttons - probably the worker's action buttons if you ask me (you know, no improvements in the Sevopedia while everything else works sublime).

    I was able to test the rest though with AI autoplay, and as I said, it seems to be working, just this one major interface bug.

    The problem is: I can merge XML, Python and SDK (if simple), but I cannot write/edit any Python/C++ code. So I'm asking for your help with this bug. I can compile/run Debug.dlls and all the other fancy stuff, so it shouldn't be too hard to help me (I hope). The debug dll didn't tell me anything about this bug though, only python exceptions did.

    There is a lot of extra stuff in 'my RevDCM', but I never changed its SDK nor python until now, so that doesn't matter if you just look over that.
    Basically, I managed to merge it, I just need someone's help to fix the mistakes I made.

    If you need more details or the almost-finished mod, tell me, and I can provide information/upload the mod so you can see everything for yourself.
    - Also I am not sure if the bug is caused by SDK or python, but I bet it's SDK affecting the python in a bad way. Most changes were made in SDK after all. I just find it strange that a mod that adds a class, a civic class, messes up with action buttons/the unit interface/the improvements.

    P:S: The only other thing I expect to cause errors is if a Revolution asks you to change civics - to Free Speech for example - and you have a UC replacing Free Speech. Why? Because I only merged, I didn't edit much, so all the stuff about civics in the Revolution files is probably still about Civics instead of Civic classes. If someone could check that too for me, that'd be great.

    P:S:S: If you read that all I can thank you too, no matter if you can help. But yeah, I really hope for help here, since the merge is so close to success.
     
  2. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    I can also rephrase the question like this:
    Which .ccp/.h-files control the (unit) interface/action buttons exactly?
     
  3. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    You should at least post the python error messages (or the Documents\My Games\Beyond the Sword\Logs\PyDebug.log file) and upload the files you changed, I could look over that (but I'm probably too short of time to really test it).

    But it will most probably require programming to get it really working, because of exactly the thing you said, the civic references in the stuff added by RevDCM.
     
  4. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Thanks for taking a look into this:)

    The error that python exceptions tells me indeed tells me it's a C++ error:

    Traceback (most recent call last):

    File "CvScreensInterface", line 975, in forceScreenRedraw

    File "CvMainInterface", line 1339, in redraw

    File "CvMainInterface", line 2586, in updateSelectionButtons

    RuntimeError: unidentifiable C++ exception
    ERR: Python function forceScreenRedraw failed, module CvScreensInterface

    And I added the changed files in the attachment; in case you need it: here you can find the source for Unique Civics:
    http://forums.civfanatics.com/showthread.php?t=414722
    and RevDCM:
    http://forums.civfanatics.com/showthread.php?t=262937
     

    Attached Files:

  5. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    I also need the changed python files :) (or at least CvMainInterface, so I can identify the C++ function that causes the error).
     
  6. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    Edit: Just saw UC does not change CvMainInterface.

    But you should either way upload your complete work, so people can test it.

    Edit2: a similar issue has been discussed here.

    Maybe you forgot to add the UC art or messed around with art in any way?
     
  7. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Ah okay, here you go:)

    Notes that I suddenly recalled to be important:
    I replaced the RevDCM-CvCivicsScreen with the UC-CvCivicsScreen instead of merged.
    CvPediaCivilization merged into SevoPediaCivilization.
    CvPediaLeader merged into SevoPediaLeader.
    CvMainInterface actually hasn't been changed by me at all!
    I uploaded it anyway of course, all in the attachment.
    I also uploaded CvScreensInterface because it was mentioned in the python error log.

    Thanks again!
     

    Attached Files:

  8. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Oops, looked over your new message.

    I will upload the complete work;)

    I had found that particular thread and I'm sure he has the same error as I do, but he didn't get it solved either (in that thread at least) - I definitely didn't mess up anything with nifs/kfms.
    I runned CivChecker and that didn't give any errors regarding art from UC.
    The only art in UC are two Civic buttons anyway;)

    But I will upload the mod now so that we might be able to stop guessing:)
     
  9. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Okay, I uploaded it here:
    http://www.atomicgamer.com/files/103782/revdcmuc
     
  10. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    You probably didn't merge the RevDCM makefile. It sets some flags that seem to be needed.
    (I gradually removed the UC stuff; and after I removed it totally and still had that errror, I suspected something around the compiling process :))
     
  11. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    First I'd like to say: I had no idea you had to merge makefiles too; I thought they were all the same. Silly me.
    Second of all: it worked!
    And last but not least: thank you so much! I am really grateful for this, and if it turns out to work 100% after solid testing, other people will too (because some people requested this merge several times). Just thanks a lot for your time and effort!
    Now I can finally do the fun part: making a unique civic for every civ!
     
  12. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    I thought that, too :)

    Also, I forgot: In CvInfos.cpp, you accidently overwrote a "XMLCOPY" section, I think it was at the end of CvCivilizationInfo.read(xml).
     
  13. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    If you use Asaf's makefile, it should automatically pick up any new C++ files on compile without any makefile editing needed.
     
  14. lfgr

    lfgr King

    Joined:
    Feb 6, 2010
    Messages:
    727
    I were using Danny Daemonic's fast makefile (I believe it's the same as in asaf's guide), the same I use to compile MNAI.

    The only difference (despite some simple changes regarding where to copy the compiled dll) was that RevDCM added some flags:
    Code:
    (...)
    (Added:)
    [B]Debug_GLOBAL_CFLAGS= /D_MOD_SENTRY /D_MOD_FRACTRADE /D_MOD_GOVWORKERS /DLOG_AI /D_MOD_GWARM /D_MOD_SHAM_SPOILER
    Final_Release_GLOBAL_CFLAGS= /D_MOD_SENTRY /D_MOD_FRACTRADE /D_MOD_GOVWORKERS  /D_MOD_GWARM /D_MOD_SHAM_SPOILER[/B]
    (...)
    (Changed:)
    Debug_CFLAGS=/MD /Zi /Od /D_DEBUG /RTC1 /Fp"$(Debug_PCH)" $(GLOBAL_CFLAGS) [B]$(Debug_GLOBAL_CFLAGS)[/B]
    Release_CFLAGS=/MD /O2 /Oy /Oi /G7 /DNDEBUG /DFINAL_RELEASE /Fp"$(Release_PCH)" $(GLOBAL_CFLAGS)  [B]$(Final_Release_GLOBAL_CFLAGS)[/B]
    (...)
    
    I worked with some RevDCM-based mods (mostly yours and Legends of Revolutions), but I think I never needed that, and I don't know why it fixes the error discussed, which is in the exe (if I concluded right).
     
  15. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Okay, it took a while, but after merging the makefile I've also added all Unique Civics now to the Civilizations. I also fixed a few text display bugs in the SDK now I was there anyway. I had it tested by AIAutoplay a lot and there's not much left to do :)

    There are two things that don't work properly yet, but I already figured out they can be fixed through python, the SDK and XML work is done :)

    1. The Revolutions-system doesn't really read the Unique Civics as Uniques. Example: the Romans have the civic 'Senate', which is the same as Representation and also replaces it, but is available at Code of Laws already. What happens now, is that when you research Code of Laws with another Civ, it'll make your empire very unstable because it reads that another Civic with a higher 'RevDemocracyLevel' is available, and it will request you to change to Senate. When you accept, it shows that that part isn't broken: you succesfully switch civics through the Revolutions system. The problem is though, of course, that you switch to the UniqueCivic of another Civilization and it makes everyone unstable.
    In short: some Civic-references in the python have to become CivicClass-references.

    2. The Civic-trading system has gone cranky. I can't really explain what's wrong exactly, but it's bad: for example, you can persuade another Civ sometimes to switch to Environmentalism when you don't have Environmentalism yourself, not even available (for the other Civ neither).

    In the attachment I attached the almost-finished mod, + 2 documents. One is the UniqueCivics readme file, which explains which new Python commands have been added and replaced. The other file I made myself to make it easier - I looked up which files use any references to Civics that could have to be changed.

    Keep in mind that not everything should get replaced by CivicClass instead of Civic! That's exactly why I hope someone with python skills + experience in playing RevDCM can help me with this...

    If you need me to give even more information or the new source code anyway, don't hesitate, of course I want to help the people that want to help me:)

    'Attachment':
    http://atomicgamer.com/file.php?id=103895
     
  16. Ferocca

    Ferocca Warlord

    Joined:
    Nov 21, 2011
    Messages:
    162
    Problem 1 has been solved, it was a simple change in RevCivicsUtils - although it would be good if someone checked if it doesn't still secretly increase instability points by reading that there are more stable civics available (because that's what it's supposed to do, but it's not supposed to read the uniquecivics!).

    Still hoping someone can take a look at problem 2. I figured out it has something to do with the way it loads civics. I'll explain:
    It was totally messed up when I listed the civics in the XML like this:

    Despotism
    Unique Despotisms
    Hereditary Rule
    Unique Hereditary Rules
    Representation
    Unique Representations
    ... etc.

    But When I list it like this:
    Despotism
    Hereditary Rule
    Representation
    ...
    Free Religion
    - and then I add al Unique civics at the end of the list;

    the Civic-trading system is not that messed up anymore. The only mistake it makes in that case is that when another Civ has a UniqueCivic you can try to convince the other Civ to switch to their own Civic, even if they already are using it! You sould be able to ask them to switch to their CivicCLASS, not their Civic, and if they are already using it you shouldn't be able to ask them to switch at all...

    But this should help a possible helper, I suppose:)

    [Oh, and last but very minor bug I found is that when you grand a territory indepedence it always copies all the civics of its former owner - including their UniqueCivic though, while this should be the CivicClass again! I bet this can be fixed easily in Revolution.py though.]
     

Share This Page