1.9.0: Cup definition files

The developers will post here to let you peek into future versions and announce new releases.

Moderator: idcarlos

Post Reply
gyboth
Site Admin
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany
Contact:

1.9.0: Cup definition files

Post by gyboth »

in the 1.9 branch, the country file system will be different from the current system. there will be country files in XML format containing some general information about the country, but no teams or cups. those will be loaded from separate XML files (the names of which will be specified in the country definition file). here's such a cup definition file (which isn't 'finalized', of course) that will be loaded:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>  
<cup>
  <name>Champions' League</name>
  <short_name>CL</short_name>
  <symbol>flag_eu.png</symbol>
     // unique string id
  <sid>champ_league</sid>
    // cup type (national, international, supercup)
  <type>international</type>
    // how many yellow cards until a player gets banned for a game
  <yellow_red>3</yellow_red>
    // the difference to the average skill of league 1 in the country
  <skill_diff>8</skill_diff>
   // the week of the last matchday
  <last_week>46</last_week>
    // weeks between matchdays
  <week_gap>4</week_gap>
  <average_stadium_capacity>50000</average_stadium_capacity>

   // rounds of the cup
  <cup_rounds>
     // first round: round robin with 4 groups and the 2 best teams advancing from each group
    <cup_round>
    <number_of_groups>4</number_of_groups>
    <number_of_advance>2</number_of_advance>
    </cup_round>

     // 2nd and 3rd rounds: empty (they get filled with default values, those being: home_away: yes, neutral: no, replay: no, round robin: no)
    <cup_round>
    </cup_round>

    <cup_round>
    </cup_round>

       // the final is a single match, so home_away is 0; and there is no home advantage, it's on neutral ground.
    <cup_round>
    <home_away>0</home_away>
    <neutral>1</neutral>
    </cup_round>

  </cup_rounds>

    // this tells us which team from the user's leagues participates
  <choose_team_user>
   // first league in the leagues list
  <choose_team_sid>league1</choose_team_sid>
   // only one team
  <number_of_teams>1</number_of_teams>
   // namely the team with rank 1
  <start_idx>1</start_idx>
  <end_idx>1</end_idx>
  </choose_team_user>

    // here come the teams that get loaded from league files
  <choose_teams>
  
  <choose_team>
    // which league xml file ('league_' and '.xml' get appended automatically)
  <choose_team_sid>france1_short</choose_team_sid>
    // how many teams
  <number_of_teams>1</number_of_teams>
      // whether or not to choose randomly
  <randomly>1</randomly>
  </choose_team>
    ...... <snip> ......
  <choose_team>
  <choose_team_sid>denmark1_short</choose_team_sid>
  <number_of_teams>1</number_of_teams>
  <randomly>1</randomly>
  </choose_team>

  </choose_teams>

</cup>
Note: The '//'-comments aren't really fitting, because we have an XML-file here.

suggestions, criticism and such are, as always, welcome.

gyözö
Press any key to continue or any other key to quit.
GeoVah
Posts: 50
Joined: Sat Dec 18, 2004 10:38 am
Location: Sophia Antipolis - France

Re: 1.9.0: Cup definition files

Post by GeoVah »

