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

Historical Spawn Dates

Discussion in 'Civ5 - Mod Components' started by Gedemon, Mar 2, 2013.

  1. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    Any help with the tech diffusion situation?
     
  2. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    trying something, will post the result after the test.
     
  3. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    alright, appreciate it
     
  4. lp_04

    lp_04 Prince

    Joined:
    Sep 2, 2012
    Messages:
    336
    Location:
    Leiria, Portugal
    Thanks, it's awsom!! Just a minor problem that has probably been aborded by someone: the waiting time is too slow (something normal...) but as the windows like "strongest civ" "most well feed people" appear we must stay near the computer and pau attention to it.
    I just tried the 5 first tuyrns of the celts in large europe and something that was not good was the low ammount of faith I got in the beginning (15), when there was already an enhanced religion in the game. I felt like "there is no way to play in the religion line".

    Beside that, awsom mod, civV needed that. Thank's for your work! And I mean, all of it, TSL, revolutions, 34 civs DLC... These are the best mods for civV IMO :)
     
  5. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    Anything yet?
     
  6. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    the TechDiffusion.lua I'm testing if you want it...

    Spoiler :
    Code:
    -- Tech Diffusion
    -- Author: Afforess, modified by Erendir, adapted to G+K/HSD/AH by Gedemon
    -- DateCreated: 10/8/2010 8:52:20 PM
    --------------------------------------------------------------
    
    iTechsBehindReq = 4;
    iTechsBehindFullBenefit = 12;
    
    iHasMetBonus		=  0.25; -- Bonus for having met the civ
    iIsAtwarMalus		= -0.75; -- Malus for being at war
    iDenouncedMalus		= -0.50; -- Malus for being denounced (but denouncing does not give malus)
    iEmbassyBonus		=  0.50; -- Bonus for having an Embassy
    iOpenBorderBonus	=  0.75; -- Bonus for open border
    iFriendBonus		=  0.50; -- Bonus for being friend
    iDefPactBonus		=  0.25; -- Bonus for having a defensive pact
    iResearchBonus		=  1.50; -- Bonus for having a research agreement
    
    function TechDiffusion()
    	print("-------------------------------------")
    	print("Tech Diffusion...") 	
    	for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
    		local pPlayer = Players[ iPlayerLoop ];
    		if pPlayer ~= nil and pPlayer:IsAlive() and pPlayer:GetNumCities() > 0 then
    			local pTeam = Teams[pPlayer:GetTeam()];
    			local pTeamTechs = pTeam:GetTeamTechs();
    
    			local iTechsBehindLead = numberOfTechsBehindLeadTeam(pTeam);
    			print()
    			print(string.format("Techs Behind Lead Team: %d", iTechsBehindLead));
    
    			if (iTechsBehindReq < iTechsBehindLead) then
    				local sum, num = 0, 0
    				for eTech in GameInfo.Technologies() do
    					if not pTeam:IsHasTech(eTech.ID) then
    
    						local knownExp = 0;
    						for iOtherTeam = 0, GameDefines.MAX_CIV_TEAMS-1, 1 do
    							pOtherTeam = Teams[iOtherTeam];
    							if(pOtherTeam ~= nil) and iOtherTeam ~= pTeam:GetID() and not Players[pOtherTeam:GetLeaderID()]:IsMinorCiv() then
    								if pOtherTeam:IsHasTech(eTech.ID) and pTeam:IsHasMet(iOtherTeam) then
    									local teamExp = iHasMetBonus;
    									if (pTeam:GetCurrentEra() < pOtherTeam:GetCurrentEra()) then
    										teamExp = teamExp + (pOtherTeam:GetCurrentEra() - pTeam:GetCurrentEra() / 2);
    									end
    									if pTeam:IsAtWar(iOtherTeam) then
    										teamExp = teamExp + iIsAtwarMalus;
    									end
    									if (pPlayer:IsDenouncedPlayer(pOtherTeam:GetLeaderID())) then
    										teamExp = teamExp + iDenouncedMalus;
    									end
    									if pTeam:HasEmbassyAtTeam(iOtherTeam) then
    										teamExp = teamExp + iEmbassyBonus;
    									end
    									if pTeam:IsAllowsOpenBordersToTeam(iOtherTeam) then
    										teamExp = teamExp + iOpenBorderBonus;
    									end
    									if (pPlayer:IsFriends(pOtherTeam:GetLeaderID())) then
    										teamExp = teamExp + iFriendBonus;
    									end
    									if (pTeam:IsDefensivePact(iOtherTeam)) then
    										teamExp = teamExp + iDefPactBonus;
    									end	
    									if (pTeam:IsHasResearchAgreement(iOtherTeam)) then
    										teamExp = teamExp + iResearchBonus;
    									end	
    									knownExp = knownExp + teamExp;
    									print(string.format("%g teamExp From %s", teamExp, Players[pOtherTeam:GetLeaderID()]:GetCivilizationShortDescription()));
    									--print(Players[pTeam:GetLeaderID()]:GetCivilizationShortDescription(),'<',Players[pOtherTeam:GetLeaderID()]:GetCivilizationShortDescription(),'teamExp='..teamExp,'EraDiff: '..pTeam:GetCurrentEra()..'-'..pOtherTeam:GetCurrentEra(),'IsAtWar:'..tostring(pTeam:IsAtWar(pOtherTeam:GetID())), 'IsAllowsOpenBorderToTeam:'..tostring(pTeam:IsAllowsOpenBordersToTeam(pOtherTeam:GetID())), 'IsDefensivePact:'..tostring(pTeam:IsDefensivePact(pOtherTeam:GetID())), 'pPlayer:', 'IsFriends:'..tostring(pPlayer:IsFriends(pOtherTeam:GetLeaderID())), 'IsDoF:'..tostring(pPlayer:IsDoF(pOtherTeam:GetLeaderID())) )
    								end
    							end
    						end
    						--print(string.format("Tech Numerator for %s: %d", eTech.Type, knownExp));
    
    						local iModifier = 100;
    						local techDiffMod = 50;
    						if (knownExp > 0.0) then
    							--print(string.format("Tech Numerator: %g", knownExp));
    							iModifier = iModifier + (techDiffMod - math.floor((techDiffMod * math.pow(0.85, knownExp) + 0.5)));
    						end
    
    						-- Tech flows downhill to those who are far behind
    						local iTechScorePercent = getBestKnownTechScorePercent(pTeam);
    						local iWelfareThreshold = 75;
    						local iWelfareModifier = 50;
    						if( iTechScorePercent < iWelfareThreshold ) then
    							if( knownExp > 0.0 ) then
    								iModifier = iModifier + (iWelfareModifier * Game:GetCurrentEra() * (iWelfareThreshold - iTechScorePercent))/200;
    							end
    						end
    
    						--Teams don't recieve full effect unless very far behind
    						if (iModifier > 100) then
    							--print(string.format("Tech Modifier for %s: %d", eTech.Type, iModifier));
    							iModifier = iModifier * math.pow(iTechsBehindLead / iTechsBehindFullBenefit, 0.45);
    						end
    
    						--print(string.format("Tech Modifier for %s: %d", eTech.Type, iModifier));
    
    						if (iModifier > 100) then
    							local iTechCost = pTeamTechs:GetResearchCost(eTech.ID);
    							local iFreeBeakers = ((iTechCost * iModifier) / 100) - iTechCost;
    							iFreeBeakers = math.pow(iFreeBeakers,0.40);
    							iFreeBeakers = math.floor(iFreeBeakers * 100);
    
    							print(string.format("Free Beakers for %s for %s: %d", Players[pTeam:GetLeaderID()]:GetCivilizationShortDescription(), eTech.Type, (iFreeBeakers / 100)));
    							sum = sum + iFreeBeakers; num = num + 1;
    							
    							pTeamTechs:ChangeResearchProgressTimes100(eTech.ID, iFreeBeakers);
    						end
    					end
    				end
    				
    				print(string.format("Free Beakers for %s: %d in %d tech(s)", Players[pTeam:GetLeaderID()]:GetCivilizationShortDescription(), sum/100, num ));
    				
    				if iPlayerLoop == Game.GetActivePlayer() then
    					Events.GameplayAlertMessage(string.format("You get %d [ICON_RESEARCH] in %d tech(s) from other Civilizations", sum/100, num ))
    				end
    			end
    		end
    	end
    	print("-------------------------------------")
    end
    
    function getBestKnownTechScorePercent(pTeam)
    	local iOurTechScore = 0;
    	local iBestKnownTechScore = 0;
    
    	for iPlayerLoop = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
    		local pPlayer = Players[ iPlayerLoop ];
    		if pPlayer ~= nil and pPlayer:IsAlive() and pPlayer:GetNumCities() > 0 and pPlayer.GetTechScore then
    			if Teams[pPlayer:GetTeam()]:GetID() == pTeam:GetID() then
    				iOurTechScore = math.max( iOurTechScore, pPlayer:GetTechScore() );
    			elseif (pTeam:IsHasMet(pPlayer:GetTeam())) then
    				iBestKnownTechScore = math.max( iBestKnownTechScore, pPlayer:GetTechScore() );
    			end
    		end
    	end
    
    	iBestKnownTechScore = math.max( iBestKnownTechScore, iOurTechScore );
    
    	return ((100*iOurTechScore)/math.max(iBestKnownTechScore, 1));
    end
    
    function numberOfTechsBehindLeadTeam(pTeam)
    
    	local pBestTeam = Teams[0];
    	local iBestTeamTechCount = 0;
    	for iTeamLoop = 0, GameDefines.MAX_CIV_TEAMS-1, 1 do
    		local pOtherTeam = Teams[iTeamLoop];
    		local pOtherTeamTechs = pOtherTeam:GetTeamTechs();
    		if(pOtherTeam ~= nil) and pOtherTeam:GetID() ~= pTeam:GetID() then
    			local iTechCount = 0;
    			for eTech in GameInfo.Technologies() do
    				if pOtherTeam:IsHasTech(eTech.ID) then
    					iTechCount = iTechCount + 1;
    				end
    			end	
    			if (iTechCount > iBestTeamTechCount) then
    				pBestTeam = pOtherTeam;
    				iBestTeamTechCount = iTechCount;
    			end
    		end
    	end
    
    	local iTechCount = 0;
    	for eTech in GameInfo.Technologies() do
    		if pTeam:IsHasTech(eTech.ID) then
    			iTechCount = iTechCount + 1;
    		end
    	end	
    
    	return iBestTeamTechCount - iTechCount;
    end
    
    
    Events.ActivePlayerTurnEnd.Add(TechDiffusion);
     
  7. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    Sorry for the hurry, I am just anxious to start a new game :p.

    I'll wait till the testing is done.
     
  8. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    I'll make a multiple update tomorrow, the code above should give you what you want if you really want to start it now.

    Else, wait for tomorrow :)
     
  9. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    Where do I put that exactly? And what is the multiple update? o:

    Btw, do you play with the slower research mod or default? Hows your eras lining up?
     
  10. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    Figured it out, been playing a game of England for some time now.

    My main concern with the mod is how powerful these ancient civilizations get. India, China, Egpyt, ect easily triumph any other classical-medieval civ. This is mainly due to the fact that there is no interference from the time they are spawned till the time another civilization spawns near them.

    Simply turning on raging barbarians would help but having the conversion radius set to what it is now would probably give them too much of a handicap off the bat and no conversion would probably destroy them if barbs were too close,right?

    If you could explain the way your formula is set up in the LUA you showed me earlier I would like to play around with it for a little bit. Thanks GED.
     
  11. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    I've not finished my test game yet, but I think it should be over tonight.

    I'll post another component I'm using then, it balance things a bit, and it will be also the first step to my Dynamic History mod.

    Basically it raise the cost of settler to slow down the early civilizations, and give the later civilizations global advantage (in science, production, gold, etc...) using an unique Palace for each of them. And it also remove all traits, else Egypt, for example, is able to build all wonders... My mod won't use leaders anyway.
     
  12. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    That sounds good.

    Turning off the convert barbarians and city states (which I don't use anyways, sorta unrealistic) and turning on raging barbarians helps a lot as well. It forces the civilizations to build their empire in a more local area where it's safe. Earlier games I noticed civs building cities in far away places that really didn't make sense but I realized that it did considering that no one was there to stop them.

    Only problem I have now is getting a strong English presence into the game. Whenever they spawn, the Celts are usually pretty close and it doesn't take long for them to declare war. Since Edinburgh (their capital) is a production mad house, they push out lots of units really quick. Is -100 really a realistic spawn for the Celts? Maybe use your mod component that increases settler cost to reduce the power of the celts early on?
     
  13. albie_123

    albie_123 Modding In Secret

    Joined:
    Mar 12, 2010
    Messages:
    1,380
    Location:
    Sydney, NSW
    I hope civilization traits have some form in your Dynamic History mod - the ones in Rhyes for Civ IV really made each Civ unique.
     
  14. lp_04

    lp_04 Prince

    Joined:
    Sep 2, 2012
    Messages:
    336
    Location:
    Leiria, Portugal
    I agree with albie_123

    What if, instead of removing the traits, you provide some benefit for the spawning civs? Something more than just barbarian units+ CS influence.

    For instance, I tried a game with france the first time I used this mod and my civ spawned in a Galia full of romans with 2 or 3 roman cities. My units went to the heart of france where there were only 8 tiles available. What if the cities in some radius (2 tiles) become yours; the cities 2-5 tiles from the spawning one (in my case, the tile supposed to belong to Paris) have a rebellion (units of the spawning faction appear near the city) and the controller of these cities must have a good military strenght to keep the empire. I don't know if this is possible, but would be somthing quite interesting. Should work for civs as well as for CS.

    Other thing that could be great to your mod would be that old "Real Name Earth" we had before GaK, I mean, Cities in a certain place have a specific name, no matter what is the civ that founds the city.

    I don't know if these improvements can be done, they are just suggestions.
     
  15. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    "traits" are planned.

    but not like they are now.

    More like specific objectives, specific units, specific advantages.

    Some changes will be radical, but, I hope, more immersive for that kind of mod.

    For example, one of the small mods I never released is removing the ability to build settlers for the Huns, but give all their melee units a strong bonus against cities (I really didn't like the way their city names was handled :o ). I could go further on that path and add the ability to gain more gold, beakers, culture, etc when attacking cities, without the ability to capture them.

    I may use that kind of thing, maybe "tribe" civilizations without any city, we'll see.

    the "unique palaces" I use for balance are kind of "traits" already, calibrated for the maps I plan to use the mod on. Russia gain territory very fast for example. European civs start late, but, added to the starting "boost", they have bonuses in their yields of science, production, gold, culture, etc...

    That helps to balance the small territory available for them.

    In my current test game (20 civs Large Europe, standard speed, Emperor level) Celts and England are in, it's 1923 (turns 343) and England is 4th on the civ's rank, Celts are 18th...

    The tech flow seems good, playing as Russia I've just finished my first great wars bomber, will make my first landship soon (have to repair a pillaged oil well :o ), and my riflemen, cossack & artilleries are fighting against Austria great war infantry, hussars and canons.

    I've the feeling that I will get to big of an advantage in late game in science, I need to finish it to see if Tech Diffusion is allowing the other civs to follow not to far away.

    Just for reference on balance, the 10 leading civs:
    Russia (me) 1513 pts
    Greece 1247
    Austria 945
    England 905
    Babylon 781
    France 721
    Germany 711
    Egypt 704
    Songhai 697
    Spain 652

    "Real Name Earth" is a mod I've followed since the start, I do want real city name, but the task is huge, I will request help here for the city list & position.

    FramedArchitect as already coded a mod to do that on any map, I just need to add a "name by era & civilization" layer to his mod, then people will "only" have to fill the XML files with name and coordinates...
     
  16. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    Small update, and I'll post the small initial version of what will (hopefully) become my main mod in a new thread.

    v.4 (May 23, 2013) :
    - Bugfix: check if an unit is still on the plot where looping on before trying to convert it.
    - Auto-close "Who's Winning" and Natural Wonders popups for "sleeping" human player.


    Edit: thread for the dynamic history project is here :D
     
  17. MAHRana

    MAHRana Warlord

    Joined:
    May 22, 2010
    Messages:
    281
    This mod is something Civ V needed from the start! i didn't get a full game working yet (probably coz i messed around with the dates and starting units) but i'm looking forward to it! i edited all the start dates to make it really accurate and i can list them if its wanted.

    i wouldn't mind contributing what i can.
     
  18. Acoustic

    Acoustic Warlord

    Joined:
    Sep 24, 2010
    Messages:
    270
    I wouldn't mind taking a look at those spawn dates, just to check haha.


    Hey GEDEMON, quick question. Why does Sweden have so many barbarians? I turned on raging barbarians and most places had a decent amount of them but Swedens area literally had one on every Hex.
     
  19. ales_

    ales_ Heir

    Joined:
    Apr 10, 2012
    Messages:
    5,639
    Gender:
    Male
    Location:
    Toulouse, France
    Yes, some of the spawn dates are really strange. I have already posted my ideas higher. You can post yours and then we can discuss them.
     
  20. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,793
    Location:
    France
    Yes, and thanks, I've already changed some, but I forgot to add that to the change note, sorry.
     

Share This Page