Eurekas for Vox Populi

merill

Prince
Joined
May 15, 2010
Messages
437
Location
France

Overview:
Add "quest" to each technology, that add some discount.

Installation:
  • For VP (no eui) since 11-17:
  • Unzip Download v3 into your MODS folder
Mod compatibility:
This mod modify NotificationPanel.lua and TechHelpInclude.lua
Known issues:
  • It's a beta, Eurekas are only done up to modern era
  • It's not yet very well balanced, help to create more interesting eureka are welcome.
  • If there are too many notifications, you can edit eurekalib.lua and set 'All notification' to false, it hide all notifications for unavailable techs
Patch notes:
v3.1: correct a lua bug for golden-age eureka
v3: better tooltip, thanks to Enginseer
v2:
- add team specific code
- add eureka for renaissance, industrial and modern (or almost)
- rework of ancient eurekas
- better notifications
- create a better framework to ease the construction of more eurekas.
- downloads: VP EUI, VP
v1:
- add eurekas from ancient to medieval.
- set eurekas to 30% max, or 25% max for the edges, to prevent easy beelining.
- increase all base tech cost by 15% (is it enough?)
 
Last edited:
current eurekas:

Ancient era

TRAPPING => Eureka: -5% research Cost for every Tundra within 2 tiles of your cities.
POTTERY => Eureka: -10% research Cost for every Wheat within 2 tiles of your cities.
THE_WHEEL => Eureka: -5% research Cost for every Jungle within 2 tiles of your cities.
ANIMAL_HUSBANDRY => Eureka: -5% research Cost for every Hill that does not have a feature within 2 tiles of your cities.
MINING => Eureka: -6% research Cost for every Mineable Luxury within 2 tiles of your cities.

SAILING => Eureka: -10% research Cost for every Coastal City settled.
HORSEBACK_RIDING => Eureka: -2% research Cost for every Desert and -4% for every Mountain within 2 tiles of your cities.
CALENDAR => Eureka: -10% research Cost for every Plantation Luxury within 2 tiles of your cities.
ARCHERY => Eureka: -5% research Cost for each Archer trained.
MASONRY => Eureka: -10% research Cost for every Quarry Luxury within 2 tiles of your cities.
BRONZE_WORKING => Eureka: -2% research Cost for every Forest within 2 tiles of your cities.

Classical era


OPTICS => Eureka: -10% research Cost for each Work Boat built.
WRITING => Eureka: -5% research Cost for every Classical Technology researched.
MATHEMATICS => Eureka: -10% research Cost for every Market built.
CONSTRUCTION => Eureka: -10% research Cost for every city with Access to Fresh Water.
IRON_WORKING => Eureka: -5% research Cost for each Spearman trained.

DRAMA => Eureka: -3% research Cost for every +4 Culture per turn you produce.
PHILOSOPHY => Eureka: -5% research Cost for every City-State Friend.
ENGINEERING => Eureka: -15% research Cost for each Great Engineer expended.
CURRENCY => Eureka: -5% research Cost for every 100 Gold (at normal speed) in your treasury.
METAL_CASTING => Eureka: -5% research Cost for each Forest chopped.



Medieval era


EDUCATION => Eureka: -10% research Cost for each Great Scientist expended.
THEOLOGY => Eureka: -6% research Cost for each Missionary recruited.
CHIVALRY => Eureka: -6% research Cost for every Walls built.
PHYSICS => Eureka: -6% research Cost for each Catapult constructed.
STEEL => Eureka: -5% research Cost for each Swordsman trained.

ARCHITECTURE => Eureka: -5% research Cost for every Wonder controlled.
ECONOMICS => Eureka: -3% research Cost for every Imported Luxury.
ACOUSTICS => Eureka: -2% research Cost for every Great Works created.
NAVIGATION => Eureka: -2% research Cost for every 10 Sea Tile revealed.
METALLURGY => Eureka: -2% research Cost for every 20 National Combat Experience



Renaissance era


