Fixing the Mac version's bugs

jmerry

Warlord
Joined
Jan 21, 2010
Messages
122
The Mac version of BtS came with Rhye's and Fall included as scenarios. Unfortunately, there are some bugs. I'm doing my best to fix them, with the limit that only XML and Python are accessible.

Major bug #1: With the 3.19 update (and Rhye's to 1.185), autoplay broke.
Fix: I've grafted in a bit of code in the CvDawnOfMan.py file, explicitly calling CyGame.setAIAutoPlay(iNumAutoPlayTurns) (in the interfaceScreen function).
Results: Autoplay now works, including the loading bar. On the other hand, this triggered some debug code elsewhere, and spawned a catapult at (0,0) for the human when autoplay ends. The only code I can find that does something like that is in CvRFCEventHandler; the trigger conditions (involving keypresses) clearly aren't met, and the catapult spawns even if this block is commented out. I don't understand.

Major bug #2: For all players in all eras, cities built start at size 1 with no infrastructure.
Fix: Easily enough fixed in Python; I can add buildings and population in OnCityBuilt. It would be nice to know exactly what I should add.

Major bug #3: The Japanese UP doesn't work; their units get no bonus of any kind.
Fix: I think the units should all get CG1; I'm just not quite sure where to best do that, or if any unit classes should be excluded.

[Added in edit]
It appears that the Spanish, English, and Portuguese UPs don't work either. Are those done with promotions as well?
 
OK, adding free promotions is easy in the XML- just make a trait for it, and give it to the appropriate leaders. With an empty description, it doesn't show up on the leader selection screen.

I still need some feedback on what these aspects are in the correct version; I can't fix something if I don't know what's right.

One more possible bug: I'm very suspicious of the Mayan UP. Some data from a bit of WB-assisted testing, with Ethiopia as a control group:
Code:
Tech   M1   E1   M2   E2   M3   E3
Arch  171  162  101   95  123  123
MetC 1289 1224  858  845  930  930
CivS 2522 2395 1821 1821 1821 1821
Lib  4728 4491 3415 3415 3415 3415
M1/E1: initial cost, as shown in tech advisor screen
M2/E2: after adding Astronomy via WB
M3/E3: after removing Astronomy via WB
All data from first turn active, before settling, Monarch difficulty.
I don't think it's doing anything, and the dynamic tech cost calculation isn't in the XML or Python where I can mess with it.
 
Step 1: get Xp/Windows 7
Step 2: Get Civilization 4 Complete Edition
Step 3: Install OS (bootcamp)
Step 4: Install Civ 4
Step 5: Patch
Step 6: Install RFC
 
it runs much better in OS X. I don't really mind holding the enter key until it's my turn (although it would be good to not have to)...
 
To civ_king: Shut up. This thread is about fixing the officially released Mac version of the mod, not replacing it with the Windows version. Why post here and not in the Mac Civ4 forum? Because I need input on how things are supposed to work. It's hard to fix bugs when you don't have a non-bugged version to compare to.

To antaine: I've got a patch for that: replace CvDawnOfMan.py with this. Instead of holding the enter key, all you have to do is delete one Antarctic catapult.

Continuing the bughunt: France's attitude adjustment is broken- England, Spain, and Germany are cautious on first contact. How big of a bonus is it supposed to be?

The trait-based fix for the promotion UPs works, but it's a little ugly; hovering over a leader in the score display shows () in their description where other leaders have a blank line. I tried to do it in Python instead, but I haven't gotten it working so far.
 
In reading the thread, I thought your patch also caused other issues with cities and UHVs. I was just going to wait until all that was worked out.

Is it that those bugs are in the Mac version regardless? Honestly, I'm all about the alternate history, so I really haven't been playing Rhye's until I would be finished with making my favorite civ (the Celts) a playable option...

Is it possible to also write code to delete the unit at 0,0 and re-hide the revealed tiles for the human player? Another couple of lines might solve the problem...
 
I tried to fix it but I failed horrifically so I resorted to what I said, I'm writing this in Safari on a MacBook running Snow Leopard, I know that OSX is VASTLY better than Windows, I do applaud your valiant efforts,


what in particular did you want to know about Normal RFC?
 
- antaine: My patch does absolutely nothing except enable autoplay until your start. It shouldn't cause any other issues. Yes, I'll get rid of that catapult in a later version, once I understand more about why it's there in the first place. The other stuff in that thread- I've never seen it in the first place.

- civ_king: What do I want to know?
First, exactly what do all of those UPs I mentioned as broken (Japan, Spain, England, Portugal, France) do? I can guess, but I want confirmation.
Second, what exactly do you get when founding a city with a later civ?
All of that stuff should be pretty easy to fix. The Chinese and Mayan UPs are harder; the cost calculations are hidden away somewhere.
 
The AI Autoplay function that come with the game (which you used) is actually a debug function. If you use it in a normal game you'll see that it kills all your cities and units, moves the game forward by the given number of turns, and then generates a unit at (0,0) so you don't die and get booted to the main menu. Presumably Firaxis used it to test the AI.

