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

C2C Combat Mod Option: Hide and Seek

Discussion in 'Civ4 - Caveman 2 Cosmos' started by Thunderbrd, Nov 15, 2015.

  1. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    I'm 99% sure there wasn't any units from a third party nation around (because it was around turn 100 on a snailGiant map where all 12 nations were spread far apart). I only had that one spearman and the target AI consisted of two gatherers, 1-2 Stone throwers, and perhaps a brute. The only available build up was checkpoints but I didn't use it and I don't think it was used by the AI neither.
    I had tweaked mobility_foot so that the only modifiers from that unitcombat in play here was [Hill: +1 range] and [forest: +1 invisibility -1 Range] on invisibility_camouflage
    Other modifier in play was +1 visibility (camouflage) on combatant.
    These invisible_camouflage modifiers were the reason for me not seeing the guardian 2 tiles away from the forest. they might be where the problem lies; because it was the same forest that I suddenly unexpectedly could see it again when I moved away from the city.

    That's a feeling I got multiple times today when play-testing, there was a disturbing lack of consistency. Almost like the visibility field circles you made illustrations of in the OP were lagging behind units (not centered around units all the time). But that was just a gut feeling I had, I've got nothing tangible to back that claim up with. ^^
     
  2. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
  3. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    Keep checking consistency but I believe I've made some big improvements there. There's still an odd issue though... a hint of the possibility that there may be something still amiss. But the system should now be not only faster to process but much more supportive of your numeric assignments.


    BTW, thanks for all your analysis and feedback Toffer! Such a huge help here - couldn't do this project without ya man!
     
  4. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    Glad to be of help:); will actually try to play the game today; haven't done that in a month now. Will report if anything that seems amiss.

    Edit: One thing that feels off is that units in tiles that are visible due to cultural borders can be seen even though they have size invisibility that none of my unit are close enough to see. This leads to situations where I can see an animal outside my border and the moment I send a unit close enough to get the animal inside its field of view the animal turns invisible. This might have been the cause of some of the issues I reported earlier where I thought visibility intensity was increasing away from the observer instead of decreasing.
     
  5. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    hmm... city and national visibility on tiles shouldn't be interacting with invisibility at all. That could explain (maybe) some of the wierd stuff I was noting in the code. I'll have to take a much closer look at those visibility function calls and see how they could possibly be changing the invisiblevisible count on tiles.

    AARGH!
    This should be truly impossible based on what I've seen in the code so far on a review but I'm still searching for how this would happen... ugh. Some maddening inconsistencies here... I may well find the original visibility bug somewhere in here looking for this.
     
  6. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    Would it be problematic to add support for NegatesInvisibilityTypes as a tag to unitcombat? I want to define:
    Spoiler :
    Code:
    		<UnitCombatInfo>
    			<Type>UNITCOMBAT_VISIBLE</Type>
    			<Description>TXT_KEY_UNITCOMBAT_VISIBLE</Description>
    			<OnGameOptions>
    				<GameOptionType>GAMEOPTION_SIZE_MATTERS</GameOptionType>
    				<GameOptionType>GAMEOPTION_HIDE_AND_SEEK</GameOptionType>
    			</OnGameOptions>
    			<NegatesInvisibilityTypes>
    				<InvisibleType>INVISIBLE_CAMOUFLAGE</InvisibleType>
    				<InvisibleType>INVISIBLE_SUBMARINE</InvisibleType>
    				<InvisibleType>INVISIBLE_STEALTH</InvisibleType>
    				<InvisibleType>INVISIBLE_INVISIBLE</InvisibleType>
    				<InvisibleType>INVISIBLE_CLOAKED</InvisibleType>
    				<InvisibleType>INVISIBLE_DISGUISED</InvisibleType>
    				<InvisibleType>INVISIBLE_POLITICAL</InvisibleType>
    				<InvisibleType>INVISIBLE_SUBMERGED</InvisibleType>
    				<InvisibleType>INVISIBLE_NAVAL_DISGUISE</InvisibleType>
    				<InvisibleType>INVISIBLE_SIZE</InvisibleType>
    			</NegatesInvisibilityTypes>
    			<Button>Art/Buttons/Promotions/StandOutStatus.dds</Button>
    		</UnitCombatInfo>

    And give it to tribal guardian and remove their access to standout. I could alternatively just have standout be a free promo to the guardian... What do you think, does it seem unnecessary?
    Not sure how many units this would be used for in the end; only a few I guess.
     
  7. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
  8. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    I would like to request a PrereqTerritoryTypes for status promotions. It will make the status require that the unit is located in either neutral, friendly or enemy territory to be taken.
    It's for a status called hunt that mainly gives size-visibility (and some negative), it will take 1 turn to get and none to remove. It will only be possible to take it when in neutral territory, because it will also set bExile so that the hunt status must be removed for the unit to enter friendly land again. Even though this particular status may seems silly, I believe the tag will prove useful for more interesting statuses down the line.

    Posted this here, instead of in C2C Status Promotions thread; as the example used would be an Hide and Seek promo only.
     
  9. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    I don't think it seems silly at all... rather innovative really. Unfortunately, territory types aren't an array. So I'd need a bPrereqFriendly, bPrereqNeutral and bPrereqEnemy set of tags. Which are in and of themselves a great concept for expanding the usefulness of the status promos.

    I also think it might be good to get statuses down on the list of priorities in the action list somehow. Not quite sure if I can do that or not but I'll look into it. We may end up getting quite a list of these and equipments since equips will be very similar in nature (much of the code for statuses I copied from what I'd setup for equipments ;) )

    I like the idea of self-exciling some units just to limit those units from being able to enter your own territory. This would make it much safer to automate captured units you're using for warfare for example - if they enter your own territory they lose their Hidden Nationality status!

    I also thought about having a status that removes HN but I determined it would be a bad idea... too easy to manipulate that status for temporary gain and they'd really have to maintain their secrecy until death to pull off HN ability at all.


    On another note, I've been doing a major structure map of the whole maze of invisibility coding and I've found 3 bugs and resolved them. One of these spots I made the mistake of making a bad change at myself but I don't think it's responsible for any of the odd behavior in your reports. Another, however, was very likely the culprit in the bug we've had for a very long time where invisible units were sometimes visible when they shouldn't be.

    But I'm still looking deeper still because I've not yet found anything that would explain some of what you've reported and there's still a few loose ends to look into.
     
  10. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    Happy hunting.

    Except for the cultural border visibility thing, I'd say most issues are gone, everything else just seems right now. This is turning out to be quite the solid game-feature. ;)
     
  11. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    Well that's the thing... cultural borders should not influence the invisibility visibility at all. I haven't found any evidence in code to explain how this would happen. So at this point that's the main thing I'm hunting for.
     
  12. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    I added invisibility visibility resets to the recalculation process and noticed there that it should've been a part of it all along given how the recalc works. With it not being included, a lot of very odd things may have been generated by recalcs. This could've been causing us issues for quite a while actually. Moreso on this option. I'm running a debug on the latest hang bug but once I get a bead on that I'll update with about 4 bugfixes to the visibility system, including the addition of invisibility visibility resetting on recalcs.
     
  13. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    Ok, Toffer, recalcs should work for this now. Let me know if you continue to see any funny stuff. Again, there should NOT be any reason for simple national borders to reveal invisibles but there were a few reasons it may have seemed to be a cause.

    I'm hoping it's all completely solved at this point. But while I'm crossing my fingers, I realize there could yet be more issues lurking.
     
  14. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    Will start testing as soon as I finish the bamboo feature I'm working on. :)
     
  15. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
  16. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    OK after some short testing on a new game with latest dll:

    Everything seems to work fine until I tried to load a save. Units that were visible when the save was made are no longer visible, a recalc fixes it. So right now it's mandatory to do a recalc every time one loads a game; even though no assets have been changed between the save-load cycle.
    I tried playing 20-30 turns without doing a recalc and My wanderer couldn't even see elephants that were sharing his tile; the map seemed completely empty except for my units.
    It doesn't matter if the game is completely restarted before loading or if the load is initiated within a game.

    This seems to indicate that the problem lies in wrongly stored data in saves.
     
  17. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,549
    Gender:
    Male
    Location:
    Canberra, Australia
    I don't have this mod on but I have a foreign stack on my border which I can't see the units but can see the flag and my dog unit reckons contains bandits. Hovering over the invisible stack shows what is there.
     
  18. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    Hmm... ok. Will work on that asap.
    As Toffer stated, for now do a recalc and it should clear up. I'll get this addressed as quickly as I can.

    EDIT: I confirmed the problem but I won't have time to work on a solution until later today. My apologies. Very strange issue this. Load/Save hasn't changed so that shouldn't be the issue. I did add a spot where values are removed but it doesn't appear to be used in code at all unless it's via the recalculator. There could be a python interaction I didn't see taking place though so I think I can solve this rather easily still.
     
  19. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    28,501
    Gender:
    Male
    Location:
    Las Vegas
    I fixed the problem but not in the most optimal manner. There's a factor I'm not seeing taking place on loading that I'm wondering if it has something to do with the load order of things as controlled by the exe. Therefore, when the game loads it always does a rather quick recalc of just the visibility factors after everything else has taken place. This doesn't add too much time to the load but it could be noticeable if you have a lot of units in play. Unfortunate but doesn't affect turn times or other delays.

    Maybe someday I'll see what I'm missing and be able to solve it otherwise. But having mapped things out very carefully I still don't see how it's not doing this correctly to begin with. Especially since my last round of changes really shouldn't have had such an effect since putting a stop on the only spot where visibility is removed shows it doesn't get hit when loaded and the save data not only checks out to load fine but also wasn't adjusted during this last set of changes before the bug started showing up.

    So it's just... strange.
     
  20. Toffer90

    Toffer90 C2C Modder

    Joined:
    Oct 16, 2011
    Messages:
    7,419
    Location:
    Norway
    Case:
    Spoiler :


    The Lynx disappears if I move either the clubman or the tracker 1 tile closer to it. Also, moving the tracker SW makes the lynx disappear as it get's inside the trackers field of view.

    Lynx has 2(+1) Camouflage invisibility (+1 from the forest feature).
    Clubman has 1 Visibility and 0 Range (Camouflage).
    Tracker has 1 Visibility and 1 Range (Camouflage).

    The reason that the tile inhabited by the lynx is revealed is because the cultural border sees 2 tiles out there due to the peak inside the border.

    Size invisibility is not the issue here, though the same could probably occur where it is. In this case I have higher size visibility (Tracker: 12) than the Lynx has size invisibility (11).


    Edit: Additionally, I'm pretty sure this tag has no effect in-game yet:
    Spoiler :
    Code:
    			<InvisibleFeatureChanges>
    				<InvisibleFeatureChange>
    					<InvisibleType>X</InvisibleType>
    					<FeatureType>Y</FeatureType>
    					<iIntensity>Z</iIntensity>
    				</InvisibleFeatureChange>
    			</InvisibleFeatureChanges>
    
    My tracker can see the lynx (in a forest) with only 2 camouflage visibility.
    The same might be the case for the other tags similar to this one. None of the terrain and feature Vis/Invis modifiers are displayed in-game. In other words, TXT_KEY_PROMOTION_INVISIBILE_PLOT_CHANGE_TEXT isn't displayed.

    EDIT2: If a unit (Y) that you can see moves to the same plot as your unit (x) it turns invisible. My unit (x) had +2 Same Tile Visibility (size) which I think made the other unit (y) +2 invisible (size) instead of visible. A recalc made it visible, moving away from it did not make it visible and feature modifiers were not involved. I might be wrong on the why and how here, but I strongly suspect the "see same tile" modifier.
     

    Attached Files:

Share This Page