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

Quick Modding Questions Thread

Discussion in 'Civ4 - Creation & Customization' started by kiwitt, Jan 27, 2010.

  1. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,908
    The editor is a very simple application. It only alters the file when you save. The game loads the file from the disk, meaning if it shows up ingame, then you saved the file and the editor is done. The editor is too simple to be able to save old versions of the file meaning it can't revert tga files.

    The fact that ignoring the launcher fixes the problem strongly indicates that the problem is the launcher and not the editor. You need to look into what that launcher does.
     
  2. robbyextreme

    robbyextreme Warlord

    Joined:
    Oct 4, 2003
    Messages:
    265
    Hi does anyone know how to keep the background music playing when entering city screens? it switches to that city screen song by default which I don't want.
     
  3. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,373
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Yes, it IS the launcher. I solved that by replacing gamefont_asian.tar and gamefont_latin.tar by 0byte dummy files in assets/res/fonts.
     
  4. vekkna

    vekkna Chieftain

    Joined:
    Nov 23, 2004
    Messages:
    1
    Hello,

    Could someone point me in the right direction please: I'd like to have units get an attack bonus when attacking from certain terrain. I've looked through the xml files, which are the only thing I've modded so far, but didn't find anything relevant there.

    If anyone could tell me where to start I'd be very grateful.

    Best,

    Neil
     
  5. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    60
    I do not believe this is possible, bonus can only be applied to the destination tile where the battle takes place.
     
  6. Leoreth

    Leoreth Friend Next Door Moderator

    Joined:
    Aug 23, 2009
    Messages:
    35,098
    Gender:
    Male
    Location:
    Faraway
    It is certainly possible, but not with XML only. You would have to recompile the DLL, and even then it's quite a bit of work (adding a new unit XML property, adding the new unit attribute, add it to the combat resolution code etc.). But if you are willing to put in that much work and can compile the DLL, let me know and I can give you some pointers.
     
  7. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,373
    Gender:
    Male
    Location:
    In a constant brainstorm...
    I am still struggling in my AND2 modmod with infinite loop issues and clueless.
    Could someone experienced take a look at the log files? Maybe he can see immediately what I don't and give me a clue about my issues.
    THX!

    Settings, in case you want to know it:
    upload_2019-8-22_19-34-5.png
     

    Attached Files:

  8. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    994
    Location:
    Germany
    @Zeta Nexus:
    Whole lotta logs. It seems to me – and I think that's been your conclusion as well – that the last entry in any of the logs of the first game is
    Code:
    [184.159] Player Queendom of Francja switches from Monarchy to Empire
    [184.174] Player Queendom of Francja switches from Warlords to Theocracy
    [184.174] Player Queendom of Francja switches from Clans to Caste
    I've only briefly looked at those from game 2, but, apparently, it's almost the same situation:
    Code:
    [439.532] Player Rzád Tymczasowy Tajów switches from City-state to Empire
    [439.532] Player Rzád Tymczasowy Tajów switches from Warlords to Theocracy
    [439.532] Player Rzád Tymczasowy Tajów switches from Clans to Caste
    While there could, in theory, be problems with the civics evaluation (like picking an illegal combination of civics), that's not where the game gets stuck, it's something in the aftermath of the revolution, and it could well be due to this particular combination of civics (even the old civics are almost the same in both cases).

    In CvPlayerAI::AI_doTurnPre and CvPlayer::doTurn, I don't see any logger calls after AI_doCivics, at least not in the next 10 or so functions, so it's difficult to narrow the problem down. :( With a debugger, things should be quite easy from here: set a breakpoint in CvPlayer::revolution and press F10 until the game freezes.
     
  9. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,908
    If you are skilled enough to use fancy stuff like debuggers, then I would recommend starting out with profiling. Just let the game freeze, start profiling and then 100% of the CPU time will be spend in the loop. You can then start over with a debug build, let it get stuck again and add a breakpoint in that loop to walk through what happens there.

    Yes I know it requires a bit of knowledge of debuggers and profilers to do this, but if you can do it, then it's the best way to identify the cause of any freezing game.
     
  10. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    994
    Location:
    Germany
    The biggest hurdle here is probably to compile the code. After that, attaching the debugger shouldn't be a big deal. Neither is installing a profiler probably (the internal one is no help). I know you've been recommending Very Sleepy and I intend to give that a try sometime.
     
  11. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,373
    Gender:
    Male
    Location:
    In a constant brainstorm...
    Thank you guys so much. I was suspecting that it is something with the civics but my changes dind't solve the issue and I became so confused that I just gave up and cried for help.
    Now I'll try again.
    Thx!
     
  12. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    994
    Location:
    Germany
    In retrospect, I think you you were close to fixing the problem on your own, but, since you had been at it for quite some time, I've gone ahead, set up my development environment for Chronicles of Mankind and debugged @ablackshoe's save. The infinite loop started directly in CvPlayer:: processCivics; so, with the work that you and the (other) Chronicles players had already done, a profiler run really wasn't needed anymore. I've posted some specifics in the Chronicles thread.
     
  13. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    60
    Quick resource question, where and how do I change the small ( ) icon for a resource? I have got the button and resource itself images working but i can’t figure out how to modify the icon that is used in trade screens etc.
     
  14. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,908
    You should look into GameFont. There is a thread about GameFont issues with explanations and stuff. The editor mentioned is GameFontEditor, which is a must have for anybody doing anything with GameFont.
     
  15. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    4,373
    Gender:
    Male
    Location:
    In a constant brainstorm...
    I had sattisfying results with Gimp too :blush:
    I didn't know of that editor though, so thx for the info.
     
  16. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    994
    Location:
    Germany
    Just a brief addendum: I've tried out Very Sleepy now because I just had another infinite loop in my own code – and it's really extremely easy to use, at least together with the profile configuration in your makefile. I didn't have to read a single line of documentation. :thumbsup:
     
    Nightinggale and KaTiON_PT like this.
  17. Underdog Ally

    Underdog Ally Chieftain

    Joined:
    Feb 22, 2019
    Messages:
    60
    Thanks I looked into these threads and will explore using the editor later to try and add some font symbols for a few resources
     
  18. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,908
    Remember it's equally simple to use when your goal is to identify slow parts of the code. I managed to reduce the AI waiting time by around 40% in Religion and Revolution (later We The People) simply by using Very Sleepy to identify slow parts and then replace function calls with cached values (particularly GC.getDefineINT, which is actually rather slow). Identifying stuck loops is just a bonus.
     
  19. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    994
    Location:
    Germany
    @Nightinggale: Will try that too. I've been using the internal profiler, but getting a "second opinion" is probably prudent.
     
  20. OzzyKP

    OzzyKP Emperor

    Joined:
    Dec 16, 2000
    Messages:
    1,729
    Location:
    Washington, DC USA
    How do I move something from a trait or a civic to a building? (and vice versa?) I see there is the TradeYieldModifiers option for traits & civics, but I'd like to add it to buildings. How do I do that?
     

Share This Page