CIVIL_SERVICE => Eureka: -5% research Cost for every City-State Allies.
GUILDS => Eureka: -2% research Cost for every Luxuries within 2 tiles of your cities.
COMPASS => Eureka: -5% research Cost for each Trireme or Galleass constructed.
MACHINERY => Eureka: -4% research Cost for each Composite Bowman trained.

BANKING => Eureka: -5% research Cost for every +20 Gold per turn you produce.
PRINTING_PRESS => Eureka: -5% research Cost for every +5 Tourism per turn you produce.
ASTRONOMY => Eureka: -5% research Cost for every +15 Faith per turn you produce.
GUNPOWDER => Eureka: -2% research Cost for every 10 Military Might.
CHEMISTRY => Eureka: -5% research Cost for every +30 research Science per turn you produce.



Industrial era


SCIENTIFIC_THEORY => Eureka: -4% research Cost for every Academy constructed.
RAILROAD => Eureka: nothing
STEAM_POWER => Eureka: -5% research Cost for every City with a Production of 5+.
RIFLING => Eureka: -1% research Cost for every Iron controlled.

ARCHAEOLOGY => Eureka: -1% research Cost for every Golden Age turn passed at normal speed.
FERTILIZER => Eureka: -2% research Cost for every Horse controlled.
INDUSTRIALIZATION => Eureka: -10% research Cost for every Worked Coal Mine.
DYNAMITE => Eureka: -2% research Cost for every Coal controlled.
MILITARY_SCIENCE => Eureka: -6% research Cost for each Great General expended.

Modern era

BIOLOGY => Eureka: -3% research Cost for every City with a Population of 3+.
ELECTRICITY => Eureka: -5% research Cost for each Great Merchant expended.
CORPORATIONS => Eureka: -10% research Cost for every Resource Monopoly owned.
REPLACEABLE_PARTS => Eureka: -6% research Cost for every Factory built.
COMBUSTION => Eureka: -3% research Cost for each Ironclad or Cruiser constructed or upgraded.

PLASTIC => Eureka: -2% research Cost for every Oil controlled.
RADIO => Eureka: -5% research Cost for each Great Musician expended.
FLIGHT => Eureka: -1% research Cost for each Triplane built in the world by other Civilizations.
BALLISTICS => Eureka: -3% research Cost for every Past War fought.


The goal is to create hard-to-achieve objective, to make them not worth it, or impossible to max them all.
 
Last edited:
"Increased all tech cost by +10%"

No not really, if at most Eureka helps reduce it significantly. Just by having 1 means your overall tech cost is 99% of the regular tech cost without the mod. If you increased the tech cost by +20%, there would be more incentives for players to explore eurekas.

That said, the AI doesn't seem to know about this, don't they? I wanted to explore this Civ 6 concept when you discover a resource related to the technology and it gives you science in that technology instead, but it seems you got it before me. Anyway glad to see another VP modder.
 
You're right about the +20%, but as i didn't add the 3,4,5,6 and 7 era eureka, i didn't want to slow the end game too much. For the AI, he doesn't know anything about the eureka, and i think it's not worth it to train him: it's a "hidden" feature, nothing is shown on the map. Anyway, at higher difficulties the AI has more of everything, so it should have more eureka than a player.

You can create your owns if you want: you set the reduction per eureka into the 'MaxEurekaCount' from the technologies table. To add an eureka to a tech, you call the lua function, like in the Eurekas.lua file in this mod.
I need ~60 other ideas of eurekas...
 
When you make the action that add an eureka, a notification must appear with the new bonus you have for this tech. If the notification doesn't appear, it' a bug.
Right now, the description of the action needed to add an eureka is only on the tech pop-up in the tech tree.

I Think you're right, i should add the eureka description into the notification.
 
Last edited:
New version:
- add team specific code
- add eureka for renaissance, industrial and modern (or almost)
- rework of ancient eureka
- better notifications
- create a better framework to ease the construction of more eureka.

It should be used with the 11-18 version if you use teams.
 
