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

CivEffects

Discussion in 'Civ4Col - Medieval: Conquests' started by Nightinggale, Feb 12, 2015.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok Night, yeah, sounds good. I've been afk this week mostly dealing with civilian matters. Like my moma said, It's always something :) Hopefully, I'll be able to work some more on the text file tomorrow.
     
  2. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I just spotted somebody with an interesting idea. http://forums.civfanatics.com/showthread.php?t=549021

    I wonder if we should have that feature, possibly in a simplified version. If I add a bool to researchCivEffect telling that it is a wonder civeffect (we need a better name). If it is set, then canResearch() can check if the CivEffect is set in the "was ever researched" array, which is used for gifts to the first to research. If it is there, then canResearch returns false. When this array sets a CivEffect to true, it can check if it has this bool set (and if it is research) and if it is, it loops all players and unsets the research if it is set to that civeffect.

    That's it. Nothing else will be needed. XML modders can then make it complete by using other bools, like can't be traded. If we split the features into multiple XML bools, it can be possible to allow only one player to research the tech, but still allow it to be traded and possibly stolen by spies.

    The correct location for this would be research CivEffects as that mean it would add this feature to both techs and perks.

    If we agree that this would be interesting to add, I will add it. However I don't think I will do it before next release. We really need to release in the near future and we can't just add more features and postpone the release.
     
  3. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    I am always fond of new features that you magicians give us as toys to play with (as some other Wiseman said), but this is something I don’t really see. Let me share a practical point of view with a couple of questions:

    What would you get from a timed restricted tech? Special units? Special Civics? Special goods nobody has and you can sell them really expensively?

    You already have all that with wonders, so I think it is not worth the bothering. You may probably like to use candles to build something, but I think this is already doable currently in M: C.

    Bringing the wonders feature to Colonization is something different. I think that is the best approach.
     
  4. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    Or….:think:

    Recycling your idea, we could work out a tech system to time-out some not essential techs.

    It has been previously debated that when no new materials (say iron) are available, there could be work-around methods to enhance your units (better or fire-hardened wooden poles). So with this example, Fire-harden wood Tech could be a non-essential tech that is available to learn until the discovery of “iron tech” or “iron good”. The same may be used with for example “Canal Transportation Tech”. It helped industrialize UK and other countries, but it was forgotten when Railroad came, so in many other countries they switched to railroad directly.

    Therefore we could have a Horizontal tech system, that allows us some enhancement until real Vertical advancements are available that render horizontal techs useless and obsolete, and it would be nonsense researching them.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone

    I actually like this idea. And in contrast to implementing a whole Wonder building feature (which would be nice as well) this would be easy to add and allow for such "Wonder" effects until we eventually do add Wonders. It could simulate techs like Silk, where the Civ who invents it "guards" the secret for as long as they can. In this can it can be traded, but since no one else can trade for it, it brings a high price. War and spies could acquire the tech. We could bring in gaining a random tech when you conquer a city, thus have a chance that the Unique tech is acquired or perhaps made researchable.

    And timing out Techs could be useful, but there are means to do this somewhat at the moment. When you Invent one item it can obsolete others, while not the same it is similar. Anyway, both would be useful additions.
     
  6. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Currently it isn't possible to remove techs or perks once a player has gained them. There are a few reasons for that.

    1: gifts. Gain 3 units when gaining the tech would repeat endlessly.

    2: tech A disables tech B and B disables C. This mean with the current setup C is enabled again because B is disabled. And don't get me started on circular disabling like C disables A :crazyeye:

    3: cache reset. If the CivEffect cache is reset (like on game load), it could encounter tech B, which disables tech A. If it is owned, it should be removed from the cache, but only if it is already applied. Since the cache recalculation in theory can be out of order, it doesn't know if A is in the cache when B is applied.

    4: the timed CivEffect feature where the turns left int is set to -1 for permanent is made a bit different for techs and perks. They store +1 when gaining as this has left room for adding the same over and over, like a future tech feature. Maybe it should be changed for consistency anyway, but it was coded before the timed CivEffects were added.

    If we should be able to turn techs on and off, we need to figure out what to do about cases like this. Personally I'm not sure if it makes sense to do a lot of work to disable techs. The tech system is more like tech A enables unit and tech B disables it. Why should the tech itself be disabled?
     
  7. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    When I said timing research out, I meant preventing obsolete advancements from being researched, not removing their effects.
     
  8. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I see your point, but I didn't think of that either :think:

    If Tech A blocks research of tech B, then the code will make tech B block research of tech A to prevent entering undefined behavior (less ways of XML modders to screw up).

    The best I can think of offhand is to add eras as CivEffects (we already talked about those) and then set some era as NOT requirement. That will block obsolete techs/perks, not by advanced techs, but rather advanced eras.

    I do see a limitation in this approach though. If we have unit B, which is a better version of unit A, then B should obsolete A. The current system is likely not ideal for that, but if we are talking about a profession, then changing the professions comes with a bunch of issues of their own. Maybe it would generally be better to simply add a unit/profession modifier to give it a free promotion rather than adding more almost similar types. If yield costs aren't the same, then I would argue that obsoleting the old one could be a mistake. What if you have yields stored for 20 old units and no new ones? Sucks being attacked when you can't use your outdated bows to defend yourself.
     
  9. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    So the idea of restricted techs would be only restricted to the first one to grab it, but appart from that, those are always available to be researched. Isn't it a Founding-Father-like feature that you can later kidnap a FF from other civ to gain the bonus?
     
  10. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Pretty close. The main difference is that FFs remain in teams and CivEffects are in player. This minor difference is a major one when it comes to vassals.

    Another obvious difference is that FFs don't have a tech tree.

    Now I thought of another possible implementation. In addition to storing a bool to see if a CivEffect has ever been researched, the game also stores how many players have it right now. We could restrict canResearch to only allow if some XML val is higher than the number of players currently owning that CivEffect. This will allow setting a number like 4. Also if we set the number to 1, it is first to research, like a wonder. However if that player dies without handing over the tech, the number of alive players with the tech is reduced to 0 and somebody else can research it. It's not lost like wonders or FFs.

    Maybe if the number if higher than 1, it should be scaled based on map size :think:
     
  11. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Or discover it in the ruins of its cities or say an improvement (that gets destroy along with a city. That would be a neat idea, improvements that are attached to cities and are destroyed when the city dies).
     
  12. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Yeah, that too. However that is more like an addon as it is adding a way to call the function to gain a tech/perk while what I was talking about would be a core feature of CivEffects. Having said that, they would work well together.

    In fact we should consider how to conquer techs from other players. Perhaps a profession to examine ruins would be an idea. When the allies won WW2, Americans captured the German rocket scientists, moved all the equipment to the US and then destroyed whatever they couldn't move. They knew the red army was underway and they didn't want to give anything to Russia (they were allies back then, remember :crazyeye:). The Russians looked at the research facility, realized it was important, guarded it and fetched a bunch of scientists from home. They spend quite a while studying the ruins of the research and production facilities, reconstructed what would likely have been built there and that was the foundation for the Russian space program. Regular people couldn't see precisely what they had made there and certainly not how they did it, but experts given enough months could figure it out.
     
  13. Trade Winds

    Trade Winds Chieftain

    Joined:
    Nov 21, 2013
    Messages:
    235
    I like this idea. I like the archaelogy feature from C5.
     
  14. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    After some more testing, this feature looks promising. There are just a few issues left.

    The civic screen is broken. All problems seems to be related to civics blocking each other. Upon closer inspection, it would appear that the python code is trying to figure out if specific civics are legal compared to the current chosen civics. This should really be rewritten to be a simple question for the DLL. The DLL already has the answer in a cache, meaning it shouldn't be that tricky to provide for python.

    XML files needs to be reviewed. Some tags were renamed and info lost. This gives some unintended abilities, like being able to build all improvements from the start. Kailric said he would check the xml settings. If my calculations are correct, he should return this weekend.

    The player starts with too many techs. I suspect this to be related to xml as well.

    The Pope starts without techs. He used to gain techs by some hardcoded ID system. We need a new system and I haven't come up with any.

    Other than that, it seems to be a decent system. The merged code itself seems to be stable, though the real test begins once all the issues mentioned in this post are fixed.
     
  15. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    You can give freetechs in Civilization infos, the 'Invader civs' have about 6 which I think are the various military unit techs. I am not sure what the reason was why the (I think) 'on map' pope needed a different system... could it just go back to putting all the techs into his civ entry?

    Do you know what tags/effects/functions had name changes? Do you know what kinds of things got lost?

    I have been trying to remove units from the game and it has currently exploded all of the civs! :D

    I think the next file I have to sanitize is the eventinfo file... chip away! :badcomp:

    I look forward to seeing the final result, well done Night!
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Your calculations where correct. What all programs am I going to need to get back to modding on my new system? I'll have to go check what version of visual studio I was using. I am currently testing out your tutorial Night on how to setup Git.

    My focus, besides helping Night get the CivEffects branch debugged would be the Economy. We have a few systems in place that need relooked out. Like the system where you gain bonuses for having different Connected cities. I am going to remove the XML values for now to turn this off as this system needs tested more and also needs to be documented and added to the tutorial. With the introduction of PlotGroups we have been looking at ways to use PlotGroups and this was one of them. Now is a good time to evaluate all the new features and systems we have added and see which ones are working correctly and in such a way that players can see it working and understand what is happening. And if the system is adding to the fun.
     
  17. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Boom! I cloned the files from source forge... hmm, now what? I am using SmartGit 7 I think and some of the steps are now a bit different than your tutorial but I made it it would seem. I need to get the dll and sound/graphic files and such. I need to update Colonization. I don't see Visual Studio 2010 readily available on Microsoft downloads anymore, will the higher versions work?
     
  18. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    The project file can be updated to new versions of MSVS, but it can't downgrade again, meaning the important part is that we all use the same version. Since I want to be able to use XP in a virtual machine, we are stuck with 2010.

    Microsoft removed their link in the download page, but they kept the iso on their server. http://go.microsoft.com/?linkid=9709969
    I guess we should update the wiki to reflect this.


    Now that you have seen that the time machine actually works, I would like you to give it back to me. I need it to go back to 2004 and convince Firaxis to improve the exe.
     
  19. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I'm stuck. For once I'm truly stuck coding C++/python :eek:

    The problem is the civic screen and prohibited civics. The problem is as follows:
    Say we have civics A1, A2, B1 and B2. A and B are categories and we can't have A2 and B2 at the same time.

    A player has A2 and B1. He can't pick B2 because A2 blocks it. That's fine.

    Another player has A1 and B1. He picks A2 and before applying he picks B2 as well. That shouldn't be possible, but because A2 is selected, but not applied, it's not in the cache yet and as such it doesn't block B2.

    The option to ignore the cache is no good because the cache might say it's banned due to a censure. The cache doesn't tell the source of the ban.

    The only thing I can think of is to go back to the cache design and pull civics out of it. It will then cache if any non-civic CivEffects prohibits civics. It will turn the code more messy, but it will allow checking the cache for outside influence only and then "manual" check to see if the selected combo is legal. The current (broken) check is in python and will have to be rewritten, presumable from scratch. I think it would be best to make some sort of dll feature for this, which the AI can also use. I have no idea if the AI checks for legal civic combos, but it should.


    Do anybody have any other ideas for this? It seems to be an awful lot of coding just to tell if a button is clickable or not :(
     
  20. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    As far as I remember when you select a Civic A2, all other civic buttons are checked if they are allowed with that Civic and if not then those buttons becomes unselectable. Then you could not select A2 and B2 at the same time. The Python code has an array for the Selected Civics right? It has like 3 arrays, one for Civics, Selected Civics, and Current civics, or something like that.

    Edit: Installing a python ide now.
     

Share This Page