Help with <delay> tag?

Forum devoted to country/league/cup/team definition topics. You can also get help here if you have trouble writing or using a definition.
Post Reply
will_the_canuck
Posts: 141
Joined: Tue Jan 16, 2018 5:54 am
Location: Canada

Help with <delay> tag?

Post by will_the_canuck »

Hello. :)

I'm trying to re-do the USA definitions to an updated model and I'm at the point where I have the league files done for the 4 different associations and I'm trying to get the play-off files working but I'm coming up with a problem.

To this point, I've changed the definitions by updating the MLS, USL and PDL leagues and adding the NPSL league, as an equivalent one to the PDL league. I don't have the US Cup or Concacaf added yet but I want to keep it simple enough and expand it to include the Canadian teams as well as the US teams that are listed in the USA definitions. So right now it simply plays the (level 1) MLS Eastern and Western Conference teams, the (level 2) USL Eastern and Western Conference teams, and the (level 3) PDL (4 conferences and 11 divisions with 74 teams) and (level 3) NPSL (4 conferences and 13 divisions with 98 teams) teams. There's also a play-off system for those leagues and I've also added a promotion and relegation factor in which seems kind of fun I think.

Now my problem relates to I believe the <delay> tag when I'm using it in a cup defintion. When I used the <delay> tag for a period of 1 week, the next week the round would play normally but then the next round would be played in the same week but separate round. i.e. round one would be played in week 33-1 and round two would be played in week 33-2. This would not be my intention for the game as I wanted a whole week to be played for round one (week 33) and round two (week 34). Is this something that is supposed to happen or what per say? The code I'm using is as follows for a cup definition:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<cup>
	<name>PDL Central Conference Playoffs</name>
	<short_name>PDL_CC_Playoffs</short_name>
	<symbol>flag_usa.png</symbol>
	<sid>united_states_pdl_cent_playoffs</sid>
	<add_week>1000</add_week>
	<week_gap>1</week_gap>
	<property>national</property>
	<property>highlight1</property>
	<yellow_red>2</yellow_red>

	<cup_rounds>
		<cup_round>
			<home_away>0</home_away>
			<delay>1</delay>
			<choose_teams>
				<choose_team>
					<choose_team_sid>united_states3a01</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<start_idx>2</start_idx>
					<end_idx>3</end_idx>
				</choose_team>
				<choose_team>
					<choose_team_sid>united_states3a02</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<start_idx>2</start_idx>
					<end_idx>3</end_idx>
				</choose_team>
			</choose_teams>
		</cup_round>

		<cup_round>
			<home_away>0</home_away>
			<choose_teams>
				<choose_team>
					<choose_team_sid>united_states3a01</choose_team_sid>
					<number_of_teams>1</number_of_teams>
					<start_idx>1</start_idx>
					<end_idx>1</end_idx>
				</choose_team>
				<choose_team>
					<choose_team_sid>united_states3a02</choose_team_sid>
					<number_of_teams>1</number_of_teams>
					<start_idx>1</start_idx>
					<end_idx>1</end_idx>
				</choose_team>
			</choose_teams>
		</cup_round>

		<cup_round>
			<home_away>0</home_away>
		</cup_round>

	</cup_rounds>
</cup>
For the above listed code, the league season ends in week 31. I have a delay for week 32 to give the teams a fair chance to be at full health when playing and play is supposed to start in week 33. The two winners from round one then play the two division leaders in week 34 and those winners play each other in week 35 to have a champion for the PDL Central Conference. Although when I tried it on my system, the second round was played in week 33-2 and the final round was played in week 34, instead of week 35.

I don't use the <last_week> tag and really, it shouldn't matter, but if I did use it, would it resolve this issue or is this <delay> tag an issue of a different sort?

Thanks in advance,

will_the_canuck

PS - looking at the code for a promotion game for mexico2, there is a <cup_round> tag of <two_match_week> with a value of 1. I'm just wondering if I were to use this tag but with a value of 0, would this resolve my issue? I guess the real issue is that two rounds are being played in the one week but the code doesn't necessarily say that, to my knowledge. Oh well.
will_the_canuck
Posts: 141
Joined: Tue Jan 16, 2018 5:54 am
Location: Canada