Code:
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Tundra[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_TRAPPING_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [ICON_RES_WHEAT] [COLOR_POSITIVE_TEXT]Wheat[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_POTTERY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Jungle[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_THE_WHEEL_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Hill[ENDCOLOR] that does not have a feature within 2 tiles of your cities.'
,'TXT_KEY_TECH_ANIMAL_HUSBANDRY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -6% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Mineable Luxury[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_MINING_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Coastal City[ENDCOLOR] settled.'
,'TXT_KEY_TECH_SAILING_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Desert[ENDCOLOR] and -4% for every [COLOR_POSITIVE_TEXT]Mountain[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_HORSEBACK_RIDING_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Plantation Luxury[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_CALENDAR_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Archer[ENDCOLOR] trained.'
,'TXT_KEY_TECH_ARCHERY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Quarry Luxury[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_MASONRY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Forest[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_BRONZE_WORKING_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Work Boat[ENDCOLOR] built.'
,'TXT_KEY_TECH_OPTICS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Classical Technology[ENDCOLOR] researched.'
,'TXT_KEY_TECH_WRITING_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Market[ENDCOLOR] built.'
,'TXT_KEY_TECH_MATHEMATICS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every city with [COLOR_POSITIVE_TEXT]Access to Fresh Water[ENDCOLOR].'
,'TXT_KEY_TECH_CONSTRUCTION_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Spearman[ENDCOLOR] trained.'
,'TXT_KEY_TECH_IRON_WORKING_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -3% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]+4 [ICON_CULTURE] Culture per turn[ENDCOLOR] you produce.'
,'TXT_KEY_TECH_DRAMA_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [ICON_CITY_STATE] City-State [COLOR_POSITIVE_TEXT]Friend[ENDCOLOR].'
,'TXT_KEY_TECH_PHILOSOPHY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -15% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT][ICON_GREAT_ENGINEER] Great Engineer[ENDCOLOR] expended.'
,'TXT_KEY_TECH_ENGINEERING_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]100 [ICON_GOLD] Gold (at normal speed) in your treasury[ENDCOLOR].'
,'TXT_KEY_TECH_CURRENCY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Forest[ENDCOLOR] chopped.'
,'TXT_KEY_TECH_METAL_CASTING_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT][ICON_GREAT_SCIENTIST] Great Scientist[ENDCOLOR] expended.'
,'TXT_KEY_TECH_EDUCATION_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -6% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Missionary[ENDCOLOR] recruited.'
,'TXT_KEY_TECH_THEOLOGY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -6% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Walls[ENDCOLOR] built.'
,'TXT_KEY_TECH_CHIVALRY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -6% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Catapult[ENDCOLOR] constructed.'
,'TXT_KEY_TECH_PHYSICS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Swordsman[ENDCOLOR] trained.'
,'TXT_KEY_TECH_STEEL_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [ICON_CITY_STATE] City-State [COLOR_POSITIVE_TEXT]Allies[ENDCOLOR].'
,'TXT_KEY_TECH_CIVIL_SERVICE_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Luxuries[ENDCOLOR] within 2 tiles of your cities.'
,'TXT_KEY_TECH_GUILDS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Trireme[ENDCOLOR] or [COLOR_POSITIVE_TEXT]Galleass[ENDCOLOR] constructed.'
,'TXT_KEY_TECH_COMPASS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -4% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Composite Bowman[ENDCOLOR] trained.'
,'TXT_KEY_TECH_MACHINERY_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]+20 [ICON_GOLD] Gold per turn[ENDCOLOR] you produce.'
,'TXT_KEY_TECH_BANKING_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]+5 [ICON_TOURISM] Tourism per turn[ENDCOLOR] you produce.'
,'TXT_KEY_TECH_PRINTING_PRESS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]+15 [ICON_PEACE] Faith per turn[ENDCOLOR] you produce.'
,'TXT_KEY_TECH_ASTRONOMY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]10 Military Might[ENDCOLOR].'
,'TXT_KEY_TECH_GUNPOWDER_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]+30 [ICON_RESEARCH] Science per turn[ENDCOLOR] you produce.'
,'TXT_KEY_TECH_CHEMISTRY_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Wonder[ENDCOLOR] controlled.'
,'TXT_KEY_TECH_ARCHITECTURE_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -3% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Imported Luxury[ENDCOLOR].' --todo
,'TXT_KEY_TECH_ECONOMICS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_GREAT_WORK] Great Works[ENDCOLOR] created.'
,'TXT_KEY_TECH_ACOUSTICS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]10 Sea Tile[ENDCOLOR] revealed.'
,'TXT_KEY_TECH_NAVIGATION_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]20 National Combat Experience[ENDCOLOR]'
,'TXT_KEY_TECH_METALLURGY_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -4% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Academy[ENDCOLOR] constructed.'
,'TXT_KEY_TECH_SCIENTIFIC_THEORY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: nothing'  --todo
,'TXT_KEY_TECH_RAILROAD_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]City with a [ICON_PRODUCTION] Production of 5+[ENDCOLOR].'
,'TXT_KEY_TECH_STEAM_POWER_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -1% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_RES_IRON] Iron[ENDCOLOR] controlled.'
,'TXT_KEY_TECH_RIFLING_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -1% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_GOLDEN_AGE] Golden Age turn passed at normal speed[ENDCOLOR].'
,'TXT_KEY_TECH_ARCHAEOLOGY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_RES_HORSE] Horse[ENDCOLOR] controlled.'
,'TXT_KEY_TECH_FERTILIZER_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_RES_COAL] Worked Coal Mine[ENDCOLOR].'
,'TXT_KEY_TECH_INDUSTRIALIZATION_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_RES_COAL] Coal[ENDCOLOR] controlled.'
,'TXT_KEY_TECH_DYNAMITE_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -6% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT][ICON_GREAT_GENERAL] Great General[ENDCOLOR] expended.'
,'TXT_KEY_TECH_MILITARY_SCIENCE_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -3% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]City with a [ICON_CITIZEN] Population of 3+[ENDCOLOR].'
,'TXT_KEY_TECH_BIOLOGY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT][ICON_GREAT_MERCHANT] Great Merchant[ENDCOLOR] expended.'
,'TXT_KEY_TECH_ELECTRICITY_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -10% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Resource Monopoly[ENDCOLOR] owned.' --todo
,'TXT_KEY_TECH_CORPORATIONS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -6% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Factory[ENDCOLOR] built.'
,'TXT_KEY_TECH_REPLACEABLE_PARTS_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -3% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Ironclad[ENDCOLOR] or [COLOR_POSITIVE_TEXT]Cruiser[ENDCOLOR] constructed or upgraded.'
,'TXT_KEY_TECH_COMBUSTION_HELP_EUREKA');

INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -2% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT][ICON_RES_OIL] Oil[ENDCOLOR] controlled.'
,'TXT_KEY_TECH_PLASTIC_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -5% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT][ICON_GREAT_MUSICIAN] Great Musician[ENDCOLOR] expended.'
,'TXT_KEY_TECH_RADIO_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -1% [ICON_RESEARCH] Cost for each [COLOR_POSITIVE_TEXT]Triplane[ENDCOLOR] built in the world by other Civilizations.'
,'TXT_KEY_TECH_FLIGHT_HELP_EUREKA');
INSERT INTO Language_en_US (Text, Tag)
VALUES ('Eureka: -3% [ICON_RESEARCH] Cost for every [COLOR_POSITIVE_TEXT]Past War[ENDCOLOR] fought.'
,'TXT_KEY_TECH_BALLISTICS_HELP_EUREKA');
I've improved your text files so that it looks professional and pretty to the human eye.
On your Lua coding however...

