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

Ideas and brain storming for Europe map scenario

Discussion in 'Civ4Col - Medieval: Conquests' started by Fullerene, Aug 18, 2013.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Actually, hold up, barbarian player isn't set correctly, I worked up a fixed and am about to push it.

    Code:
    if (!bScenario)
    	{
    		//TKs Code moved here to prevent duplicate players in scenarios
    		// < JAnimals Mod Start >
    		createNationStatePlayer();
    		bool bAnimals = true;
    		if (bAnimals)
    		{
    			createBarbarianPlayer();
    		}
    		// < JAnimals Mod End >
    		initFreeState();
    	}
    	else
    	{
    		if (getBarbarianPlayer() == NO_PLAYER)
    		{
    			for (int iP=0; iP < MAX_PLAYERS; iP++)
    			{
    				CvPlayer& player = GET_PLAYER((PlayerTypes)iP);
    				if (player.isAlive())
    				{
    					if (player.getCivilizationType() == (CivilizationTypes) GC.getXMLval(XML_BARBARIAN_CIVILIZATION))
    					{
    						setBarbarianPlayer(player.getID());
    						return;
    					}
    				}
    			}
    			
    		}
    
    		FAssert(getBarbarianPlayer() != NO_PLAYER);
    	}
    The Scenario doesn't do a failed assert so I am assuming it is working correctly. Headed to bed so want check further.
     
  2. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    That code relies on GC.getXMLval(XML_BARBARIAN_CIVILIZATION). We ended up with two barbarian players meaning this function is unreliable. Even worse, if somebody uses the RaR solution to this problem (deleting the barbarians to allow the DLL to add it again), then your code will fail to add barbarians.

    I'm going to fix this the right way: to add data in WBsave telling which player is barbarian. That should be fairly simple and the init code will then add barbarians only if they are not present in WBsave.
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    You sure it was two barbarians and not just two popes? Cause I get no failed assert on the missing barbarian player. The same code is run as before, why would it work this time and not before? Just curious, but yeah go ahead and fix it the "right way" Mr. Goody Twoshoes ;)

    We probably need a new XML attribute in Civilizaton Infos that we can set as bBarbarianPlayer so it doesn't have to be defined otherwise.

    I almost missed replying to this as well. Fullerene, are you up to date on the new victory conditions in M:C? The new goal is to capture or liberate Rome. You can either side with the Pope or not, if you do an Invasion force will appear at some point and assault Rome, you must defend her at all costs, if a friendly Civ doesn't control Rome at the end you lose. If you are enemies to Rome, in order to win you must Capture Rome, if you Assault Rome a Relief Force will be sent to liberate Rome from you, you then must defeat this Force. This actually needs tested thoroughly. The AI knows it must capture or defend Rome but I am not sure yet how good it is at this.

    That is a good idea with Byzantine and is somewhat planned to be that way. The Pope is on the map and way advanced but he will not trade you any Techs, but perhaps you could learn things from the Byzantines, and get some city Teach classes as well. I've been wanting to add a feature where the Foreign Villages and such can charge you a fee in order to teach your units. Also, make it so that if they start to not like you so much they may refuse to teach you.

    I need to look the code over shortly as I believe there may be an issue also with Rome not being saved as the "Holy City" that everyone needs to defend or capture. Also, I need to make sure that we can define exactly which city is the Holy City. I think it is tied to Buildings, and in this case the Apostolic Palace, when it is placed it sets that City as the Holy City, so maybe it does get set. We need to make a new building thought that is only added through Scenarios so that when it is set it makes that city the new Holy City, then we can setup say Jerusalem as the City that needs attacked or defended.
     
  4. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    The game saves two ints in CvGame, telling PlayerTypes for barbarians and pope. The problem was that WBsave didn't do that and those indexes ended up being the default NO_PLAYER, in which case new players were added at game start.

    I added the tags CivIsBarbarianPlayer and CivIsReligiousCenterPlayer to players in WBsave. If set to 1, the game will use that player's ID. If multiple players have that setting, it will use the one with the highest ID. If no player has this tag set, the game will generate a new player.

    I don't like GC.getXMLval(XML_BARBARIAN_CIVILIZATION). It looks really broken the more I look at it. It works right now, but barbarians use an empty player slot. They can pick a different one for various reasons, such as placement of other players and changing MAX_PLAYERS.
    I would say that all cases should be replaced with CvGame::getBarbarianPlayer() as this one returns the ID the barbarians actually decided to use in the current game.
     
  5. Fullerene

    Fullerene Chieftain

    Joined:
    Aug 26, 2009
    Messages:
    228
    Gender:
    Male
    This isn't yet pushed to develop branch, right?
     
  6. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    It is. Sadly you have to select the python submodule and pull that one too. The same goes for the DLL submodule.

    I have been looking at automation to pull submodules when the main module is pulled, but so far I haven't ended up with any working solution :(
     
  7. Fullerene

    Fullerene Chieftain

    Joined:
    Aug 26, 2009
    Messages:
    228
    Gender:
    Male
    Yes, Jerusalem could be the holy city if the focus of the scenario is strictly the crusades era. The problem though is that Jerusalem would be controlled by the Pope, which isn't historically correct, it was in the hands of muslims in the beginning of the scenario's timeline.

    ---

    Ok, the scenario files are working now. I guess I'll create some sort of scenario on the Europe map, be it crusades or not. Let's see.
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Yeah, I started adding code where we can create a new building and what ever city you place that building in it will be the new objective city. This is doable already in world builder with the apostic palace, we can add another building that is only used in scenarios or can scenarios have attached xml files? Anyway, you can for sure work on the scenario map and we'll make adjustments to get it to work.
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I turned off Invader Civs during Scenarios as well. You can configure some Civs to appear during certain other Eras of the game and by default the Vikings appear during the Viking Age. I pushed those changes, shouldn't mess up anything.
     
  10. Fullerene

    Fullerene Chieftain

    Joined:
    Aug 26, 2009
    Messages:
    228
    Gender:
    Male
    Something weird with this scenario file... Immigration screen isn't working and homeland and silk road doesn't seem to appear on map. Python logs or DLL debugging didn't really help, so I ask for some assistance.
     

    Attached Files:

  11. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Sounds like trade screens aren't activated as intended when reading a scenario file. I think I know what to look for and will look into this tomorrow.
     
  12. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I have a problem reading that file. Regardless of where I place the file, the game refuse to read it :confused:
    The file looks fine when I open it in notepad++ and there aren't any clear signs of file corruption. I can't really investigate the issue without being able to open the file :(
     
  13. Fullerene

    Fullerene Chieftain

    Joined:
    Aug 26, 2009
    Messages:
    228
    Gender:
    Male
    What you mean that game refuse to read it? Does the file not appear in list of scenarios? In that case can't you just double click the file? Or does it simply not load and doesn't give any error messages?
     
  14. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    It doesn't appear in the scenario list. However doubleclicking works. The game can detect the other scenario files placed in the same directory. Quite odd.

    Regardless of this issue, I have managed to start the game with the debugger attached. I should be able to figure out whatever happens to the trade screens.

    EDIT:
    This game looks pretty broken based on the number of asserts it triggers. Cities without plotgroups and using invalid playerIDs as valid and stuff like that. I wonder if the game somehow manage to start without setting up the caches :think:
     
  15. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I fixed most of the issues. It turned out that players will get the religious leader as parent when the religious leader player is added. Since the pope is already in the scenario file, no pope is added, which in turn mean the player loop to set parent was avoided. I fixed this simply by making a function, which handles the loop and then call it from start scenario and the add pope code. Now everything, which assumes a parent magically works again :)

    There is still an assert about a missing plotgroup in Constantinoble. That appears to be unrelated and is still under investigation.
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Nice work Night, yeah that missing plot group has something to do with players acquiring a city through other means besides founding. At least I noticed this when vassal cities where created, they where created without plotgroups.
     
  17. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    That's the first I hear of this. However if all goes well, this issue will be fixed as well.

    Debugging a bit regarding the missing plotgroup reveals nothing. The city is founded during the first turn and isn't present in the scenario. It appears to work just fine and then suddenly it is missing, almost like it is assigned and then deleted later during the same turn.

    I need to be more systematic about this. I think I will have to make a function, which loops all cities (possibly for all players) and check if the plotgroup is ok. This is then called in a whole lot of cases where we might theoretically alter plotgroups. Presumably this can trigger an assert while the breaking function is still in the stack (at least that's the idea). I will need an on/off switch at compile time. That way I will not have to worry about performance and can really slow down the game with way too many checks.
     
  18. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I fixed the plotgroup issue as well. I'm not entirely sure where it went wrong, but now it updates the plotgroup as the last thing in CvCity::init(). I added a few asserts to make it easier to spot cities without plotgroups.
     
  19. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    It was on my todo list to check to see if that would work back when I last encountered this bug, so nice work!

    I'm excited to finally get to work on this again and finish my last saved game:p
     

Share This Page