Discussion in 'Rhye's and Fall - Dawn of Civilization' started by Leoreth, Dec 14, 2013.

1. ### LeorethFriend Next DoorModerator

Joined:
Aug 23, 2009
Messages:
35,098
Gender:
Male
Location:
Faraway
How do you compile your code if you aren't using an IDE?

2. ### AOS9001Slightly over 9000.

Joined:
Oct 1, 2009
Messages:
733
Let's say I want to change the color of some civilizations, just because I like messing with things. I used to be able to do that in CivIVcivilizatininfos.xml, but it no longer seems to have an effect. Is there another place this information needs to be changed?

3. ### merijn_v1Black Belt

Joined:
Dec 29, 2008
Messages:
5,897
Location:
The city of the original vlaai
Do you have VD installed? If so, the CivInfos from VD overrides the vanilla one. So you have to change that one in order to make the changes appear ingame.

4. ### AOS9001Slightly over 9000.

Joined:
Oct 1, 2009
Messages:
733
Ah, so there was another folder, thanks.

5. ### Imp. KnoedelSimperator Knoedel

Joined:
Nov 11, 2011
Messages:
8,802
Location:
The cooler Germany
When radically restructuring the tech tree, are there any other files than CIV4TechInfos.xml, Consts.py, Civilizations.py and CvRhyes.h I have to make major changes in? (Apart from all the .xml files for units, buildings etc. for the actual effects of techs of course)

6. ### OzzyKPEmperor

Joined:
Dec 16, 2000
Messages:
1,729
Location:
Washington, DC USA
I'm interested in the answer to this question as well. And for radically restructuring civs, leaders, buildings, units & religions as well.

But your post about Consts.py, Civilizations.py and CvRhyes.h is certainly helping me!

Joined:
Aug 23, 2009
Messages:
35,098
Gender:
Male
Location:
Faraway

8. ### h0spitall3rzGrand Vizier of Your Mind

Joined:
Aug 2, 2015
Messages:
487
Gender:
Male
Location:
Hanseong, Great Korean Empire
The main files that need updating when restructuring the tech tree are those you mentioned. But other Python and C++ files also contain some references to techs which may have been renamed or removed. For the Python, usually RiseAndFall.py, RFCUtils.py, RFCEventHandler.py, DynamicCivs.py, Victory.py. Not sure about the C++ ones. I advise to look into each file that possibly contains tech references and update them accordingly.

Imp. Knoedel likes this.
9. ### LeorethFriend Next DoorModerator

Joined:
Aug 23, 2009
Messages:
35,098
Gender:
Male
Location:
Faraway
Memes aside, using e.g. Notepad++ directory wide search is the best possible method to reliably find all references to e.g. an XML key, a Python constant or a C++ constant. Since both of you already mentioned familiarity with those three components and how they are related you really have everything you need to find the rest using Ctrl+F.

10. ### OzzyKPEmperor

Joined:
Dec 16, 2000
Messages:
1,729
Location:
Washington, DC USA
Thanks for suggesting the directory search, that will help.

And I certainly wouldn't say I have familiarity with those components, but I can locate them, heh. My next question is how to disentangle all of these things. I can delete anything that says Arabia or Tibet, but there is just so many different things all tangled together. It is pretty overwhelming.

I'm also not terribly sure how to read the error log. I got this in my PythonErr2.log after trying (and failing) to boot up my mod:
Code:
load_module traceback
Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 12, in ?
File "<string>", line 52, in load_module
File "CvUtil", line 12, in ?
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "Consts", line 513
SyntaxError: can't assign to ()
Traceback (most recent call last):
File "CvAppInterface", line 37, in init
AttributeError: 'module' object has no attribute 'RedirectError'
So.. looking things over (and knowing absolutely nothing about Python, or coding) my guess is that there is a problem on line 513 in Consts, and the stuff above that is just tracing the other files that referenced that line. That line had stuff about projects, none of which I want. I removed them from XML and changed the Consts line to:
Code:
iNumProjects = 0
() = range(iNumProjects)
I guess that didn't work. Should I delete it altogether? Will that cause other problems?