Add elseif statements.
This code
Code:
        if(featureType == FeatureTypes.FEATURE_FOREST) then
            nbForest = nbForest + 1;
        end
        if(featureType == FeatureTypes.FEATURE_JUNGLE) then
            nbJungle = nbJungle + 1;
        end
        if(terrainType == TERRAIN_TYPE_DESERT) then
            nbDesert = nbDesert + 1;
        end
        if(terrainType == TERRAIN_TYPE_MOUNTAIN) then
            nbMountain = nbMountain + 1;
        end
        if(terrainType == TERRAIN_TYPE_TUNDRA) then
            nbTundra = nbTundra + 1;
        end
Should just be simplified to
Code:
        if(featureType == FeatureTypes.FEATURE_FOREST) then
            nbForest = nbForest + 1;
        elseif(featureType == FeatureTypes.FEATURE_JUNGLE) then
            nbJungle = nbJungle + 1;
        end
        if(terrainType == TERRAIN_TYPE_DESERT) then
            nbDesert = nbDesert + 1;
        elseif(terrainType == TERRAIN_TYPE_MOUNTAIN) then
            nbMountain = nbMountain + 1;
        elseif(terrainType == TERRAIN_TYPE_TUNDRA) then
            nbTundra = nbTundra + 1;
        end