France's UP doesn't appear broken. You're not supposed to get the attitude bonus with European civs.

Many of the UPs, and a ton of other things, are implemented in the SDK in the Windows version. I have no idea how they are done on the mac version.
 
Thanks for the clarification on France. Yes, Arabia, Khmer, China, and Japan are all pleased on first contact (I WB'd in some scouts).

Actually, the AI Autoplay function was also used in the Barbarian scenario for Warlords. It may have been a little different then; I don't see any code to get rid of extra units.

The Mac implementation of the SDK stuff and anything in the DLL is compiled, and shows up as a different program (My recent apps list includes "Civilization IV Beyond the Sword - Rhyes and Fall"). It's there, but basically inaccessible to ordinary modders. Most of it works. Some of it is broken, but it's stuff that the XML or Python can easily do. Then there's a bit that's broken and can't be easily fixed; in particular, the Mayan and Chinese UPs, which modify costs.
 
- antaine: My patch does absolutely nothing except enable autoplay until your start. It shouldn't cause any other issues. Yes, I'll get rid of that catapult in a later version, once I understand more about why it's there in the first place. The other stuff in that thread- I've never seen it in the first place.

- civ_king: What do I want to know?
First, exactly what do all of those UPs I mentioned as broken (Japan, Spain, England, Portugal, France) do? I can guess, but I want confirmation.
Second, what exactly do you get when founding a city with a later civ?
All of that stuff should be pretty easy to fix. The Chinese and Mayan UPs are harder; the cost calculations are hidden away somewhere.

off the top of my head
*Japan=City Guard I for Melee (for sure) and Archery I think
*England=Drill I&II for ships
*Spain=Navigation I&II for ships
*Nederlands&Portugal the one that claims to be able to see further gets Sentry and the other one can pass through borders with ships
 
The Mac implementation of the SDK stuff and anything in the DLL is compiled, and shows up as a different program (My recent apps list includes "Civilization IV Beyond the Sword - Rhyes and Fall"). It's there, but basically inaccessible to ordinary modders. Most of it works. Some of it is broken, but it's stuff that the XML or Python can easily do. Then there's a bit that's broken and can't be easily fixed; in particular, the Mayan and Chinese UPs, which modify costs.

I've been trying to mod my Mac Rhye's and Fall using TextEdit and then compiling it with Visual C++ in XP that I'm running on Parallels. I keep running into a problem, however. I've described it in the thread I linked below. Anybody that mods have a solution?

http://forums.civfanatics.com/showthread.php?p=8836921
 
Progress report:
I've got the promotion UPs implemented as traits (Japan: CG1 for melee, archery, gunpowder, siege, mounted, armor, and helicopters. England: Drill 1 and 2 for naval. Spain: Navigation 1 and 2 for naval. Portugal: Sentry for naval); every leader now has a trait, named to match their civ (because I don't like seeing those empty parentheses). Most of those traits do absolutely nothing.
China's trait grants +50% production for melee and gunpowder units, as listed in their unique power description. This isn't exactly the same as the 2/3 cost they should be getting, but it's close enough.
The Maya are tougher, with the reduced cost not working. I'm going with +100% research instead, which is slightly stronger when self-researching and much weaker when buying techs. I've tried a trait-based implementation: Pacal's trait grants +100% science, and then I switch to a leader with no bonus on picking up any first-tier Renaissance tech. In testing... the switch happens, and the bonus is sticky. The "+100%" line disappears, but a capital with 11 base commerce and no library adds 22 beakers. Argh.
The alternative? Buildings, and I'll have to remove them with a Python script because you can't have multiple obsoleting techs.
In either case, the added building or leader will have an autogenerated civilopedia entry. Ugly, but basically unavoidable with the limits of what I'm working with.

I'm still looking for confirmation on the late-founded city bonuses. From the discussion I've seen and the changelog, the European medieval and later civs get a bit of population and several free buildings- but as far as I can tell, the whole thing isn't written down in one place anywhere.
 
OK, I'm almost ready to release. One bug to track down: when I added a building for the Mayan UP, the embassies broke a little. The embassies are one step later in the buildings XML file, and Consts.py has been adjusted accordingly- but now the embassies don't line up with the right contacts. For example, contact with China allows me to build an Indian embassy in the 600 AD scenario. Once an embassy is built, it maintains contact with the listed civ; it's the initial build that's trouble.
Is there a hardcoded call somewhere, possibly where I can't get at it? Where's the code that says when you can build an embassy, and what does it look like?
The alternative is to move the new building to after the embassies. If I do that, it works but also picks up a description line "Establishes permanent contact with this civilization". Where does that line get added?

On the other stuff, most of the UPs I did as traits have been moved to the Python, now that I know how to activate onUnitCreated. I'm still leaving the traits in, and they now have help tips describing the unique power.
 
Top Bottom