Quick Modding Questions Thread

Basically the compiler is the program that takes your code in C++ (or any other language) and translates it into machine instructions that are than packed into a DLL or EXE file. And as languages evolve, and they do, the compiler evolves with them. And each program is built around a specific version of its language compiler which was current at the time of the programs creation.

So you need the compiler that the original team used or else you won't be able to get the thing translated.
 
the main question is how you will create CVgamecoredll today
Find the old visual studio version on the internet and use that. From what I understand the community version is perfectly legal to download as it was handed out for free by Microsoft in the first place.
 
I am green in sdk i don't know what did I do wrong
1714155543248.png
 
Honestly, debugging a compiler setup from a far like this is very difficult. Did you download everything correctly, get the proper version of visual studio and the compiler and follow the instructions to the letter?
 
In that case, you'll need to obtain and compile the source code of DCM's CvGameCoreDLL.dll. Which version of DCM specifically (hyperlink?)? This might work with the Makefile and Visual Studio project files from one of the DLL guides, but it could also be that DCM has modified those files. If you can get it to compile at all, then changing the player limit shouldn't be difficult (MAX_CIV_PLAYERS in CvDefines.h). RevDCM already seems to allow up to 50 players btw.
 
i marge my mod with RCMrevolution and i have problems
Zrzut ekranu z 2024-04-28 19-27-19.png
 

Attachments

  • CvXMLLoadUtilitySetMod_MLFEnumerateFiles.7z
    432 bytes · Views: 1
Seems that Assets\XML\BasicInfos\CIV4BasicInfoSchema.xml should declare Civ4DCMConceptInfos. In my local copy of RevDCM it says
Code:
<ElementType name="DCMConceptInfos" content="eltOnly">
	<element type="DCMConceptInfo" maxOccurs="*"/>
</ElementType>
somewhere. If that's also the case in your version, then I don't see what is causing the error.
 
Honestly I would advise you to just download the regular vanilla DLL, follow the tutorial and get everything running. And once you have compiled the base DLL and are satisfied your pipeline works than you can advance to specific mods. That's what I did.
 
Very thank you answer, but i find dcm for 3.19 and expand max civis i compile new dll
Yeah, I could see how merging your XML changes with RevDCM will be more difficult than re-compiling the DCM DLL.

If it's this one – specifically the final relase version 2.6 – then it seems that the creators have only uploaded the two dozen C++ files that differ from the original BtS GameCore DLL. Meaning that getting the original DLL source to compile would indeed be a good preliminary step. Afterwards, I guess these files are supposed to replace some of the original files. Those are from May 2014 (revision 15), the next revision is from (late) July, which is already later than the 2.6 release (June). It's probably important to get the version of the source code that matches the DCM version you have installed.
 
Why doesn't this code work? Any ideas?

Code:
    def onBuildingBuilt(self, argsList):
        'Building Completed'
        pCity, iBuildingType = argsList
        game = gc.getGame()
        

        if iBuildingType == gc.getInfoTypeForString("BUILDING_PETRA"):
            pPlayer = gc.getPlayer(pCity.getOwner())
            pTeam = gc.getTeam(pPlayer.getTeam())
            pTeam.setHasTech(gc.getInfoTypeForString("TECH_POLYTHEISM"), True, pPlayer, True, True)
 
In the final line, it probably needs to be: pPlayer.getID()
If that doesn't do it, I'd insert print statements (writing to PythonDbg.log) for tracing the execution, maybe also printing the info-type-for-string IDs.
Edit: Doesn't the current code throw any exception (PythonErr.log)? Logging needs to be enabled through CivilizationIV.ini, might also be a good idea to enable exception popups – if that's not already the case. Though the popups can get annoying as every stack frame results in a separate popup.
 
Last edited:
Doesn't the current code throw any exception (PythonErr.log)?
Code:
sys.modules = {'zipimport': <module 'zipimport' (built-in)>, 'signal': <module 'signal' (built-in)>, '__builtin__': <module '__builtin__' (built-in)>, 'sys': <module 'sys' (built-in)>, '__main__': <module '__main__' (built-in)>, 'exceptions': <module 'exceptions' (built-in)>, 'CvPythonExtensions': <module 'CvPythonExtensions' (built-in)>}