The game will process marginally faster, but considering this is a heavy Lua-checking mod. It helps significantly. Be sure not to do elseif where statements don't match as shown above. (Don't make elseif if a tile can be both a tundra and forest for obvious logic reasons)

local iUnitType = pUnit:GetUnitType();
Why not pUnit:GetUnitClassType() and reflect upon those unitclasses, so custom civilizations can be compatible as well? The human mind is easily forgettable because you forgot Merchant of Venice being expended and not being counted for electricity and even the Khan for Military Science. whereas using the UnitClass guarantee that only this unitclass expended will be counted toward Eurekas rather than hardcoding toward specific units and her unique units.

"must have built these buildings" Eurekas
Player:GetBuildingClassCount(BuildingClassType buildingClass) works wonders, so you don't have to do a CityConstruct check everytime. Although it has a delay in getting the value, it works better and was already in the vanilla DLL.

Also you should set up global variables so that the Game doesn't have to use GameInfo.blahblah all the time to reduce turn processing times. (0.05 second is a big difference like bane_ said when you expand it across a 500 turn game!)
 
Last edited:
V3, Thanks for your feedback.

I've improved your text files so that it looks professional and pretty to the human eye.
On your Lua coding however...
Thank you very much! it's now added.

Why not pUnit:GetUnitClassType() and reflect upon those unitclasses, so custom civilizations can be compatible as well? The human mind is easily forgettable because you forgot Merchant of Venice being expended and not being counted for electricity and even the Khan for Military Science. whereas using the UnitClass guarantee that only this unitclass expended will be counted toward Eurekas rather than hardcoding toward specific units and her unique units.
It's right, thank you. It's changed.

Player:GetBuildingClassCount(BuildingClassType buildingClass) works wonders, so you don't have to do a CityConstruct check everytime. Although it has a delay in getting the value, it works better and was already in the vanilla DLL.
It's better to use building class, but i think it run slower than using the CityConstruct callback. Anyway, it's changed now.

Also you should set up global variables so that the Game doesn't have to use GameInfo.blahblah all the time to reduce turn processing times. (0.05 second is a big difference like bane_ said when you expand it across a 500 turn game!)
Yeah, i know, it's done now.

This code
Code:
        if(featureType == FeatureTypes.FEATURE_FOREST) then
            nbForest = nbForest + 1;
        end
        if(featureType == FeatureTypes.FEATURE_JUNGLE) then
            nbJungle = nbJungle + 1;
        end/code]
Should just be simplified to
[code]
        if(featureType == FeatureTypes.FEATURE_FOREST) then
            nbForest = nbForest + 1;
        elseif(featureType == FeatureTypes.FEATURE_JUNGLE) then
            nbJungle = nbJungle + 1;
        end
The game will process marginally faster, but considering this is a heavy Lua-checking mod. It helps significantly. Be sure not to do elseif where statements don't match as shown above. (Don't make elseif if a tile can be both a tundra and forest for obvious logic reasons)
No, i don't think so (and it's complicated to explain. in short: adding dependencies to almost-always-false conditional jumps lead to micro-ops not optimized for parallel execution). But maybe i'm wrong for the lua virtual machine, do you have hard data to back this claim?
 
