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

Sub Bug Fix and other Adventures in EXE Modding

Discussion in 'Civ3 - Creation & Customization' started by Flintlock, Jan 28, 2021.

  1. Flintlock

    Flintlock King

    Joined:
    Sep 25, 2004
    Messages:
    682
    Your AV is detecting "TR/Hijacker.Gen", I'm guessing "Gen" is short for "Generic" and I don't know what "TR/" means. Describing the mod as a hijacker is accurate, I would just object to the word's negative connotations. The mod works by packing additional code into the Civ executable then modifying it so that it runs the injected code instead of, or in addition to, its own. This is called hijacking and it's a technique sometimes used by viruses, for example they could try to hide by writing themselves into a base Windows program so that they don't appear in task manager. The mod uses this technique but not for nefarious purposes, and there's nothing I can do to fix this because it's the only way to implement a mod of this kind. And if you don't trust me, the mod is fully open source. You can read INSTALL.bat and ep.c (which is what gets compiled to produce temp.exe) with any text editor.
     
    Tsubasanut and tjs282 like this.
  2. Predator145

    Predator145 Warlord

    Joined:
    May 22, 2020
    Messages:
    139
    Gender:
    Male
    It seems like I can't get the new patch to work unless I run the game from the C3X Run command instead of the usual shortcut.

    The artillery and armies work splendidly. However, it seems like the AI still doesn't know how to transport artillery pieces overseas. This becomes very apparent when testing in the WW2 Pacific scenario.
     
  3. Flintlock

    Flintlock King

    Joined:
    Sep 25, 2004
    Messages:
    682
    Do you get an error message?
    Yeah, I'm pretty sure the AI can't take artillery along for naval invasions. That's something I'd like to fix at some point, in fact I'd like to improve the AI's ability to do naval invasions in general, but from what I've seen so far it would be difficult to do.
     
    Predator145 likes this.
  4. Predator145

    Predator145 Warlord

    Joined:
    May 22, 2020
    Messages:
    139
    Gender:
    Male
    I don't get any error message. The game just runs without the newest patch. Upon testing I saw the artillery and armies not doing anything. But one can easily tell if the patch is kicking in or not by how fast and smooth the units move when you turn off animations.

    The holy grail of naval invasions would be for the AI to transport all its assets, not just offense, defense and settlers and behave like PTW with its navy. If its warships aren't tied down escorting but is killing your fleet and bombarding your shores/cities its sheer numbers on higher difficulties will make your chances of sinking even unescorted transports slim.

    The strangest thing is that when I flagged artillery units as "air bombard" the AI would actually transport them with ships, land them next to my cities. They then have the rebase button and 5 operational range on top of 5 bombard range to move but I don't know if they know how to do that if being outside of a city/airbase/carrier. It seems like once that happens they're just stuck there.
     
    Last edited: Jun 6, 2021
  5. Rômulo Prado

    Rômulo Prado Chieftain

    Joined:
    Mar 16, 2017
    Messages:
    9
    Gender:
    Male
    Hello Predator 145, when you launched the INSTALL.bat did you notice if the temp.exe file was created? I noticed that AV Programs are now blocking or even quarantining the temp.exe file. One solution is to temporarily disable the realtime monitoring solution and launch INSTALL.bat once that is done, you re-enable the realtime monitoring of your AV program again.

    Now regarding the loading of artillery pieces and their landing on the battlefront, the mod has not yet addressed such a solution.
     
    Predator145 likes this.
  6. Flintlock

    Flintlock King

    Joined:
    Sep 25, 2004
    Messages:
    682
    On a similar note, I was able to make the AI take artillery units along for naval landings by forcing them to use the land offense unit AI. But I don't think there's any point making the AI take artillery along until I can make it land much larger stacks overall. As long as the AI is limited to landing one or two transport's worth of units at a time, it's probably better that it lands only combat units without artillery.
    Antivirus is a real problem for R6. I uploaded temp.exe to Virus Total and it triggered 30 (!) different AVs including all the major ones. So I'm going to have to do something about this, much to my annoyance. Earlier I said there was nothing I could do but that was before I thought about the problem. One relatively easy change I can make is to exclude the process patching code from temp.exe. Currently, the entire contents of ep.c gets compiled into temp.exe including both the EXE file patcher and the process patcher, and then INSTALL.bat passes a command line argument when it launches temp.exe telling it to perform the EXE file patching. Instead I'll create a preprocessor define that determines if ep.c gets compiled into a runner or installer, so that way INSTALL.bat can compile it into an installer without the extra code it doesn't need. This should fix the problem, or at least help, assuming AVs are detecting the process patching code.
     
    Predator145 likes this.
  7. ynot56

    ynot56 Warlord

    Joined:
    Jun 29, 2008
    Messages:
    158
    Probably you are not able to do this, but...

    Often when there is one turn left for a scientific advance, your science rate is higher than it needs to be. I then adjust it down until it is at the lowest rate that will still allow the advance in one turn. I then have to remember to juice science back up again. If somehow your magic could be extended to that, it would be very helpful.
     
  8. vmxa

    vmxa Deity Supporter

    Joined:
    Feb 9, 2004
    Messages:
    13,891
    Location:
    Oviedo, Fl
    I have only started to read this thread, but I wanted to ask about a way to disable the automation of workers or changing it location or its hotkey. IOW I am sick of accidentally automating workers.
     
  9. Flintlock

    Flintlock King

    Joined:
    Sep 25, 2004
    Messages:
    682
    I've been thinking about this already. It would probably be tricky to implement because I don't see any good place to inject the code and because if it's not done properly the feature could end up fighting with the player. The player has a lot of opportunities to adjust the sliders manually including immediately after a tech has been researched (through the "show me the big picture" option) so if the slider is automatically decreased then the player increases it in the meantime, the code needs to detect that and not further increase it. Another option is to just have a warning about excessive science spending but that might be more annoying than convenient.
    This should be easy, I think I already know how to do it. Both suggestions added to the list.
     
  10. tjs282

    tjs282 Stone cold fish

    Joined:
    May 19, 2009
    Messages:
    3,529
    Gender:
    Male
    Location:
    Planet Earth. Possibly.
    TBH, I don't think it's necessary/desirable for your patch to auto-adjust the slider-setting itself.

    But a(nother) simple end-of-turn pop-up reminder on the last turn of research ("Research will overrun by XX beakers this turn. Do you want to reduce Science spending?") — with a link from the pop-up directly to the Domestic Advisor, if the player clicks "Yes" — would probably be enough. I don't think this would be annoying, since it's only going to show up every 4T, at its most frequent.

    Or if the problem is the player forgetting to crank Science back up over the interturn (using "WTBP?") or before the end of the following turn, then a pop-up could rather warn about a low Science-slider setting instead? The drawback to the latter is that it would also show any time the player was deliberately running low SCI% — but there are generally 2 circumstances when that would be done:

    (1) when treasury is low (gold < 50?), and/or a higher SCI%-setting would send the player into the red
    (2) when a tech can't be researched any faster than [max. turns-to-research value] at [max. SCI% cap], so it's preferable to just bank gold

    So maybe at least those 2 conditions could be set as excluders for such a pop-up?

    Alternatively, a "Low SCI%" pop-up might only be show if the 'Beaker-overrun' pop-up had been shown on the previous turn (so that would have to be recorded somehow), and/or — probably the simplest/best option — if the "currently collected beakers" value for the new research project = 0.
     
  11. Virote_Considon

    Virote_Considon The Great Dictator

    Joined:
    Jul 7, 2004
    Messages:
    9,373
    Location:
    Skaville UK Reputation: 1
    For thoroughness it could also check the research rate two or so turns before the last turn the tech was researched - if there was a sudden dip in science spending it could prompt such a pop-up
     
  12. ynot56

    ynot56 Warlord

    Joined:
    Jun 29, 2008
    Messages:
    158
    TJS, a very good approach.
     
  13. vmxa

    vmxa Deity Supporter

    Joined:
    Feb 9, 2004
    Messages:
    13,891
    Location:
    Oviedo, Fl
    I should not be posting so late, but...

    MPP is a big bugaboo. The Ai will sign MPP deals in some insane cases. Civ A signs with civ B, who is in several wars already. It will sign an MPP with another civ who is at war with a run away civ. Just to name a few. Add a civ will sign up an OCC civ that is at war with a runaway, bringing them to a war with a runaway.

    Armies were used in vanilla civ3, I ran into many of them in the early days. I cannot remember seeing an army outside of a town in C3C. Not saying it does not happen, only that I do not remember it, then again I am 75 so my memory is not that great.

    The barb diagonal bug was caused by a patch we asked for long ago to fix the AI marching units from tile to tile and back again, till all movement was used. This broke the barbs hunting and they ignore units if they were on the wrong diag path. It can be corrected with a setting in the ini that turns the marching back on. At least that is what I recall from many years ago. The marching was only an issue in huge games.

    I just got back from a trip last night and will down load the mod tomorrow. It like so many great things have been accomplished. If you have a place for a paypal, small donation I would like to know of it. Thanks for this titanic effort.
     
    tjs282 likes this.
  14. vmxa

    vmxa Deity Supporter

    Joined:
    Feb 9, 2004
    Messages:
    13,891
    Location:
    Oviedo, Fl
    Guess I need some advice. RUN.BAT fires up the game? I thought it was intended to modify the exe and rename the original exe. That does not happen. There is no renamed exe and the Civ3Conquest.exe has the date that it was last installed. Funny thing is that I did get a stack of workers to rail with one command,
    though no other worker commands did stack commands and others things like the production display where not available.

    I unzipped the whole thing into the steam lib and double clicked run.bat. Though I do not know where it is to find the tcc program/lib. I presumed the PUSH was to point it to tcc's location. What do I need to do? Thanks.
     
  15. tjs282

    tjs282 Stone cold fish

    Joined:
    May 19, 2009
    Messages:
    3,529
    Gender:
    Male
    Location:
    Planet Earth. Possibly.
    If I understood correctly, the patch doesn't alter the original .exe file which is stored on your HDD/SSD, it partially "hijacks" the conquests.exe code after it's been loaded into processing memory.

    And you can turn the various patch-options on/off by customising the included default.c3x_config.ini file, which in the initial installation state has the options mostly set to leave the .exe alone (i.e. unpatched CivIII, warts and all).

    You should be able to find the .ini in the C3X subdirectory -- which (again, if I understood correctly!) should have been added to your existing ../CivIII/Conquests/ directory (whether installed via Steam or GOG).
     
  16. vmxa

    vmxa Deity Supporter

    Joined:
    Feb 9, 2004
    Messages:
    13,891
    Location:
    Oviedo, Fl
    I got it backwards. I need to use the install.bat. Thanks, will do that. I want to update the exe, in core.

    Edit: works fine, senior moment strikes again.
     
  17. vmxa

    vmxa Deity Supporter

    Joined:
    Feb 9, 2004
    Messages:
    13,891
    Location:
    Oviedo, Fl
    My hands would not be in such bad shape. if Firaxis had instituted the mass worker functions. On 250x250 31 civs, you do so many clicks for rails. Thanks again.
     
    Flintlock likes this.
  18. Flintlock

    Flintlock King

    Joined:
    Sep 25, 2004
    Messages:
    682
    @vmxa The AI MPP and barb issues are already on my list, I'll add a second mark to them, but I don't know when I'll get around to looking into them. The good news is that the AI army issue is fixed in the latest mod version. There are two bugs that prevent the AI from using armies in the base game. First, the AI rarely forms armies in the first place because its leader unit logic prefers to rush city production and is able & willing to rush almost useless things like units and cheap buildings. Second, the AI logic to add units to an army contained some code which was intended to prevent it from including units that would slow its armies down but didn't take into account the fact that armies have an extra movement point, so in practice the AI was rarely able to fill an army. I fixed both of these bugs while overhauling the leader unit AI and unit-army inclusion logic.



    Also, about mod installation: The best way to use the mod is to keep it in its own folder inside the Conquests folder, but it should work even if you dump the contents of the mod directly into the Conquests folder. I say "should" because I never tested that but I tried to make that work when I programmed that part of the mod. The disadvantage to doing that is it makes a mess of your Conquests folder.
     
    tjs282 and Civinator like this.
  19. vmxa

    vmxa Deity Supporter

    Joined:
    Feb 9, 2004
    Messages:
    13,891
    Location:
    Oviedo, Fl
    The NOAIPATROL iirc is the negating of the fix to units patrolling. That is what broke the barbs. It is not important to me as I mostly play with no barbs to remove huts.

    The MPP is also not important to me as it does nothing to change the game, just sort a head scratcher.
     

Share This Page