Informal How-To: The country_<country_name>.xml file
Posted: Wed Jun 10, 2020 7:11 am
Hello. Well, as the subject line says, this is a little information piece on the country file used within the country definitions. Basically I'm doing this as more than likely, I didn't quite know the reason behind something and likely didn't notice it mentioned in the help files either, as when I changed the way it was, it gave me an error which I had no idea how to fix it, it seems.
So to begin with, here's an example of my San Marino definitions, which are part of the definitions for Europe. I'll add that the following country file works in my definitions, which prior, it did not. This is the country_san_marino.xml file illustrated below:
Before I dissect my definitions listed above, I'll say that bygfoot already has a help page here: https://bygfoot.sourceforge.io/new/doc/ ... tries.html, that can be used to write a country definition file, but there are some things I want to point out also. So now, let's dissect this thing.
To begin with, you have the file begin with the line of:
From my recollection, that line is needed in the file so that the bygfoot program can read the file in .xml format properly. Additionally, the file and all .xml files for bygfoot should be saved in ANSI format I believe, if saved through Windows. Or if I recall correctly, when I was saving files through windows using the program notepad, the files had to be saved in ANSI format to work properly. In Linux, I don't think there is that problem as at least through leafpad which I use, UTF-8 is an option and it works perfectly with bygfoot.
With the section of:
You see the opening tag of <country>, for which there is a corresponding closing tag of </country> at the end of the file, which basically is the top level definition for the country file. Everything else now gives the details to how the definitions will work. With the above 4 tags, two of those are very important for various reasons and the other two are potentially window dressing but still play a role in the game experience.
Although it isn't necessarily listed, the <name> tag is important since it gives the country a literal name to use. An undocumented feature of the <name> tag is that when you have the autosave feature on in bygfoot, it takes what is between the <name> tags and uses that as part of the filename for the autosave file. But one bug in bygfoot is that in the autosave feature, as it uses the username, country name, and team name as part of the filename for the autosave file, it will only account for the team name having more than one word in it. This means that if you have a username (, which you sign up with when you start a new game,) or a country name (, which you enter here between the <name> tags,) which have more than one word associated with them and thus a space between those words, either your autosave games won't save properly and/or you will get an error message and your game may crash. So having a username like "Joe Smith", a country name of "San Marino", and a team name of "San Giovanni", when bygfoot goes to autosave your progress, it will fail because of the spaces between the words in the username and the country name. As mentioned before, the autosave feature expects that the team name will most likely have more than one word in it so it will compensate by inserting an underscore between the words to fill in the space. So when you start a game, it is best to either use a name with no spaces in it or use either a minus sign or underscore to connect multiple words together so that no spaces are between them. As for the country name, this is why you see the name as "San_Marino" instead of just "San Marino". I've inserted the underscore between the words for this very issue.
Now onto the <sid> tag. Basically, this relates to the country_*.xml file. As the filename is country_san_marino.xml, the part between the <sid> tag would have to match the filename exactly so it can be read by bygfoot properly. Otherwise the format would be country_<sid>.xml, where the value for <sid> would be between the <sid> tag, which in this case is "san_marino".
The <symbol> tag is basically if you want to include an image to represent your country, like say the country's flag, then it could be used for all competitions that are national, I believe. I say I believe since I also include the <symbol> tag in the national leagues and cups also. As for the <rating> tag, it relates to the rating of job offers from 1 to 10, of which 10 is the highest value. The high value ratings are perceived to be more enjoyable or valued than low value ratings. Think of England as being a rating of 10, as being with the English system may be more favorable than being within the San Marino system.
As for the leagues section, this is basically self explanatory as this is where the league files are listed for people to play a team from. You can only play a team that is located in a league file that is listed in the league section. Although there are two different leagues listed, they are both at the same level, that being the first tier. San Marino is one of those unique countries that have two leagues in the same tier or conference, but also don't play by standard rules it seems.
As for the <cups> section, there are both national cups and international cups that are listed. The cups listed above are the national cups for my San Marino definitions. The "san_marino_coppa" is San Marino's national cup tournament, the Coppa Titano. The 4 cup files with "playoffs" in their name are basically that...tournaments that were based upon league rankings and then a set of play-offs are played to determine a champion. I'll also add that with the play-off cups, they are basically listed in an order that represents when they are played. The *_playoffs_group_* cups are two separate cups that are played separately but at the same time. The *_playoffs_final_qualifier is played AFTER the two group cups are finished and the *_playoffs_final is played after the previous 3 playoffs cups are also finished.
The "san_marino_supercoppa" is the tournament where the winner of the Coppa Titano plays the winner of the Championship Play-offs, or the 2nd placed team of the Play-offs if the winner of the Play-offs is also the winner of the Titano. Basically these files are listed in an order that would be played from top to bottom and all the teams are taken from the league files. As for the san_marino_supercoppa, this file can actually be placed anywhere in the list AFTER the above listed files, but I chose to put it where it is since it is a national cup and I decided to group it with the other national cups in this list.
As for the international cups within the <cups> section, they are a bit different. The international cups would include teams from other leagues that would have to be generated and would only be available to the best team(s) in the league to participate in. So depending on the cup, the order in which the cups are listed can be very important for proper selection. This is something I didn't quite know about before which is why I had an issue with this with my San Marino definitions, before I became aware of the solution by pure chance, when working on a totally different country definition. On the website mentioned above that offers help in writing a country file, one of the notes listed is as follows:
Now how this all relates to my country definitions is that for the UEFA Cup/Europa League and the UEFA Champions League, each of those cups has one or more qualifying spots available to the teams in my leagues, and getting the right teams to the right spots is important. And this is where my problem was. When I look at the way the cups are listed in the <cups> section, I perceived it to be that from the top to the bottom of the list, those teams would be loaded in order and run in that order during the season. That was partly right. The part that was right was that during the season, from week to week, the particular cups are updated in the list from top to bottom, I believe. The part I got wrong was how the teams are loaded at the beginning of a season.
As the UEFA Champions League is the higher ranked competition compared to the UEFA Cup/Europa League, the higher ranked qualification in the national leagues gets to play in the UEFA Champions League and the second highest ranked qualification in the national leagues gets to play in the UEFA Cup/Europa League, since in my definitions, there are only two qualifying spots for San Marino. The qualifying spots are the winner of the Championship Play-Offs (cup file supercup_san_marino_playoffs_final), which would be the higher ranked qualifying spot, and the winner of the Coppa Titano, the national cup (cup file san_marino_coppa), which would be the lower ranked qualifying spot. So as one team can realistically win both qualifying spots, we want that winner to go to the higher ranked competition and the 2nd placed team in the lower ranked qualifying spot to go to the lower ranked competition. So this means that the winner of the Play-Offs would go to the Champions League and the winner or runner-up of the Coppa Titano would go to the UEFA Cup/Europa League.
And here's the rub. As the note mentioned above from the website says, "If there's a double winner, e.g. a team winning both the first league and the first cup, the league runner-up should participate in the CWC.), they should be listed in reversed priority order." Well, it doesn't really say why. Well, I checked that out by running bygfoot in debug mode (bygfoot -d ###) when starting a game and it gave me the answer. When you start a game, before selecting a sponsor, the definitions files are run and loaded to initialize your game so it will work. WIth regards to the cup files, they are read from the bottom of the list up, which is why the UEFA Cup/Europa League (file "europe_uefa1_sm") is listed in the <cups> section before the UEFA Champions League (file "europe_champ_league_sm"). But alas, I never knew this before and in my definitions that were failing, I had the order of the UEFA Cup/Europa League and the UEFA Champions League switched so that the Champions League file was listed before the UEFA Cup/Europa League file, in the <cups> section, as illustrated below:
Since the <cups> section is read from the bottom of the list up on start-up, and subsequently every season start-up thereafter, as I had a team that won both the national cup and the Play-Offs, the UEFA Cup/Europa League was loading up first and took the winner of the national cup. When it came time to load up the team for the Champions League, as the winner of the Play-Offs was the same team that won the national cup, as I only had the winner of the Play-Offs selected for the Champions League, it failed as that team was already selected and no other team was available to be substituted in its place, unlike the UEFA Cup/Europa League where the runner-up could be selected if the winner was already selected prior. So as I had no clue about why it was failing until I stumbled upon the answer, I was using the above listed order for the two international cups, not knowing that it was that order that was actually causing the problem, and that it had nothing to do with the national cups, which I was trying to modify and test to see if they would resolve my problem that I had created. Oh well.
So that is my big spiel. When you have cups that are dependent upon the results of other cups, their order is important. When you have international cups that have qualifications that are dependent upon certain criteria and multiple cups to boot, the order in which they are listed and loaded is very important. If you have cups that are just based on league standing and all teams generated are from other league files, order isn't as important but still nice to have. This truly was an eye opener for me and I'll have to pay attention in the future on how I order my listings in the <cups> section for sure. So after all of this writing and information, hopefully this can help someone if they too are having problems when redesigning international cups for their definitions.
Until then, take care and have fun and happy gaming.
will_the_canuck
So to begin with, here's an example of my San Marino definitions, which are part of the definitions for Europe. I'll add that the following country file works in my definitions, which prior, it did not. This is the country_san_marino.xml file illustrated below:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<country>
<name>San_Marino</name>
<symbol>flag_san_marino.png</symbol>
<sid>san_marino</sid>
<rating>4</rating>
<leagues>
<league>san_marino_group_a</league>
<league>san_marino_group_b</league>
</leagues>
<cups>
<cup>san_marino_coppa</cup>
<cup>san_marino_playoffs_group_1</cup>
<cup>san_marino_playoffs_group_2</cup>
<cup>san_marino_playoffs_final_qualifier</cup>
<cup>supercup_san_marino_playoffs_final</cup>
<cup>san_marino_supercoppa</cup>
<cup>europe_uefa1_sm</cup>
<cup>europe_champ_league_sm</cup>
<cup>conmebol_copa_libertadores_fifa</cup>
<cup>supercup_europe_uefa</cup>
<cup>supercup_europe_intercontinental_sm</cup>
</cups>
</country>
To begin with, you have the file begin with the line of:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
With the section of:
Code: Select all
<country>
<name>San_Marino</name>
<symbol>flag_san_marino.png</symbol>
<sid>san_marino</sid>
<rating>4</rating>
Although it isn't necessarily listed, the <name> tag is important since it gives the country a literal name to use. An undocumented feature of the <name> tag is that when you have the autosave feature on in bygfoot, it takes what is between the <name> tags and uses that as part of the filename for the autosave file. But one bug in bygfoot is that in the autosave feature, as it uses the username, country name, and team name as part of the filename for the autosave file, it will only account for the team name having more than one word in it. This means that if you have a username (, which you sign up with when you start a new game,) or a country name (, which you enter here between the <name> tags,) which have more than one word associated with them and thus a space between those words, either your autosave games won't save properly and/or you will get an error message and your game may crash. So having a username like "Joe Smith", a country name of "San Marino", and a team name of "San Giovanni", when bygfoot goes to autosave your progress, it will fail because of the spaces between the words in the username and the country name. As mentioned before, the autosave feature expects that the team name will most likely have more than one word in it so it will compensate by inserting an underscore between the words to fill in the space. So when you start a game, it is best to either use a name with no spaces in it or use either a minus sign or underscore to connect multiple words together so that no spaces are between them. As for the country name, this is why you see the name as "San_Marino" instead of just "San Marino". I've inserted the underscore between the words for this very issue.
Now onto the <sid> tag. Basically, this relates to the country_*.xml file. As the filename is country_san_marino.xml, the part between the <sid> tag would have to match the filename exactly so it can be read by bygfoot properly. Otherwise the format would be country_<sid>.xml, where the value for <sid> would be between the <sid> tag, which in this case is "san_marino".
The <symbol> tag is basically if you want to include an image to represent your country, like say the country's flag, then it could be used for all competitions that are national, I believe. I say I believe since I also include the <symbol> tag in the national leagues and cups also. As for the <rating> tag, it relates to the rating of job offers from 1 to 10, of which 10 is the highest value. The high value ratings are perceived to be more enjoyable or valued than low value ratings. Think of England as being a rating of 10, as being with the English system may be more favorable than being within the San Marino system.
Code: Select all
<leagues>
<league>san_marino_group_a</league>
<league>san_marino_group_b</league>
</leagues>
Code: Select all
<cups>
<cup>san_marino_coppa</cup>
<cup>san_marino_playoffs_group_1</cup>
<cup>san_marino_playoffs_group_2</cup>
<cup>san_marino_playoffs_final_qualifier</cup>
<cup>supercup_san_marino_playoffs_final</cup>
<cup>san_marino_supercoppa</cup>
The "san_marino_supercoppa" is the tournament where the winner of the Coppa Titano plays the winner of the Championship Play-offs, or the 2nd placed team of the Play-offs if the winner of the Play-offs is also the winner of the Titano. Basically these files are listed in an order that would be played from top to bottom and all the teams are taken from the league files. As for the san_marino_supercoppa, this file can actually be placed anywhere in the list AFTER the above listed files, but I chose to put it where it is since it is a national cup and I decided to group it with the other national cups in this list.
Code: Select all
<cup>europe_uefa1_sm</cup>
<cup>europe_champ_league_sm</cup>
<cup>conmebol_copa_libertadores_fifa</cup>
<cup>supercup_europe_uefa</cup>
<cup>supercup_europe_intercontinental_sm</cup>
</cups>
</country>
Well, in my example listed above, the "europe_uefa1_sm" represents the UEFA Cup/Europa League; the "europe_champ_league_sm" represents the UEFA Champions League; the "conmebol_copa_libertadores_fifa" represents the Copa CONMEBOL Libertadores that only uses South American teams within its definition; the "supercup_europe_uefa" represents the UEFA SuperCup which has the winner of the UEFA Cup/Europa League play against the winner of the UEFA Champions League; and the supercup_europe_intercontinental_sm" represents the Intercontinental Cup, which has the winner of the UEFA Champions League challenge the winner of the Copa CONMEBOL Libertadores.If there are cups that 'compete' against each other concerning the teams that participate in them, e.g. the Champions' League and the CWC (what does this mean? If there's a double winner, e.g. a team winning both the first league and the first cup, the league runner-up should participate in the CWC.), they should be listed in reversed priority order. In our case, the CL participant gets chosen first. If the team is also qualified for the CWC (ie. a double winner), he doesn't participate in the CWC as well, but the runner-up gets chosen. So, in a way, the CL wins against the CWC.
Now how this all relates to my country definitions is that for the UEFA Cup/Europa League and the UEFA Champions League, each of those cups has one or more qualifying spots available to the teams in my leagues, and getting the right teams to the right spots is important. And this is where my problem was. When I look at the way the cups are listed in the <cups> section, I perceived it to be that from the top to the bottom of the list, those teams would be loaded in order and run in that order during the season. That was partly right. The part that was right was that during the season, from week to week, the particular cups are updated in the list from top to bottom, I believe. The part I got wrong was how the teams are loaded at the beginning of a season.
As the UEFA Champions League is the higher ranked competition compared to the UEFA Cup/Europa League, the higher ranked qualification in the national leagues gets to play in the UEFA Champions League and the second highest ranked qualification in the national leagues gets to play in the UEFA Cup/Europa League, since in my definitions, there are only two qualifying spots for San Marino. The qualifying spots are the winner of the Championship Play-Offs (cup file supercup_san_marino_playoffs_final), which would be the higher ranked qualifying spot, and the winner of the Coppa Titano, the national cup (cup file san_marino_coppa), which would be the lower ranked qualifying spot. So as one team can realistically win both qualifying spots, we want that winner to go to the higher ranked competition and the 2nd placed team in the lower ranked qualifying spot to go to the lower ranked competition. So this means that the winner of the Play-Offs would go to the Champions League and the winner or runner-up of the Coppa Titano would go to the UEFA Cup/Europa League.
And here's the rub. As the note mentioned above from the website says, "If there's a double winner, e.g. a team winning both the first league and the first cup, the league runner-up should participate in the CWC.), they should be listed in reversed priority order." Well, it doesn't really say why. Well, I checked that out by running bygfoot in debug mode (bygfoot -d ###) when starting a game and it gave me the answer. When you start a game, before selecting a sponsor, the definitions files are run and loaded to initialize your game so it will work. WIth regards to the cup files, they are read from the bottom of the list up, which is why the UEFA Cup/Europa League (file "europe_uefa1_sm") is listed in the <cups> section before the UEFA Champions League (file "europe_champ_league_sm"). But alas, I never knew this before and in my definitions that were failing, I had the order of the UEFA Cup/Europa League and the UEFA Champions League switched so that the Champions League file was listed before the UEFA Cup/Europa League file, in the <cups> section, as illustrated below:
Code: Select all
<cup>europe_champ_league_sm</cup>
<cup>europe_uefa1_sm</cup>
<cup>conmebol_copa_libertadores_fifa</cup>
So that is my big spiel. When you have cups that are dependent upon the results of other cups, their order is important. When you have international cups that have qualifications that are dependent upon certain criteria and multiple cups to boot, the order in which they are listed and loaded is very important. If you have cups that are just based on league standing and all teams generated are from other league files, order isn't as important but still nice to have. This truly was an eye opener for me and I'll have to pay attention in the future on how I order my listings in the <cups> section for sure. So after all of this writing and information, hopefully this can help someone if they too are having problems when redesigning international cups for their definitions.
Until then, take care and have fun and happy gaming.
will_the_canuck