It also mentions CvAppInterface, I can't find that file. I did a search in the mod folder and didn't come up with anything.

11. ### merijn_v1Black Belt

Joined:
Dec 29, 2008
Messages:
5,897
Location:
The city of the original vlaai
Don't worry about that, that's normal. Just click through until you see the popup which says "in _get_code". The popups after that are important. (I rapidly click through the popups until I see "in _get_code".)

Hint: You can find a log of the python error in the logs. (Usually found in Document/My games/BTS/logs)

Below is a snippet of my PythonError.log. As you can see, the the first few are the same as the ones in you screenshot. You always get them when you make a python error and can ignore them. The interesting part starts after "File "<string>", line 13, in _get_code". It appears I made a mistake in Areas.py, in line 27 and it was a syntax error. (I forgot a semicolon at the end of the if-statement on purpose to force this error)

As you can see, I only need the last part to determine the error. Unfortunately in the case of those error popups that means that you have to click through a few of them as the interesting ones always come last.

Code:
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 52, in load_module
File "CvRFCEventManager", line 11, in ?
File "<string>", line 52, in load_module
File "CvEventManager", line 12, in ?
File "<string>", line 52, in load_module
File "CvScreensInterface", line 3, in ?
File "<string>", line 52, in load_module
File "CvMainInterface", line 10, in ?
File "<string>", line 52, in load_module
File "RFCUtils", line 10, in ?
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "
Areas
", line
27

if True

^
SyntaxError
:
invalid syntax


Last edited: Jun 27, 2019
12. ### OzzyKPEmperor

Joined:
Dec 16, 2000
Messages:
1,729
Location:
Washington, DC USA
Ok, I removed the project line and it worked! Did some debugging and it seems to be ok with my Consts.py file! Now it has problems with some other files, but that's ok, I'm moving forward!

A new question though, if I'm using a different map but I'm not ready to deal with setting it up with the Rise & Fall system, can I just delete files like Areas.py and SettlerMaps.py and RiseAndFall.py? Or would that screw things up too much?

Ah heck, hold my beer, I'm about to find out..

13. ### merijn_v1Black Belt

Joined:
Dec 29, 2008
Messages:
5,897
Location:
The city of the original vlaai
If you do it very thoroughly, it will work in theory. But then you have to make sure it is removed from all python files, all xml files and all C++ files to be sure. In general, it is easier to leave all in and just disable functions that are related to them.

For example, one could remove anything that says arabia to remove them from the game. But it is much easier to just disable Arabia from spawning. All other code that is related to Arabia will not execute because Arabia needs to be alive for that.

What are you trying to mod in that you want to remove something completely?

Your assumption is right. Line 513 of consts.py caused the error.

If you deleted all projects from the XML, you can simply completely delete the
Code:
iNumProjects = 0
() = range(iNumProjects)
from Consts.py. (Or just comment out the original code)
EDIT: I see you solved it yourself.

You can ignore CvAppInterface. You don't need it for fixing python errors.

Anyway, trying out yourself is the best way to learn modding. That is how I learned modding myself.

Last edited: Jun 26, 2019
14. ### merijn_v1Black Belt

Joined:
Dec 29, 2008
Messages:
5,897
Location:
The city of the original vlaai
I wouldn't remove those. It will cause a lot of errors in other files, because these files are used by other files. It is easiest to just use the current files and keep them as placeholders until you are to the point to deal with them.

That is also what we do while working on the big map. We only made the minimal changes required to make the big map run without errors. Everything else is still old code used as placeholder.

15. ### OzzyKPEmperor