Re: Help with <delay> tag?

Post by will_the_canuck »

Hello all.

Well, having written a cup definition or two and experimented with various things, I've come to a few conclusions which I will share, in case other people have similar issues and don't know how to resolve the matter.

With the example listed in the previous post:

Code: Select all

<cup>
   <name>PDL Central Conference Playoffs</name>
   <short_name>PDL_CC_Playoffs</short_name>
   <symbol>flag_usa.png</symbol>
   <sid>united_states_pdl_cent_playoffs</sid>
   <add_week>1000</add_week>
   <week_gap>1</week_gap>
   <property>national</property>
   <property>highlight1</property>
   <yellow_red>2</yellow_red>

   <cup_rounds>
      <cup_round>
         <home_away>0</home_away>
         <delay>1</delay>
         <choose_teams>
            <choose_team>
               <choose_team_sid>united_states3a01</choose_team_sid>
               <number_of_teams>2</number_of_teams>
               <start_idx>2</start_idx>
               <end_idx>3</end_idx>
            </choose_team>
            <choose_team>
               <choose_team_sid>united_states3a02</choose_team_sid>
               <number_of_teams>2</number_of_teams>
               <start_idx>2</start_idx>
               <end_idx>3</end_idx>
            </choose_team>
         </choose_teams>
      </cup_round>

      <cup_round>
         <home_away>0</home_away>
         <choose_teams>
            <choose_team>
               <choose_team_sid>united_states3a01</choose_team_sid>
               <number_of_teams>1</number_of_teams>
               <start_idx>1</start_idx>
               <end_idx>1</end_idx>
            </choose_team>
            <choose_team>
               <choose_team_sid>united_states3a02</choose_team_sid>
               <number_of_teams>1</number_of_teams>
               <start_idx>1</start_idx>
               <end_idx>1</end_idx>
            </choose_team>
         </choose_teams>
      </cup_round>

      <cup_round>
         <home_away>0</home_away>
      </cup_round>

   </cup_rounds>
</cup>
I used the <add_week> tag with a value of 1000. What that means is that when all the teams that will be loaded into this cup are available, the cup then becomes active and will start the week after the last team becomes available. As was mentioned that the last game played was in week 31 and there are three (3) rounds in this cup, of which only one (1) game per round is played, starting in week 32, the cup would normally finish in the third round, which would take place in week 34, which is when the original cup ended in my previous example. The system would expect round one (1) to be played in week 32, round two (2) to be played in week 33, and round three (3) to be played in week 34. Even though I put a <delay> tag with a value of one (1) in the first round, unless I put a <delay> tag in the other two (2) rounds, it would not change the outcome of changing the third (3) round to week 35 instead of it being played in week 34.

Now if I had put a <last_week> tag with a value of 35, I do believe it would work as I would have wanted, since when using the <last_week> tag, the system kind of works it backwards where in this example, round three (3) would take place in week 35, round two (2) would take place in week 34, and round one (1) would take place in week 33. I believe that is correct, unless it only applies to when using an actual week value instead of using 1000 for the <add_week> tag. What I actually ended up doing for this case was having the <add_week> tag with a value of 32 and the <last_week> tag with a value of 35. By using those values, the cup was played out how I wanted it to. Again, I don't know if it was because I didn't use the <add_week> tag with a value of 1000 or because I used the <last_week> tag with a value of 35 and the <add_week> tag with a value of 32. Since I only use the <add_week> tag with an actual week number value, I try to stay away from using the value of 1000 with the <add_week> tag. But let it be known that I try to map out the related weeks for my leagues and cups because if you were to start a cup when just one team is not yet available when using the <add_week> tag with a value of a week number instead of 1000, you'll get an error message and the game will crash. That was always a fun error to try to figure out.