Last edited:
Many coders recommend using elseif if the dependencies share a common type. Consider the example again.
Code:
       if(terrainType == TERRAIN_TYPE_DESERT) then
            nbDesert = nbDesert + 1;
        end
       if(terrainType == TERRAIN_TYPE_GRASS) then
            nbGrass = nbGrass + 1;
        end

Let's say we do a tile check to see if it's grass or desert. Logically Lua has to issue out four commands. Obtain terrainType's data twice and determine if the data match with the if statements twice. Doesn't matter in terms of results as a tile will either be desert or grass(not considering tundra and the likes).

Code:
       if(terrainType == TERRAIN_TYPE_DESERT) then
            nbDesert = nbDesert + 1;
       elseif(terrainType == TERRAIN_TYPE_GRASS) then
            nbGrass = nbGrass + 1;
        end
Now what if I did elseif statements instead? Lua only has to issue out three commands. Obtain terrainType and determine if it matches with desert. If not, see if it matches with grass.


So, what's the difference? Let's say if you have a tile that is desert, the elseif code would save you processing by a marginal time, but still significant. Lua no longer has to check if it's grass because they know terrainType already matches as a desert whereas your two if statements would cause both to be processed regardless.


Or for those not familiar to Lua:
In general, "else if" style can be faster because in the series of ifs, every condition is checked one after the other; in an "else if" chain, once one condition is matched, the rest are bypassed.
 
Last edited:
I know that... it's not the problem... (and i didn't see the difference in the number of times terrainType is loaded in a registry: it's two times in the two codes snippet if the cpu doesn't have enough reg, or one time in the two code if it is able to optimize. And the first code is easier to optimize for the cpu)
It's a chore to explain....
Spoiler :

Code:
    if(iUnitClassType == kUNITCLASS_ARCHER) then
        IncrementEureka(pPlayer, kTECH_ARCHERY, 6);
    end
=>
Code:
LOAD iUnitClassType -> regA
LOAD kUNITCLASS_ARCHER -> regB
COMPARE regA regB -> regA
JUMPZ : endif1
PUSHHEAP pPlayer
PUSHHEAP kTECH_ARCHERY
PUSHHEAP 6
CALL IncrementEureka
endif1: NOP
which can be simplified as
Code:
(kUNITCLASS_ARCHER + kUNITCLASS_ARCHER) -> JUMPZ -> IncrementEureka

now with
Code:
    if(iUnitClassType == kUNITCLASS_ARCHER) then
        IncrementEureka(pPlayer, kTECH_ARCHERY, 6);
    end
    if(iUnitClassType == kUNITCLASS_WORKBOAT) then
        IncrementEureka(pPlayer, kTECH_OPTICS, 6);
    end
    if(iUnitClassType == kUNITCLASS_SPEARMAN) then
        IncrementEureka(pPlayer, kTECH_IRON_WORKING, 6);
    end
we have 3 different and independant branches
Code:
(iUnitClassType + kUNITCLASS_ARCHER) -> JUMPZ -> IncrementEureka
(iUnitClassType + kUNITCLASS_WORKBOAT) -> JUMPZ -> IncrementEureka
(iUnitClassType + kUNITCLASS_SPEARMAN) -> JUMPZ -> IncrementEureka

with the elseif, we have 1 big branch:
Code:
    if(iUnitClassType == kUNITCLASS_ARCHER) then
        IncrementEureka(pPlayer, kTECH_ARCHERY, 6);
    else if(iUnitClassType == kUNITCLASS_WORKBOAT) then
        IncrementEureka(pPlayer, kTECH_OPTICS, 6);
    else if(iUnitClassType == kUNITCLASS_SPEARMAN) then
        IncrementEureka(pPlayer, kTECH_IRON_WORKING, 6);
    end
