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

Mining, trapping, prospecting, and depleting resources

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Aug 16, 2014.

  1. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I'm having issues with the prospector profession. I would like to disable professions, which are able to prospect in games without prospecting. However I can't figure out where in XML it is set which units/professions, which can prospect. Without a well defined criteria to search for, I can't figure out which profession(s) to disable. What do I do to figure out the prospector is a prospector? (other than look at the name, that is :lol:)

    CvGame is discarded each time you start a new game. Since the input for the calculation is pure XML, we can calculate it once and use it over and over. However CvGame could skip yields if nobody can use it. However given the relatively low amount of prospectable yields, I would say such optimization would be overkill. We would not be able to tell the difference.
     
  2. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    As mentioned, prospecting is a work in progress. There is a Prospector Profession, but it is already disable with <bColonialInvalid>1</bColonialInvalid>. Workers do the Prospecting at the moment, and you can simply Hide the associated commands in the XML, but that wouldn't work with turning the option on and off, while in game, you would have to add extra code in the command/auto commands to check for game options for this particular feature. You can either just disable it in the XML, or do the extra work to make it work with Game Options. If I am right ;)

    Edit: it is actually a BUILD_PROSPECT, and builds are handled with the MISSION_BUILD mission.
     
  3. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I already force return false in CvUnit::canBuild() if build has isProspect() and prospecting is disabled by game settings. This should both reject attempts to actually do this (CvUnit::build verifies with canBuild before doing anything) as well as hide the button.

    If turning prospecting on and off is done by a game setting, it has to work completely without modifying XML. Players of some future release should under no circumstances have to edit XML themselves. Also fixed XML setup is also important if network games should ever be possible.

    Disabling the prospector isn't that important. I just don't want to include a profession, which can do nothing. For now I added a TODO telling precisely where the profession can be turned off once XML can tell if it should.
     
  4. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Btw I was thinking. If I have to break savegames now anyway, I might as well add a few extra game options and hide those. They will not appear ingame, but next time we need to add a game setting, it will not break savegames as it is already saved. Who cares if we add a few extra bools to the savegame ;)

    In fact there are some global settings in the option window, which would make more sense as game specific options. Barbarians, animals (split that one into two) and ransoming knights.

    And yeah, we really need to make a screen appear with those options when using play now.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, that sounds good. When I revisit Prospectors and add a boolean to the Profession I'll add your Game Option to have it disabled.

    Yeah, ransoming Knights is turned off by default in Player Options (different than Global), it is one of those things that needs tested/finished before its official.

    I think one of the Mods, AoD perhaps had game changing options during loadup that you could chose, or it may have been a Civ4 mod actually, not sure now.
     
  6. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    I think some of the Mega Civ4 mods have done options in play now.

    ROM:AND
    C2C
    those types
     
  7. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    When I think of a mod with that option, I think of FFH2. At least that would be my best guess without actually checking.

    The problem with those is that they changed so many things. What I really want is a simple modcomp to tell precisely which file to modify. Looking for something like this in big mods like that is quite tricky if you don't know for sure what you are looking for. Looking for the modified file(s) will totally fail.

    Btw I have a feeling that the answer is in python. That's just a hunch based on what else I have seen. At least it's a place to start :)
     
  8. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    There are 3 arrays in prospecting:
    • Yield: Replenish
    • Yield: Amount
    • Player: Prospected
    Right now they use short, which mean they have a range between -32k to 32k. I wonder if they can be changed to a range between 0 and 255. I would assume that prospected could do with a range of 0 to 10 or something. Who needs to prospect the same plot 200 times?

    Btw it counts the number of times a plot is prospected. What if we used up all attempts on prospecting for ore and then we have no prospecting for a newly discovered yield. I think it would make more sense to count for each yieldtype. I have made 2D JIT arrays, which could be useful here. (a player array of yield arrays). I wonder if we can make a JIT array type containing only prospectable yields. That would not only save a lot of looping, but also some memory.
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Currently I don't think it is working as intended. After you prospect once, you are now allowed to prospect again until you gain a Prospect level, that's correct. But, then you can prospect even if Ore isn't depleted which causes a FAssert. So, I am thinking I need to prevent re-prospecting until Ore is depleted the first time, perhaps with a Bonus to find more if you had Ore to start with. Or, should more ore simply be added to the current amount when you Prospect again?

    If you want to improve the code by all means have at it;)

    Yeah, atm I only have Ore setup for prospecting and testing. I planned to add new levels for all prospecting yields.
     
  10. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Ok, I'm done with the game option to disable prospecting. Since I broke savegames anyway, I cleaned up CvCity saving code and added game options to disable raiders and enabling knight ransoming. Those two options are hidden and have no effect, but since they are saved, we can start using them later without breaking savegames at that point.

    I decided not to split raiders and animals because it has already been done. There are game options to disable both land and sea animals, meaning there are now 3 groups of barbarian units, which can eventually be turned on and off individually.

    Next step is to find a good time to merge back. It will break existing savegames, which is why I will not do it until we agree to do it :)
     
  11. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, cool. Yeah, I am playing my current game now and wouldn't want to lose it. I just added new border effects for your Vassals. Their borders will appear (Natives don't have borders outside WorldBuilder) in Player's default color with added stripes so you can easily tell what Cities are your Vassals.
     
  12. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK

Share This Page