sys.builtin_module_names = ('CvPythonExtensions', '__builtin__', '__main__', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_heapq', '_hotshot', '_locale', '_multibytecodec', '_random', '_sre', '_subprocess', '_symtable', '_weakref', '_winreg', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'md5', 'mmap', 'msvcrt', 'nt', 'operator', 'parser', 'regex', 'rgbimg', 'sha', 'signal', 'strop', 'struct', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
load_module CvEventInterface
load_module CvUtil
load_module traceback
load_module CvEventManager
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "<string>", line 52, in load_module
  File "CvEventInterface", line 13, in ?
  File "<string>", line 35, in load_module
  File "<string>", line 13, in _get_code
  File "CvEventManager", line 510
    pTeam = gc.getTeam(pPlayer.getTeam())
                                        ^
IndentationError: unindent does not match any outer indentation level
load_module CvAppInterface
 
In the final line, it probably needs to be: pPlayer.getID()
If that doesn't do it, I'd insert print statements (writing to PythonDbg.log) for tracing the execution, maybe also printing the info-type-for-string IDs.
Edit: Doesn't the current code throw any exception (PythonErr.log)? Logging needs to be enabled through CivilizationIV.ini, might also be a good idea to enable exception popups – if that's not already the case. Though the popups can get annoying as every stack frame results in a separate popup.
Now it works! Thank you.
In addition to the error with player id, there was also a problem with tabs and spaces in the line.
 
I see no problem with the indentation in your snippet, but maybe that has to do with copy-pasting to your web browser. Maybe spaces mixed with tabs at or near the indicated line?
Edit: Hadn't seen your post yet; great that it works!
 
Is this the correct code? Maybe I forgot something?
This code supports the wonder that gives (or removes) dummy "bonus tech". Wonder may become obsolete.
Code:
def onBuildingBuilt(self, argsList):
        'Building Completed'
        pCity, iBuildingType = argsList
        game = gc.getGame()
## Machu Picchu Start onBuildingBuilt ##           
        if iBuildingType == gc.getInfoTypeForString("BUILDING_MACHU_PICCHU"):
        pPlayer = gc.getPlayer(pCity.getOwner())
        pTeam = gc.getTeam(pPlayer.getTeam())
        pTeam.setHasTech(gc.getInfoTypeForString("TECH_BONUS"), True, pPlayer.getID(), False, False)
## Machu Picchu End onBuildingBuilt##

def onTechAcquired(self, argsList):
        'Tech Acquired'
        iTechType, iTeam, iPlayer, bAnnounce = argsList
## Machu Picchu Start onTechAcquired##
        pTeam = gc.getTeam(iTeam)
        if iTechType == gc.getBuildingInfo(gc.getInfoTypeForString("BUILDING_MACHU_PICCHU")).getObsoleteTech():
            pTeam.setHasTech(gc.getInfoTypeForString("TECH_BONUS"), False, iPlayer, False, False)
## Machu Picchu End onTechAcquired##

def onCityRazed(self, argsList):
    'City Razed'
    city, iPlayer = argsList
    iOwner = city.findHighestCulture()

## Machu Picchu Start onCityRazed ##
    if city.getNumBuilding(gc.getInfoTypeForString("BUILDING_MACHU_PICCHU")):
        pPlayer = gc.getPlayer(iPlayer)
        pTeam = gc.getTeam(pPlayer.getTeam())
        pTeam.setHasTech(gc.getInfoTypeForString("TECH_BONUS"), False, iPlayer, False, False)
## Mache Picchu End onCityRazed ##

def onCityAcquired(self, argsList):
    'City Acquired'
    iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
    CvUtil.pyPrint('City Acquired Event: %s' %(pCity.getName()))

## Machu Picchu Start onCityAcquired ##
    if pCity.getNumBuilding(gc.getInfoTypeForString("MACHU_PICCHU")):
        pPlayer = gc.getPlayer(iPreviousOwner)
        pPlayer2 = gc.getPlayer(iNewOwner)
        pTeam = gc.getTeam(pPlayer.getTeam())
        pTeam2 = gc.getTeam(pPlayer2.getTeam())
        pTeam.setHasTech(gc.getInfoTypeForString("TECH_BONUS"), False, pPlayer.getID(), False, False)
        obsoleteTech = gc.getBuildingInfo(gc.getInfoTypeForString("BUILDING_MACHU_PICCHU")).getObsoleteTech()
        if pTeam2.isHasTech(obsoleteTech) == False or obsoleteTech == -1:
        pTeam2.setHasTech(gc.getInfoTypeForString("TECH_BONUS"), True, pPlayer2.getID(), False, False)
## Machu Picchu End onCityAcquired ##
 
Top Bottom