=>
Code:
(iUnitClassType + kUNITCLASS_ARCHER) -> JUMPZ ->
     (IncrementEureka or (iUnitClassType + kUNITCLASS_WORKBOAT) -> JUMPZ ->
           (IncrementEureka or (iUnitClassType + kUNITCLASS_SPEARMAN) -> JUMPZ -> IncrementEureka) ) )

What's going on inside the processor (with branch prediction)
case 1 : 3 branches: The proc's core work the three branch, with the branch prediction saying "false" to each if. If a branch prediction fail, it has only to re-execute that small branch. The proc's core can execute each branch in // with his multiple ALU.
case2: 1 branch: The proc's core work the big branch, with the branch prediction saying "false" to each if. If a branch prediction fail, it has to re-execute this big branch from the point where if fail. The proc's core may not be able to execute the code in // (depends on the branch prediction implementation) because each part depends on the result of the previous one.

The elseif is useful when a if is almost always true (the first if possible). It's not our case here.

Conclusion: At best, the code 2 can be as good as the first one. Branch prediction is king. Pipeline length is a *****.
 
Last edited:
I know that... it's not the problem... (and i didn't see the difference in the number of times terrainType is loaded in a registry: it's two times in the two codes snippet if the cpu doesn't have enough reg, or one time in the two code if it is able to optimize. And the first code is easier to optimize for the cpu)
It's a chore to explain....
Spoiler :

Code:
    if(iUnitClassType == kUNITCLASS_ARCHER) then
        IncrementEureka(pPlayer, kTECH_ARCHERY, 6);
    end
=>
Code:
LOAD iUnitClassType -> regA
LOAD kUNITCLASS_ARCHER -> regB
COMPARE regA regB -> regA
JUMPZ : endif1
PUSHHEAP pPlayer
PUSHHEAP kTECH_ARCHERY
PUSHHEAP 6
CALL IncrementEureka
endif1: NOP
which can be simplified as
Code:
(kUNITCLASS_ARCHER + kUNITCLASS_ARCHER) -> JUMPZ -> IncrementEureka

now with
Code:
    if(iUnitClassType == kUNITCLASS_ARCHER) then
        IncrementEureka(pPlayer, kTECH_ARCHERY, 6);
    end
    if(iUnitClassType == kUNITCLASS_WORKBOAT) then
        IncrementEureka(pPlayer, kTECH_OPTICS, 6);
    end
    if(iUnitClassType == kUNITCLASS_SPEARMAN) then
        IncrementEureka(pPlayer, kTECH_IRON_WORKING, 6);
    end
we have 3 different and independant branches
Code:
(iUnitClassType + kUNITCLASS_ARCHER) -> JUMPZ -> IncrementEureka
(iUnitClassType + kUNITCLASS_WORKBOAT) -> JUMPZ -> IncrementEureka
(iUnitClassType + kUNITCLASS_SPEARMAN) -> JUMPZ -> IncrementEureka

with the elseif, we have 1 big branch:
Code:
    if(iUnitClassType == kUNITCLASS_ARCHER) then
        IncrementEureka(pPlayer, kTECH_ARCHERY, 6);
    else if(iUnitClassType == kUNITCLASS_WORKBOAT) then
        IncrementEureka(pPlayer, kTECH_OPTICS, 6);
    else if(iUnitClassType == kUNITCLASS_SPEARMAN) then
        IncrementEureka(pPlayer, kTECH_IRON_WORKING, 6);
    end
=>
Code:
(iUnitClassType + kUNITCLASS_ARCHER) -> JUMPZ ->
     (IncrementEureka or (iUnitClassType + kUNITCLASS_WORKBOAT) -> JUMPZ ->
           (IncrementEureka or (iUnitClassType + kUNITCLASS_SPEARMAN) -> JUMPZ -> IncrementEureka) ) )

What's going on inside the processor (with branch prediction)
case 1 : 3 branches: The alu work the three branch, with the branch prediction saying "false" to each if. If a branch prediction fail, it has only to re-execute that small branch. The proc can execute each ranch in // with his multiple ALU.
case2: 1 branch: That alu work the big branch, with the branch prediction saying "false" to each if. If a brach prediction fail, it has to re-execute this big branch from the point where if fail. The proc may not be able to execute the code in // (depends on the branch prediction implementation) because each if depends on the result of the previous one.