Now going forward, I'll give another example of how the <delay> tag can be used. The following example is another cup from the same set of definitions:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>	
<cup>
	<name>CONCACAF Champions League</name>
	<short_name>CCL</short_name>
	<sid>united_states_concacaf</sid>
	<symbol>flag_concacaf.png</symbol>
	<talent_diff>250</talent_diff>
	<group>51</group>
	<yellow_red>2</yellow_red>
	<last_week>15</last_week>
	<property>international</property>
	
	<cup_rounds>
		<cup_round>

			<delay>-6</delay>
			<round_name>Round of 16</round_name>
			<new_teams>16</new_teams>

			<choose_teams>
				<choose_team>
					<choose_team_sid>LEAGUE1</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<start_idx>1</start_idx>
					<end_idx>2</end_idx>
				</choose_team>
				<choose_team>
					<choose_team_sid>LEAGUE2</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<start_idx>1</start_idx>
					<end_idx>2</end_idx>
				</choose_team>
				<choose_team>
					<choose_team_sid>costa_rica1_short</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<randomly>1</randomly>
					<generate>1</generate>
				</choose_team>
				<choose_team>
					<choose_team_sid>honduras1_short</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<randomly>1</randomly>
					<generate>1</generate>
				</choose_team>
				<choose_team>
					<choose_team_sid>jamaica1_short</choose_team_sid>
					<number_of_teams>2</number_of_teams>
					<randomly>1</randomly>
					<generate>1</generate>
				</choose_team>
				<choose_team>
					<choose_team_sid>mexico1</choose_team_sid>
					<number_of_teams>4</number_of_teams>
					<randomly>1</randomly>
					<generate>1</generate>
				</choose_team>
				<choose_team>
					<choose_team_sid>canada1_short</choose_team_sid>
					<number_of_teams>1</number_of_teams>
					<randomly>1</randomly>
					<generate>1</generate>
				</choose_team>
				<choose_team>
					<choose_team_sid>costa_rica1_short honduras1_short jamaica1_short</choose_team_sid>
					<number_of_teams>1</number_of_teams>
					<randomly>1</randomly>
					<generate>1</generate>
				</choose_team>
			</choose_teams>

		</cup_round>

		<cup_round>
			<delay>-4</delay>
		</cup_round>

		<cup_round>
			<delay>-2</delay>
		</cup_round>

		<cup_round>
		</cup_round>
	</cup_rounds>
</cup>
In the above example, I have used just a <last_week> tag with a value of 15. Because there is no <add_week> tag, this cup is added and loaded in the first week of the season. I should also add that the teams loaded would use last season's values and placements, if applicable. As you can see, there are four (4) rounds and in each round, the teams will play two (2) games each against each other. So with the above mentioned, 8 games will take place and the last game will be played in week 15. With this in mind, the first game in round one (1) will take place in week 8 and the last game in round four (4) will take place in week 15. As you can see, I have negative values for the <delay> tags in the various rounds except the last, as I want the last one to end when it ends. The way this cup works is that in weeks 2 and 3, round one (1) takes place. In weeks 6 and 7, round two (2) takes place. In weeks 10 and 11, round three (3) takes place. And in weeks 14 and 15, round four (4) takes place. Now working backwards, as round three (3) would normally take place in weeks 12 and 13, I have a <delay> tag with a value of -2 to push the start of the round from week 12 to week 10. For round two (2), as it would normally take place in weeks 10 and 11, I have a <delay> tag with a value of -4 to push the start of the round from week 10 to week 6. And as for round one (1), as it would normally take place in weeks 8 and 9, I have a <delay> tag with a value of -6 to push the start of the round from week 8 to week 2. And by using the <delay> tag in this fashion, I can have the cup rounds play two games a round with two weeks in between rounds, which is what I was wanting for this cup. So basically starting in week two (2), a team would play two (2) games, be off for two (2) weeks if they survived, then play two (2) more games and then be off for two (2) more weeks, etc, etc, etc, until they got to the final round.

Of note, if i used a <delay> tag in the fourth (4) round, having a positive value would have the round play beyond week 15. If I had a negative value, it would be finished before week 15, if it did not interfere with the previous rounds I'm guessing. I guess there is a lot to be said for trial and error. So hopefully this helps explain the <delay> tag a little better for anyone wanting to create or modify their own definitions. Although I'll add that either way, the <delay> tag is a pain in the ass if you get it wrong. :)

Bye for now,

will_the_canuck
Post Reply