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

Happy Golden Age

Discussion in 'Civ4 - Mod Components' started by platyping, May 24, 2013.

  1. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Happy Golden Age

    Features:



    Civ V Golden Age System
    Ever wondered what is the point of excess Happiness?
    A city with 100 Excess Happiness has no difference compared to one with 5 Excess Happiness?

    New Golden Age System
    Every excess happiness adds towards the Happy Golden Age Bar.
    When bar is filled, Golden Age is triggered and bar is empty again.
    Threshold is set at 250 (adjusted by GameSpeed) and increases by 250 every time it is full.
    Does not change during Anarchy or Golden Age

    Healthcare System
    Every excess healthiness adds towards the Happy Healthcare Bar.
    When bar is filled, +1 Population to All Cities is triggered and bar is empty again.
    Threshold is set at 250 (adjusted by GameSpeed) and increases by 250 every time it is full.
    Does not change during Anarchy
     
  2. Aloha

    Aloha Richard the Catheart

    Joined:
    Feb 17, 2013
    Messages:
    74
    Location:
    Kingdom of Catland
    Remarkable work!:D
     
  3. Aloha

    Aloha Richard the Catheart

    Joined:
    Feb 17, 2013
    Messages:
    74
    Location:
    Kingdom of Catland
    Sometimes I just don't want to sacrifice a GP to start a GA, and now I find my way.:mischief:
     
  4. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,520
    Location:
    israel
    i love you platyping.

    i just love you.

    your work is so innovating, its so good.
     
  5. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Thanks. Not really an innovation though, since it is just a porting of civ v feature.
    Can't really remember whether the bar is still filling up or not during golden age.
    And I think civ v does not have anarchy?
     
  6. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,520
    Location:
    israel
    civ v sucks :) so i dont know..
     
  7. Xyth

    Xyth History Rewritten

    Joined:
    Jul 14, 2004
    Messages:
    4,052
    Location:
    Aotearoa
    This is cool, I'll look at putting it into the next version of HR. Good work!

    Incidentally, if you're up for a challenge, one of the changes Civ5 made that was excellent was each Great Person type having their own separate progress bar. Reckon something like that might be possible to emulate?
     
  8. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Only possible via SDK
     
  9. Nimek

    Nimek Emperor

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    Can you add AI for civic choice rutine.

    Example if AI calculates that 5 turns more and GA will begin then decide to wait to GA and than change civic.
     
  10. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    And... how do you do that in python :D
     
  11. Nimek

    Nimek Emperor

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    I am not a python/sdk modder (xml only) so everything is simple for me :D
     
  12. Xyth

    Xyth History Rewritten

    Joined:
    Jul 14, 2004
    Messages:
    4,052
    Location:
    Aotearoa
    What about doGreatPeople in CvGameUtils? My understanding is by setting the return value to true that will override BTS's default routine in CvCity.cpp. We could then rewrite the routine in Python, perhaps storing each GPP pool using the city's script data. Am I overlooking something?
     
  13. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    doGreatPeople I believe is to spawn Great People.
    Nothing to do with the bar
     
  14. Xyth

    Xyth History Rewritten

    Joined:
    Jul 14, 2004
    Messages:
    4,052
    Location:
    Aotearoa
    Yes, but what I'm wondering is if we override doGreatPeople and hide the standard bar in the interface, then no Great People would ever be spawned and we could therefore replace it with a different system. The bar would still accumulate some GPP but it would for all intents and purposes have no effect. I'm just trying to think of there are any other mechanics that would break if we did this, i.e, anything that relies on checking the progress of GPP that is unrelated to generating great people.

    EDIT: If I'm reading the function correctly, doGreatPeople() does handle per turn GPP generation, just not from specialists or buildings which are handled elsewhere.

    Spoiler :
    Code:
    void CvCity::doGreatPeople()
    {
    	CyCity* pyCity = new CyCity(this);
    	CyArgsList argsList;
    	argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity));	// pass in city class
    	long lResult=0;
    	gDLL->getPythonIFace()->callFunction(PYGameModule, "doGreatPeople", argsList.makeFunctionArgs(), &lResult);
    	delete pyCity;	// python fxn must not hold on to this pointer 
    	if (lResult == 1)
    	{
    		return;
    	}
    
    	if (isDisorder())
    	{
    		return;
    	}
    
    	[COLOR="Red"]changeGreatPeopleProgress(getGreatPeopleRate());
    
    	for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
    	{
    		changeGreatPeopleUnitProgress(((UnitTypes)iI), getGreatPeopleUnitRate((UnitTypes)iI));[/COLOR]
    	}
    
    	if (getGreatPeopleProgress() >= GET_PLAYER(getOwnerINLINE()).greatPeopleThreshold(false))
    	{
    		int iTotalGreatPeopleUnitProgress = 0;
    		for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
    		{
    			iTotalGreatPeopleUnitProgress += getGreatPeopleUnitProgress((UnitTypes)iI);
    		}
    
    		int iGreatPeopleUnitRand = GC.getGameINLINE().getSorenRandNum(iTotalGreatPeopleUnitProgress, "Great Person");
    
    		UnitTypes eGreatPeopleUnit = NO_UNIT;
    		for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
    		{
    			if (iGreatPeopleUnitRand < getGreatPeopleUnitProgress((UnitTypes)iI))
    			{
    				eGreatPeopleUnit = ((UnitTypes)iI);
    				break;
    			}
    			else
    			{
    				iGreatPeopleUnitRand -= getGreatPeopleUnitProgress((UnitTypes)iI);
    			}
    		}
    
    		if (eGreatPeopleUnit != NO_UNIT)
    		{
    			changeGreatPeopleProgress(-(GET_PLAYER(getOwnerINLINE()).greatPeopleThreshold(false)));
    
    			for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
    			{
    				setGreatPeopleUnitProgress(((UnitTypes)iI), 0);
    			}
    
    			createGreatPeople(eGreatPeopleUnit, true, false);
    		}
    	}
    }
     
  15. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    If you want to do away with bts system and do an individual bar for each gp, it is just not worth the trouble.

    This mod comp does a check every turn for every player and updates the bar.
    What you want have to update bars of 7 GPs of every city of every player.

    Pointless to do with python
     
  16. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Updates

    1) Bar shifted to left side, since it is usually covered when built list pop up
    2) Brand new color unused elsewhere
    3) Added a GA rate
    4) Added GA rate colors
    5) New Bar display during Golden Age and Anarchy
     

    Attached Files:

  17. Nimek

    Nimek Emperor

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    Afforess in AND added new future to gameplay called Dark Ages (opposite to golden age)

    I wondering is it be possible to collect unhapinnes also and and some level of unhapinnes starts anarchy or in other mods Dark Age
     
  18. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Pretty easy to do the opposite.
    But generally, what is the point?
    Chance of encountering excess nationwide unhappiness is too low, since there are so many sources of happiness.
    Just Globe Theatre alone is too lame.
     
  19. Nimek

    Nimek Emperor

    Joined:
    Jul 7, 2010
    Messages:
    1,179
    Gender:
    Male
    The point is if you will neglect your citizens needs they will revolt against you and that revolt can spread on entire nation (anarchy).

    Mod components are used by mods so amount of happy giving stuff depends on modder
     
  20. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,520
    Location:
    israel
    hey platy,

    i thinks something is wrong with the bars text =
    i play window mode, and the text gets out of the bars area - half way to the right.

    hope u can check it out, probably a resolution thingy.
     

Share This Page