gyboth wrote:in the 1.9 branch, the country file system will be different from the current system. there will be country files in XML format containing some general information about the country, but no teams or cups. those will be loaded from separate XML files (the names of which will be specified in the country definition file). here's such a cup definition file (which isn't 'finalized', of course) that will be loaded:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>  
<cup>
  <name>Champions' League</name>
  <short_name>CL</short_name>
  <symbol>flag_eu.png</symbol>
     // unique string id
  <sid>champ_league</sid>
    // cup type (national, international, supercup)
  <type>international</type>
    // how many yellow cards until a player gets banned for a game
  <yellow_red>3</yellow_red>
    // the difference to the average skill of league 1 in the country
  <skill_diff>8</skill_diff>
   // the week of the last matchday
  <last_week>46</last_week>
    // weeks between matchdays
  <week_gap>4</week_gap>
  <average_stadium_capacity>50000</average_stadium_capacity>

   // rounds of the cup
  <cup_rounds>
     // first round: round robin with 4 groups and the 2 best teams advancing from each group
    <cup_round>
    <number_of_groups>4</number_of_groups>
    <number_of_advance>2</number_of_advance>
    </cup_round>

     // 2nd and 3rd rounds: empty (they get filled with default values, those being: home_away: yes, neutral: no, replay: no, round robin: no)
    <cup_round>
    </cup_round>

    <cup_round>
    </cup_round>

       // the final is a single match, so home_away is 0; and there is no home advantage, it's on neutral ground.
    <cup_round>
    <home_away>0</home_away>
    <neutral>1</neutral>
    </cup_round>

  </cup_rounds>

    // this tells us which team from the user's leagues participates
  <choose_team_user>
   // first league in the leagues list
  <choose_team_sid>league1</choose_team_sid>
   // only one team
  <number_of_teams>1</number_of_teams>
   // namely the team with rank 1
  <start_idx>1</start_idx>
  <end_idx>1</end_idx>
  </choose_team_user>

    // here come the teams that get loaded from league files
  <choose_teams>
  
  <choose_team>
    // which league xml file ('league_' and '.xml' get appended automatically)
  <choose_team_sid>france1_short</choose_team_sid>
    // how many teams
  <number_of_teams>1</number_of_teams>
      // whether or not to choose randomly
  <randomly>1</randomly>
  </choose_team>
    ...... <snip> ......
  <choose_team>
  <choose_team_sid>denmark1_short</choose_team_sid>
  <number_of_teams>1</number_of_teams>
  <randomly>1</randomly>
  </choose_team>

  </choose_teams>

</cup>
Note: The '//'-comments aren't really fitting, because we have an XML-file here.

suggestions, criticism and such are, as always, welcome.

gyözö
Just a little thing:
as long as sid is unique for a cup, make sid has attribut :

Code: Select all

<cup sid="champ_league">
  <name>Champions' League</name>
  <short_name>CL</short_name>
  <symbol>flag_eu.png</symbol>
    // cup type (national, international, supercup)
Geovah - geovah@jabber.sk- (yes i'm french...)
gyboth
Site Admin
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany
Contact:

Re: 1.9.0: Cup definition files

Post by gyboth »

erm... did you really have to quote the whole post? ;-)
GeoVah wrote:Just a little thing:
as long as sid is unique for a cup, make sid has attribut :

Code: Select all

<cup sid="champ_league">
all right, that'd work, too. i don't have experience with xml or html: what's the advantage of an attribute?

gyözö
Press any key to continue or any other key to quit.
GeoVah
Posts: 50
Joined: Sat Dec 18, 2004 10:38 am
Location: Sophia Antipolis - France

Re: 1.9.0: Cup definition files

Post by GeoVah »

gyboth wrote:erm... did you really have to quote the whole post? ;-)
Herrr i didn't quote the whole post, who have change it ?
gyboth wrote:
GeoVah wrote:Just a little thing:
as long as sid is unique for a cup, make sid has attribut :

Code: Select all

<cup sid="champ_league">
all right, that'd work, too. i don't have experience with xml or html: what's the advantage of an attribute?

gyözö
In this case, when you parse/read your XML data, instead of search in child of "cup" the sid info, you can find it with the attribute, so it's more easy ?
I don't know real advantage of atribute, i always use it when it can help me... ;-)
Geovah - geovah@jabber.sk- (yes i'm french...)
gyboth
Site Admin
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany
Contact:

Re: 1.9.0: Cup definition files

Post by gyboth »

GeoVah wrote:Herrr i didn't quote the whole post, who have change it ?
not me :-)
In this case, when you parse/read your XML data, instead of search in child of "cup" the sid info, you can find it with the attribute, so it's more easy ?
now, is this a fact or an assumption of yours?

if it's a fact, there might be some places to use it, but not necessarily the sid; maybe rather those parts where there's a lot to load, like team names. there's only one sid per file, so making it an attribute doesn't speed things up a lot. on the other hand, if we do it, let's do it right; let's use it anywhere we can.

gyözö
Press any key to continue or any other key to quit.
gyboth
Site Admin
Posts: 1421
Joined: Sat Dec 18, 2004 8:42 am
Location: Passau, Germany
Contact:

Re: 1.9.0: Cup definition files

Post by gyboth »

GeoVah wrote: I don't know real advantage of atribute, i always use it when it can help me... ;-)
on second thought, attributes make xml files a bit less clear-structured in my opinion. and there aren't that many load/save actions in the game (not the country/league/cup files, at least), so i think i'm against attributes, after all.

gyözö
Press any key to continue or any other key to quit.
Post Reply