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

Golden Ages are useless

Discussion in 'Civ4 - Star Trek Mod' started by apenpaap, Sep 8, 2009.

  1. apenpaap

    apenpaap Tsar of all the Internets

    Joined:
    Apr 7, 2008
    Messages:
    1,468
    Location:
    Amsterdam
    In regular civ, Golden ages increase the number of hammers and coins from tiles that produce at least 3 of those already by 1, and it gives a +100% boost to great people. However, without tiles, the only effect that remains is the extra GPP. Since you have to waste a great person to get a golden age, that's rather useless. Maybe a Golden Age should simply provide +25% commerce and +25% hammers in all cities or something like that.
     
  2. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Perhaps each planet could individually provide 25% hammers and coins? You'd alter the getExtraYield function in CvSolarSystem to multiply the current production and commerce by 5/4.

    That would be more of an effect then just doing it to all cities.
     
  3. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    So that's how golden ages work. I'll probably use TC01's solution for this.
     
  4. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    16,058
    Location:
    In orbit
    Good point. :thumbsup: (While I found Golden Age less useful than in a normal game, it hadn't occurred to me why that was...)
     
  5. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    Golden ages also allow you to switch civics (and religions, I think) without any anarchy. It's also +1 production to any tile that gives at least 1 (not 3) and the same for commerce.

    Unless you have increased the base yields, changing each planet for +25% is likely to have no effect for most of them since 5/4 * (anything from 0 to 3) is likely to be rounded down to the same thing it started with. Unless you always round up, in which case most of them will get +1. Because of that, duplicating the original golden age features is probably better (+1 if it gives at least 1 already for each of :hammers: and :commerce: ).

    For the sake of simplicity, in my personal FF mod I've set golden ages to simply give each system 1 extra commerce and 1 extra production per 2 population in the system (rounding up). This was done in updatePlotYield. (I have no GP enabled, so the only way to get the golden age is via the National Epic national wonder that I added back in - it had to do something other than increase the non-existant GPP so it does this plus some other stuff. Therefore each civ gets 1 golden age determined by when they build this.)
     
  6. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Okay, then replicate the original golden age feature per planet. My only point was that you could do it individually per planet in getExtraYield, rather then settle for a city-only bonus.

    Speaking of which; God-Emperor, are you ever going to release your FF mod?
     
  7. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    I agree that it would probably be better, especially in that it would be more like the way it works in regular Civ.

    Beats me.

    (Now for a bunch of stuff that is probably mostly not on-topic, but the ST mod might suffer from some of the same problems.)

    At the moment it has the same problems as many FF derived mods, only more so in some places.

    The main thing is that the AI is terrible in several areas. In my case it is even worse in one respect because two civs have UUs that the AI can't use effectively which actually makes them weaker than the non-UU version for the AI. For example, New Earth gets a battleship UU, which I currently call a "battlecarrier", which is a bit less than 10% weaker at each of the 3 levels, but can carry one squadron at plain and delta and two at omega. For the human player this will tend to be a little better than a regular battleship, especially the omega version. The AI never ever puts a squadron on the thing, so for them it is just a weaker battleship. I also made the AI effectively worse by altering the city production in CvAI.py so that the military weight can now result in forcing the production of carriers. Carriers that, sadly, the AI never uses to carry anything. They turn out to be just extremely expensive low strength ships with no bonuses against anything (it would be far better off building planetary defense ships or invasion ships or destroyers or...). It also now forces a few more squadrons (both fighter and bomber) as well, but it only bases them in star systems (this does help it slightly, but not as much as it could).

    If TheLadiesOgre (or someone) were to get land based aircraft/squadron and missile carying units to work properly, then it wouldn't have this problem. I'm hoping he does these first as it ought to be a little easier than a complete land transport fix. That reminds me: I forgot to suggest this in the land transport thread...

    The other main problem is that it has a problem I've noticed in FF too - it seems to get significantly less interesting after you get to about the half-way point in a game. Part of this is the slow turn processing, but not all of it. At this point, exploration is pretty much done and the last (usually quite poor) star systems are being settled. There just isn't very much going on after that point, and not much to do other than 2 things. 1) Fight wars for a victory. 2) Race through the tech tree to either build the UN-repalcement and go for diplomatic victory or build the astral gate. You could say that regular, non-FF, Civ is like this to, but the effect seems to be greater in FF (and my mod). I have a few more things to do than regular FF - some national wonders to build and 3 additional techs - but it still seems strangely devoid of things to do. Part of this is that option 1 (beating up the AI civs) is just not very interesting because they are not very good at it and made even worse as they are mostly significantly behind in tech by that point (partly related to not making good use of the multiple planets per system) and have various other problems making them bad at war. Another part of the problem is that each star system can build only one thing and there are generally fewer star systems than there are cities in regular Civ, so fewer things being built (and fewer build decisions to make) at any given time. With fewer resource types and no ocean/river routes for easy trading there is also a lot less trading of resources going on - it's just one fewer thing to check on in the game. I had intended to add a victory condition, down at the last of the 3 techs I added to the industrial track, but haven't done so yet. This isn't really much in the "more to do" area since you can only win via 1 condition anyway.

    I've even implemented a potential partial fix for the AI not using multiple planets well. In plain FF the only time the AI ever changes which planet it is building something on is in the python override CvAI.doCityAIProduction. If one of the weights comes up high enough to do the override, it switches the build planet to the first planet in the system's planet list that is in the current cultural range and that does not already have the building (such as a sports arena if the happiness weight is highest). Aside from these switches, the AI never changes the current build planet. What I did was to make the CvGameUtils.cannotConstruct function search for a planet where the building can be built instead of just checking the current planet. So instead of just returing true if the current planet already has building X (or does not have the prereq building), it now proceeds to search for a planet in the system that does not have the building but does have any prereq if the current planet doesn't meet these conditions, changing the current build planet if it finds one. As far as I can tell, this works but seems to be making the AI only infinitesimally better (I'm not sure why it isn't more significant - it might help some if I sorted the planets based on some criteria or other rather than just using the list order).

    The next thing I'm thinking of trying is adding the BBAI DLL. I don't expect it to help much, and it may slow down the turn processing so much that it isn't worth using it even if it helps more than I expect.

    And, of course, I haven't done all the art (icons and such) yet.

    By now, you're probably sorry you asked.
     
  8. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I don't know how much the CAR mod would help reduce speed costs. 15% in regular Civ sounds nice, but in FF where there's so much Python "overhead"... it's a lot harder.

    Speaking of resources, I've been in my spare time from modding Fall from Heaven 2 and modding Colonization been working on a modcomp that lets planets "provide" resources through buildings (when you settle a solar system, buildings have a chance of appearing on each planet, and each provides 1 of some resource). This theoretically would allow us to add resources that are "planet only", like Corn, Grain, Deer, Fish etc. That should help solve this issue of resources in Final Frontier. However, currently I've only made it do this with the regular 9 FF resources- I started this in FF rather then ST.

    We need a "Final Frontier Modding" forum of some type, or even a "Modder's Guide to Final Frontier" topic in the style of the Modder's Guide to FFH 2, I think... random threads that are only slightly relevant get cluttered with stuff like this about FF modding.
     
  9. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    How would one go about doing this? I imagine you would set iExtraYield += something, but I don't know what that something is. Unfortunately I don't get arrays very well, or whatever datatype iExtraYield is.

    EDIT: Have you tested loading a worldbuildersave with your worldbuilder mod? I merged it in (slightly modified, as I don't want the building added to every planet when I use the edit city button, as that's how I add them for scenarios) and I got a python exception when loading a test save.
    Traceback (most recent call last):

    File "CvWBInterface", line 47, in applyInitialItems

    File "CvWBDesc", line 1903, in applyInitialItems

    File "CvWBDesc", line 1285, in applyCity

    File "CvWBDesc", line 895, in apply

    AttributeError: 'NoneType' object has no attribute 'getNumPlanets'
    ERR: Python function applyInitialItems failed, module CvWBInterface

    EDIT2: removal of black holes/supernova and buildings also doesn't work
     
  10. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Hmm... I would think that this:

    Code:
    if pPlayer.isGoldenAge():
    	iExtraYield += (self.getBaseYield(iYieldID) + iExtraYield) * 0.25
    would work. But only if the code is added at the end of the getExtraYield function (so more isn't added to the extra yield after a fourth of the total yield has been calculated).

    I'd use the getTotalYield function, except getTotalYield calls getExtraYield... which is where this code would be inserted.

    As far as I can tell, getTotalYield is the function used to get the yield of a planet. getBaseYield pulls the actual number from the array containing system data, whereas getExtraYield does some hardcoded calculations (for instance, in FF it gives a production boost to the Forge's cities). iExtraYield is an integer, calculated for each iYieldID (food = 0, production = 1, commerce = 3) and added to the value from the array.

    So you don't have to mess with arrays, just insert code to operate on iExtraYield inside the getExtraYield function.

    I think I see the problem. Observe the code below:

    Code:
    	def apply(self):
    		"after reading, this will actually apply the data"
    		player = getPlayer(self.owner)
    		if (player):
    			self.city = player.initCity(self.plotX, self.plotY)
    			
    		if (self.name != None):
    			self.city.setName(self.name, False)
    		
    		if (self.population):
    			self.city.setPopulation(self.population)
    			
    		if (self.culture):
    			self.city.setCulture(self.city.getOwner(), self.culture, True)
    			
    		for bldg in (self.bldgType):
    			bldgTypeNum = CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), bldg)
    			self.city.setNumRealBuilding(bldgTypeNum, 1)
    			
    #Added in Final Frontier Worldbuilder: TC01
    		FinalFrontier = CvEventInterface.getEventManager()
    		pSystem = FinalFrontier.getSystemAt(self.city.getX(), self.city.getY())
    		iNumPlanets = pSystem.getNumPlanets()
    It looks like Class CvCityDesc def apply is being called for all plots, be they cities or not. (See, the function checks to see if there's actually a city on the plot in the first place). So you probably need an if statement above all the Final Frontier specific code saying "if (player)", like at the beginning of the function.

    As to building removal and black hole/supernova removal... it seemed to work in normal Final Frontier fine. Did solar system removal work? Because the code for black holes and supernovae is located in the same place as solar systems. I'd suggest testing these features for the mod installed over Final Frontier to determine whether you missed something while merging.
     
  11. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    The fix doesn't work for loading worldbuilder saves. I can confirm that the feature removal does not work even when I use the erase button rather than right-click. Solar system removal works fine. I used a file comparison utility and the only differences between my files and yours are where I changed the edit city button, commented out the code for reading/storing what a city is currently producing (as it is not compatible with Final Frontier) and adding the unit name reading/storage that was added to BtS in 3.17 but Firaxis forgot to add to Final Frontier. Haven't yet tried the golden age change.
     
  12. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Well, I see the problem with save loading.

    While the Solar System feature is being placed in CvWBDesc.py, the system itself is not actually created until the beginning of the game in onGameStart in CvFinalFrontierEvents.py.

    Meaning that I'm attempting to get a system that won't be initialized yet. And then attempting to operate on it. Which won't work.

    Why did Jon Shafer do it this way? He already edited CvWBDesc.py to read and write to the WBS... wouldn't it have been easier to build the systems there as well?

    So there are two things I could do... move the building code to CvFinalFrontierEvents.py's onGameStart (with the rest of the on-map-loaded code), or I could move all of that code to CvWBDesc.py. Which would be better?
     
  13. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Probably onGameStart (I think some stuff for loading worldbuildersaves is already there).

    Tried the golden age code. Get the following python exception:
    Traceback (most recent call last):

    File "CvEventInterface", line 19, in onEvent

    File "CvEventManager", line 187, in handleEvent

    File "CvFinalFrontierEvents", line 293, in onBeginGameTurn

    File "CvFinalFrontierEvents", line 1131, in updateMapYield

    File "CvFinalFrontierEvents", line 1184, in updatePlotYield

    ArgumentError: Python argument types in
    CyCity.setBaseYieldRate(CyCity, int, float)
    did not match C++ signature:
    setBaseYieldRate(class CyCity {lvalue}, int, int)
    ERR: Python function onEvent failed, module CvEventInterface
     
  14. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Oops. That didn't work because yields cannot be floats, they have to be integers. So I just copied the code from the SDK and converted it to python instead.

    Code:
    if pPlayer.isGoldenAge():
    	if (self.getBaseYield(iYieldID) + iExtraYield) >= gc.getYieldInfo(iYieldID).getGoldenAgeYieldThreshold()
    		iExtraYield += (self.getBaseYield(iYieldID) + iExtraYield) + gc.getYieldInfo(iYieldID).getGoldenAgeYield()
    Now it checks if the base yield plus current extra yield is over iGoldenAgeYieldThreshold in the XML, and if it is, adds iGoldenAgeYield in the XML to it.
     
  15. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
  16. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    I switched from my simple +1 per 2 population to :hammers: and :commerce: for each system to this.

    If you add the above code to the CvPlanet's getExtraYield function as-is it will have a huge effect (once you add the missing colon at the end of the 2nd "if" line).

    This function calculates the extra yield from various things, like the extra :hammers: from a mining facility. This is added to the base yield in the getTotalYield function.

    So with the above code, when you are in a golden age the result from getTotalYield for a yield type that gets a bonus when in a golden age is:
    total = base + extra
    where extra now = original_extra + base + original_extra + golden_age_bonus
    resulting in:
    total = 2*base + 2*original_extra + golden_age_bonus

    So on that planet that normally gives 2 :hammers: base + 1 for mining facility = 3 :hammers:, you suddenly get 7 :hammers: (2*2 + 1*2 + 1, since the standard golden age bonus is +1).

    This would seem to be excessive. I first used this and when I entered a golden age my production and commerce output roughly doubled (slightly over, probably). Wow.

    I now use:
    Code:
    		if pPlayer.isGoldenAge():
    			if (self.getBaseYield(iYieldID) + iExtraYield) >= gc.getYieldInfo(iYieldID).getGoldenAgeYieldThreshold() :
    				iExtraYield += gc.getYieldInfo(iYieldID).getGoldenAgeYield()
    right before the return statement in getExtraYield.

    The effect is still easily noticeable as it is around +1 :hammers: and +1 :commerce: per population point when using the default Civ4YieldInfos.xml values. This is roughly double what I was using and it certainly makes golden ages valuable.
     
  17. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I think I meant to do that in the first place (just add the golden age yield to iExtraYield). Not sure why I didn't, but yes, that would be a lot better then getting yields into double digits.
     

Share This Page