The elseif is useful when a if is almost always true (the first if possible). It's not our case here.

Conclusion: At best, the code 2 can be as good as the first one. Branch prediction is king. Pipeline length is a *****.

Your preference and choice.
 
I'm trying this mod and really enjoying, thanks for creating and sharing. I've noticed a couple of minor bugs until now:
  • Calendar: Maximum discount is 50%.
  • Writing: Notification after research a new Classical tech is empty, only showing Icon and tittle of the notification "Writing".
 
I don't clearly see what the moto for eurekas is. You say something about achieving difficult missions, but it looks more like rewarding with 'a cheaper technology that fits how you are playing' to me.
Like that, if I happen to have some wheat nearby, my population is going to grow very fast, so I will be able to send some Settlers pretty soon, and granaries will be quite good. For that I will research Pottery early. Now, the eureka is taking this thought from the player and is saying 'here, here, pick this technology first, as it is going to work well with this starting location'. And you probably will pick the cheaper technology, as it really fits. That's one way to do it.

By 'achieving difficult missions', I thought that this was going to be like city states missions, where you get rewarded for fulfilling the difficult mission. Something like 'be the first to clean three barbs camps to get Mining for free'. Where every new mission starts once the previous techs are discovered, like Bronze Working mission launching when Mining is discovered, and the Bronze Working mission being something like 'be the first one to kill 10 enemy units'. But let's not change too much what you already have made.

Sticking with the 'reward playstyle with appropiate techs discount', I've taken a look at your ancient eurekas. (BTW, what is the intended mean discount for best cases? 20%? up to 50%?)

Tier 1

TRAPPING. I want this when nearby food is scarce. It's also useful for forest and coastal start locations (leading to herbalist and fishing boats). I will rush it if I have sea luxuries nearby. I will prioritize it if I'm planning on settling along the coast, before the first settling wave.
What about '-2% for every sea tile or forest tile within 2 range'. (It depends on which is your attempted mean discount).

ANIMAL_HUSBANDRY. The main reason I rush this is because I want to find HORSES. They are mostly found on plains. So make unfeatured plains trigger it. '-5% every 3-4 plains without features within 2 tiles'.

MINING. Mineable luxuries are quite rare. Other reasons for rushing mining can be: wells, mines on hills and rushing for Bronze Working. Unfeatured hills, lack of fresh water can be the triggers.

Tier 2

BRONZE WORKING. I know you want it for chopping, but I prefer it for finding Iron and produce spearmen. '-10% for every 3 standing warriors'.

CALENDAR. Getting luxuries isn't really so important. It's much better the Market, specially when your budget is low. You know you want markets when you are in red numbers. '-2% for every negative net income (max 20%)'.

MASONRY. I don't feel like rushing quarries, as it only is useful in one of my cities. Theorically it's good for wonder building, but I just build one ancient and one classical wonder, if any, mostly because I don't want to underdevelop my capital. I take this mostly for the walls, if I'm expanding heavily. So '-4% for owned cities'. Although quarries are more thematic.

ARCHERY. You are not going to chop Jungles in a while, so an Herbalist is what you need to grow in the meantime. '-2% every 3 forests, -3% every 3 jungles'. (Yes, it repeats bonuses from jungles, why not?). I understand the bonus for the desert (Petra), but don't get the one for the mountains, anyway, I wouldn't use wonders for the requirements, as only one civ will get them.
 
There appears to be an error in the dependencies. The mod depends on the CP, but the newly updated 43 civ CP is not included in possible masters, so you can't use this mod along with the 43 civ version.
 
i will look at it.
For now, you can edit the .modinfo and remove the two line under "<Dependencies>"
 
This is an awesome idea, and I wish you good luck and hope it will be farther developed!

Can you elaborate how do you get the Eurekas and the rest? I didnt play civ 6.
 
Top Bottom