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

DLL - Various Mod Components

Discussion in 'Civ5 - Mod Components' started by whoward69, Nov 4, 2012.

  1. shlorder

    shlorder Chieftain

    Joined:
    Oct 27, 2018
    Messages:
    1
    Hello. I am working on a Mod which allows naval units to pillage coastal land tiles like Civ6. Once player select the pillage button, available pillage targets (adjacent land tiles that have improvement) should be highlighted, so that player can choose the target tile. It should be similar to this. ( https://forums.civfanatics.com/threads/allowing-air-units-to-pillage-tiles.631140/ ) But I don't know how to use your mod to create a custom mission that requires player to select a target. When I look inside the dll codes, I find those encoded range missions (move to, range attack, etc) use iData1 and iData2 to record the position target plot. But it doesn't work for custom missions as I tested.
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    As per the response in the thread you linked to, you'll need to solve the "how to put up a range strike arrow" and the code for that is in Lua IIRC

    Edit: Digging into this some more, you're going to either need a LOT of Lua, or mod the CvUnit::CanRangeStrikeAt() method to not require a unit or a city on the target plot
     
    Last edited: Oct 31, 2018
  3. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    Github Bug Report and Located Simple Fix

    https://github.com/whoward69/DLL-VMC/issues/3

    Hi I'm Tawa, I always found late game tech overflow in my modpack, tech point needed in one tech must smalller than 210,000 and I've found the fix:

    The fix is simple: At line 1524 of:
    https://github.com/whoward69/DLL-VM...4b/CvGameCoreDLL_Expansion2/CvTechClasses.cpp

    iResearchCost = ((iResearchCost * 10000) / iResearchMod);
    iResearchCost = iResearchCost * (100 + iMod) / 100;

    use double or long temperately calculate iResearchCost should help.

    DLL-VMC is really a nice and irreplaceable mod btw.
    looking foward to DLL-VMC v90
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    Under what circumstances does this occur? I'm guessing marathon games, but are you also using a mod to extend research times?
     
  5. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    I use SuperPower mod as main mod in pack, which extends the game by 2 eras and has ~100,000 base tech point at end game to get one tech. after consider the amount of cities it overflows.

    Also I use 22 civ in 180 * 110 pangea map and have ~ 200 cities, and always found late game tech overflows. (at the begining of the game no overflow, when atom age, the Future age techs overflows. might because of the city amount.) I've played for a month to get atom age...When I keep playing, the tech that starts to overflow is getting earlier.

    Please help, a lot user of this mod is suffering from this overflow, and we need 3 simple code change (no more than 20 characters in all, see below) and compile.
     

    Attached Files:

    Last edited: Aug 15, 2019
  6. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    The game speed is the one between normal and marathon, that is default speed of SuperPower. The mod has ~60 new tech ~200new unit and buildings, and 2 new era. I use Extreme large map with map mod, with 2% increase for each city(including :c5puppet:) tech point needed to a new tech.

    line 1524:
    iResearchCost = ((iResearchCost * 10000) / iResearchMod);

    int iMod = GC.getMap().getWorldInfo().GetNumCitiesTechCostMod(); // Default is 40, gets smaller on larger maps
    iMod = iMod * m_pPlayer->GetMaxEffectiveCities(/*bIncludePuppets*/ true);
    iResearchCost = iResearchCost * (100 + iMod) / 100;

    if iResearchCost is 220,000 , iResearchCost will directly overflow at line 1524 when * 10000, also possible overflow at line iResearchCost = iResearchCost * (100 + iMod) / 100;

    But these first * then / is temporary, so changing iResearchCost from int to long at first is helpful. When return, cast to int. This change does not affect other part of code.:c5happy:

    https://github.com/whoward69/DLL-VMC/pull/4/commits/0d2428f9d31326fed56f164eb623743fbf4c2feb
     
    Last edited: Aug 15, 2019
  7. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    Is it possible to apply this small change into new Version of DLL-VMC with only 20-character source editing? This 20-character source change does not breaks any existing code part, and will not have any compatibility issues.
     
  8. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    I looked at your push request when I got the notification, but unfortunately it does not follow the required conventions - missing conditional compilation markers (#if, #else, #endif etc) - see my first DLL tutorial if these terms don't mean anything.

    I've also been in the middle of completing the Automaton Workers code move to traits, buildings and policies - a not insignificant series of code changes and associated mods to write/test.

    V90 of the DLL is now on my web site and the code is on GitHub
     
    Last edited: Aug 20, 2019
  9. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    wmm..Thank you for your kindness:c5happy::c5happy:
    I've fully tested v90 and found my kind of fix is not useful, the tech points needed is still negative and still 1 turn to get tech, then I edit cost in CIV5Technologies.xml and I can found this negative tech point bug in non-modded games, the tech points needed must < ~210,000 otherwise negative. (Also I cleanned my cache folder every time).

    this "tech points needed" and "how many turns needed to get tech" in techtree UI is not only visually negative, but also practically negative, i.e. I can get this tech in 1 turn as the UI says.

    I also found "tech points needed" in techtree UI doesn't related to city amount, but "how many turns needed to get tech" do.

    So, is there any clue to fix this problem? maybe some changes in DLL or/and XML/LUA are needed?
    at line 1480 I found another * 10000 >-<
     
  10. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    Try the attached. If it fixes the issue I'll release it as V91

    See below
     
    Last edited: Aug 27, 2019
  11. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    After Test the new version, unfortunately the tech still overflow and I can still get the tech in 1 turn as the UI says.
    In CIV5Technologies.xml I changed Archery tech to cost 70000 and in marathon games the overflow happens.

    I think the number overflow happens somewhere in a chain of int: calculating, function calling, UI displaying etc.. Now the Last step UI displaying is overflow and I can infer that there is overflow in the former step. all of the numbers in the chain should be long. Maybe my analysis is helpful for your debugging.
     
  12. Exletrum

    Exletrum Chieftain

    Joined:
    Jun 5, 2018
    Messages:
    96
    try using less tech cost coefficient
    This can help (MB 999+ not 99999999999)
    I had this
     
  13. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    Not what I'm seeing, see attached which are unmodded/modded games with stdandard map + standard speed vs huge map + marathon speed. As you can see, the display is as expected.

    Check the version of the DLL in CustomMods.log, it should be "Version 91 - Build Aug 23 2019 13:05:15"
     

    Attached Files:

  14. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    I apologize that I use wrong dll last time. This time I replace dll file with new one and got a huge step forward:
    the science needed is not overflow now, and the turn needed to get the tech still overflow, which is differ from your 4th attached. And I can still get the tech as the UI says.

    I changed Archery tech to cost 70000 and tested in marathon huge games.
    I also found the log shows Version 91 - Build Aug 23 2019 11:21:01, at log line 284:

    CvTechClasses.cpp[1526]: CvPlayerTechs::GetResearchCost - Base cost for tech 3 is 273000
    CvTechClasses.cpp[1531]: CvPlayerTechs::GetResearchCost - with player mod is 27300000
    CvTechClasses.cpp[1537]: CvPlayerTechs::GetResearchCost - with cities mod is 27846000
    CvTechClasses.cpp[1545]: CvPlayerTechs::GetResearchCost - with fudge is 278460
    CvTechClasses.cpp[1547]: CvPlayerTechs::GetResearchCost - final is 278460
    these numbers are pretty perfect:c5happy:
     

    Attached Files:

  15. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    Ah, I attached the "only half baked" solution … oops

    V91 now on my web site and GitHub with both fixes in place
     
  16. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    Sorry, but I have no idea what you're trying to do.
     
  17. Exletrum

    Exletrum Chieftain

    Joined:
    Jun 5, 2018
    Messages:
    96
    Unfortunately it will come to a standstill

    Updated:
    It is not surprising that you could not help me. Even after reading all the changes from the creator, not a word is mentioned about it. I think the matter is something else

    I was thinking of somehow changing the values INSIDE DLL file

    This code helps solve the problem, but I would like to see no AI shutdown completely
    <Update>
    <Where Name="AI_SMART_V3"/>
    <Set Value="0"/>
    </Update>

    That is, my idea is not compatible with modifications to improve AI.

    If you do not know, then I hope there is a person who will bring the matter to mind :(

    Thanks anyway for your reply


    I won’t spam and will stand here separately
    Have you ever seen this "picture"?
    -130 gold per turn?
     
    Last edited: Aug 28, 2019
  18. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    With new v91 , this time I got another huge step forward: The UI is all correct. No overflow in tech point needed and turn needed.
    But I can still get the tech in 1 turn >_< , while UI says I need 69615 turn.
     

    Attached Files:

  19. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,399
    Location:
    Near Portsmouth, UK
    Sorry, not understanding. Can you give me the simple steps to follow (eg edit XML so archery costs 77000, start game with these options, do these steps, see this outcome, etc) to reproduce this.
     
  20. Tawa

    Tawa Chieftain

    Joined:
    Aug 13, 2019
    Messages:
    10
    Gender:
    Female
    Um, I changed Archery tech to cost 70000 and tested in marathon huge map games with 12 civs. level 4 AI. Pangea map.
    I then build the first city and open tech tree and saw archery tech need 278460 science and 69615 turns.
    To this point every thing seems fine, and I click archery tech to research it , move my unit , build some buildings and click next turn.
    Then, I get archery in the next turn.
    Also get 70000 extra tech points to research any other tech in tech tree.
     

Share This Page