Joined:
Dec 16, 2000
Messages:
1,729
Location:
Washington, DC USA
After a 10 year hiatus I've restarted work on my These Fractured States of America mod. After getting a lay of the land it looked like DoC was a good mod to use as a base (with the perhaps naive hope that it is easier to remove content from an existing mod than add features to a new one). It'll be a North America map and restricted to a specific timeline (roughly 1850 to 1930) so civs, techs, buildings, and units that don't fit there need to go, as well as stuff about India's spawn location, etc since it won't exist.

If I'm barking up the wrong tree, or going about things in the wrong way, I'd love some advice. I'm really new/bad with Python (not great with XML either, heh), so this is all a very heavy lift for me. Lord knows why I'm even trying to restart a never finished 10 year old mod in the first place, but I keep coming up with ideas that I'd love to see put into action and think this is a fascinating time period to drill down on and explore with a full featured mod.

Enyavar likes this.
16. ### LeorethFriend Next DoorModerator

Joined:
Aug 23, 2009
Messages:
35,098
Gender:
Male
Location:
Faraway
That's good to know for context. Your approach isn't bad, but I think you are changing too many things at once. For example, Python constants only map to actual XML values by convention, so unless you want to use them, you can leave them unchanged without errors. Of course, if your game has a bunch of different civs at least that needs to be adjusted, leading to more subsequent changes that are required. But imo you should focus on getting that running first before doing things like deleting projects etc.

I'm not sure if using DoC as a base is a good idea because it does a lot of stuff that is custom to the map and the civs in the game, and it seems hard to untangle all that code from the rest that you want to keep. But I don't have a better idea for what to use instead either.

1SDAN and Jarlaxe Baenre like this.
17. ### OzzyKPEmperor

Joined:
Dec 16, 2000
Messages:
1,729
Location:
Washington, DC USA
I started out just trimming the XML and the art files, but then the game didn't load so I figured my cuts must have triggered some problem in Python, so I went searching there for things to cut.. and kept going. At least I was getting some workable information in the error log after my Python cuts. I moved back all the original Python and I get this error report (and I don't see what the issue is):
Spoiler :
Code:
sys.path = ['..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\email', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\encodings', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\build', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\colourchooser', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\editor', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\floatcanvas', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\masked', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\mixins', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\lib\\ogl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\af\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ca\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\cs\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\da\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\de\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\el\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\es\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\eu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\fr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hi\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\hu\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\id\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\it\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ja\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\lv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nb\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\nl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\pt_BR\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\ru\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sl\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\sv\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\tr\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\uk\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_CN\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\locale\\zh_TW\\LC_MESSAGES', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\py\\tests', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM\\wx\\tools\\XRCed\\src-images', '..\\WARLORDS\\ASSETS\\PYTHON\\SYSTEM']

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')
..\WARLORDS\ASSETS\PYTHON\SYSTEM\xmllib.py:9: DeprecationWarning: The xmllib module is obsolete.  Use xml.sax instead.
21:36:30 DEBUG: BugConfig - registering xml handler BugConfig.RootHandler
21:36:30 DEBUG: BugConfig - registering bug handler BugConfig.BugHandler
21:36:30 DEBUG: BugConfig - registering config handler BugConfig.ConfigHandler
21:36:30 DEBUG: BugConfig - registering arg handler BugConfig.ArgHandler
validate import failed
21:36:32 INFO : BugCore - creating uninitialized mod MainInterface
21:36:32 INFO : BugCore - creating uninitialized mod Core
21:36:32 INFO : BugCore - creating uninitialized mod NJAGC
21:36:32 INFO : BugCore - creating uninitialized mod Scores
21:36:32 INFO : BugCore - creating uninitialized mod CityScreen
21:36:32 INFO : BugCore - creating uninitialized mod PLE
21:36:32 INFO : BugCore - creating uninitialized mod Reminder
21:36:32 INFO : BugCore - creating uninitialized mod Advisors
21:36:34 INFO : BugCore - creating uninitialized mod MapFinder
21:36:34 INFO : BugCore - creating uninitialized mod AutoSave
21:36:34 INFO : BugCore - creating uninitialized mod BUFFY
21:36:34 INFO : BugCore - creating uninitialized mod StrategyOverlay
21:36:34 INFO : BugCore - creating uninitialized mod CustDomAdv
21:36:34 INFO : BugCore - creating uninitialized mod TechWindow
21:36:34 INFO : WidgetUtil - WidgetTypes.WIDGET_PEDIA_JUMP_TO_RESOURCE = 187
21:36:34 INFO : WidgetUtil - WidgetTypes.WIDGET_ESPIONAGE_SELECT_PLAYER = 188
21:36:34 INFO : WidgetUtil - WidgetTypes.WIDGET_ESPIONAGE_SELECT_CITY = 189
21:36:34 INFO : WidgetUtil - WidgetTypes.WIDGET_ESPIONAGE_SELECT_MISSION = 190
21:36:34 INFO : WidgetUtil - WidgetTypes.WIDGET_GO_TO_CITY = 191
21:36:34 DEBUG: BugUtil - extending BugEventManager.preGameStart instead CvAppInterface
21:36:34 DEBUG: BugEventManager - adding event 'PreGameStart'
21:36:34 DEBUG: BugEventManager - adding event 'BeginActivePlayerTurn'
21:36:34 DEBUG: BugEventManager - adding event 'SwitchHotSeatPlayer'
21:36:34 DEBUG: BugEventManager - adding event 'LanguageChanged'
21:36:34 DEBUG: BugEventManager - adding event 'ResolutionChanged'
21:36:34 DEBUG: BugEventManager - adding event 'unitCaptured'
21:36:34 DEBUG: BugEventManager - adding event 'combatWithdrawal'
21:36:34 DEBUG: BugEventManager - adding event 'combatRetreat'
21:36:34 DEBUG: BugEventManager - adding event 'combatLogCollateral'
21:36:34 DEBUG: BugEventManager - adding event 'combatLogFlanking'
21:36:34 DEBUG: BugEventManager - adding event 'playerRevolution'
21:36:34 DEBUG: BugInit - game not fully initialized
PY:OnInit


