Ideas and brain storming for Europe map scenario


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.
 
Actually, hold up, barbarian player isn't set correctly, I worked up a fixed and am about to push it.

The Scenario doesn't do a failed assert so I am assuming it is working correctly. Headed to bed so want check further.
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.
 
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.

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.

Anyway been thinking the Crusades scenario. I guess there should be some reason or prize to capture Holy land (Jerusalem) if you play catholic nations? And how does AI react to war between distant nations? For example, would the Frankish empire send units to Middle East if it has war with turks or arabs?

Which gave me idea that maybe Byzantines could be a some sort of advanced natives? You could learn new technologies from them and learn skills that you can't learn in normal barbarian villages. And possibly you could send units to Imperial guard and gain some bonus (gold and promotions etc).

Another idea for Byzantines is that they would work like the Papacy for the non-catholic nations. For example arabs would win the game if they capture Constantinople.

Maybe something like this could be considered to the main game too (in the future)? Down side of course is that player couldn't play Byzantines.

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.
 
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.
 
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.

This isn't yet pushed to develop branch, right?
 
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.

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.
 
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.
 
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.
 

Attachments

  • EuropeWIP.zip
    28.1 KB · Views: 268
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?
 
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?
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:
 
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.
 
At least I noticed this when vassal cities where created, they where created without plotgroups.
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.
 
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.

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
 
Top Bottom