The other files in the logs folder don't seem to have any other details. So I'm stumped.

It is looking like it'll be hard to untangle.. *sigh* It has some nice features I'd like to use (stability, immigration, passive spread of corporations, great statePlsmen, slavery, and the possibility of having additional states seek indepdendence), more importantly though I suppose is this thread and the active community to hopefully help out a newbie like me. Plus, I’ve always had a soft spot for Rhye’s and Fall (you’ll notice my name listed in the BtS credits as a beta tester for the mod).

But yea, you're probably right that the parts of DoC I wouldn't need are pretty central to it. More to cut than to keep. I was also considering Legends of Revolution since it is comparatively simpler and isn't overstuffed with content I'd need to remove. I dunno.

Last edited: Jun 26, 2019
18. ### Jarlaxe BaenreEmperor

Joined:
Feb 17, 2010
Messages:
1,959
Location:
What would be easier would be reimplementing those features in a mod from scratch, I think.

1SDAN likes this.
19. ### SunFraChieftain

Joined:
Jun 25, 2019
Messages:
7
Gender:
Male
Hello everyone,
Working on the 1.15 version, I noticed that there is no FounMap for the Mughals in the CityManager file.
Is it simply possible to add it by writing iLangMughals : and then pasting a copied "-1" frame ?
Thanks

20. ### LeorethFriend Next DoorModerator

Joined:
Aug 23, 2009
Messages:
35,098
Gender:
Male
Location:
Faraway
The short answer is yes. If you keep the existing languages for the Mughals in the priority list, everything will work. If you don't, you also need to make sure the new language covers city renaming.

Mughal city names are currently covered as part of the Persian language, with Arab and Indian names as fallback.