Author Topic: TUTORIAL: How to create .DIY tournament with groups and schedule as you want  (Read 10722 times)

0 Members and 1 Guest are viewing this topic.

Offline Mozg

  • PRO
  • **
  • Posts: 168
  • Gender: Male
    • last.fm profile
All numbers in this article are presented in hexadecimal system.
This tutorial looks quite long and complicated, but after understanding it and get some practice, making a tournament shouldn't take more than five minutes.
SWOS++ patch is a comfotable tool that will allow you to play your tournament when you want to play it again and manage another team without requirement of creating if from the beginning.


0. Technical introduction
If you dont care about details and just want to know how to create tournaments, you can skip this section.

Some time ago I've started to study the .DIY file structure by using some hex editor, because I tried to discover some way how to make tournaments in which squads of each group will be as I want it to be. So first thing that I've noticed was that all teams data is stored in .DIY file (this data begins at offset #1447). So the natural next step was to find, in what way the rest of file is related with that data. After some trials of change the hex code it turned out that the following three groups of bytes are connected with the informations about which team plays in which group.

1. from #0059 to #0098
2. from #048C to #050B
3. from #050C to #054B

This sets contains something like "pointers" to respective teams. First set always contains 64 bytes with randomly ordered values from 00 to 3F, the same as third set. However, second set of bytes contains 128 bytes which are 64 pair of bytes, each pair of byte represents one number, and the numbers are always from 00-00 to 6E-04 with jump 12-00 (6E-04 is a representation of the number 46E, because in SWOS hex code all numbers which are represented in more than one byte, are represented is sometning like "reverse notation", for example the hex number 1234 will be presented as 34-12, ABCD as CD-AB, etc.) Despite the fact that I knew this, I couldn't find the relations betweent this groups of "pointers". All my trials of edit it had strange effects. The only thing that I did without any crashes was to sort these groups. So in place of first and third set I typed sequence of numbers from 00 to 3F, and in place of second set I wrote the sequence 00-00 12-00 24-00 36-00... and so on, to 6E-04. Then it turned out that squads of groups were connected with the order of the teams in .DIY file: for example in the 4 grous of 4 tournament, after sorting sets of bytes I've mentioned before, in group A played first four teams from the .DIY file, in group B played next four teams, and so on. After some time, I've noticed thing that was key: teams in .DIY file are stored in the same order as you had chosen it while created tournament in SWOS! So it's necessary only to select teams to tounament in SWOS with proper order (teams that you want to be in group A at the beginning, teams from last group at the end), sort the groups of bytes, and that's it! And it works :)

1. Instruction

0. At the beginning of course you should have some hex editor, because you will have to edit .DIY file hexadecimally (some editors are freeware and available to download from web, I'm personally using Translhextion.)

1. Run SWOS and create your tournament by DIY COMPETITIONS. The most important thing in this step is the order of choosing teams. You have to choose teams that you want to play in group A at the beginning, then teams from group B, then C (if there are more than two groups of course), etc... In the case that first round is knockout, you have simply to choose the first pair at the beginning, next the second pair, etc. (It works olny when you are creating TOURNAMENT, not CUP)  Next save the tournament and close SWOS.

2. Run your hex editor and load .DIY file with your tournaments. Now, only thing you have to do in this step is to paste (overwrite, not insert!) some sequences in respective places.

First sequence of bytes is:

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

This sequence have to be pasted in two places: from #0059 to #0098 and from #050C to #054B.

Second sequence is:

00 00 12 00 24 00 36 00 48 00 5A 00 6C 00 7E 00 90 00 A2 00 B4 00 C6 00 D8 00 EA 00 FC 00 0E 01 20 01 32 01 44 01 56 01 68 01 7A 01 8C 01 9E 01 B0 01 C2 01 D4 01 E6 01 F8 01 0A 02 1C 02 2E 02 40 02 52 02 64 02 76 02 88 02 9A 02 AC 02 BE 02 D0 02 E2 02 F4 02 06 03 18 03 2A 03 3C 03 4E 03 60 03 72 03 84 03 96 03 A8 03 BA 03 CC 03 DE 03 F0 03 02 04 14 04 26 04 38 04 4A 04 5C 04 6E 04

You have to type it from #048C to #050B. Next save changes.

3. Your tournament is ready to play :)

2. Schedule setting

In some cases, there is possible also to create schedule of matches as you want it to be, because teams always plays matches in the same order, and that order also depends on the order that you have chosen teams while creating tournament in SWOS.
I'll give an example: you created tournament and put Italy, Germany, England and Brazil in group A, and you have selected that teams in that order. Schedule in group A will be following:

Germany v Italy
Brazil v England

England v Italy
Brazil v Germany

Italy v Brazil
Germany v England

In general, it is:

A2 v A1, A4 v A3; A3 v A1, A4 v A2, A1 v A4, A2 v A3

where A1 is the team that you have chosen first, A2 is second chosen team, etc.

When there is "play each team x more than 1" in your tournament, then the second round are replay of the first round, only home teams are changed.

If you are creating tournament with number of teams in group different from four, it is also possible to set the schedule, you have just first to create tournament as you want to be, sort groups of bytes, and study by your own how SWOS is making schedule in your case.

2.1. "Seeded" option

If the second round in your tournament is knockout and you checked "seeded" while creating tournament, you know also the schedule of second round, because SWOS has it's own way of create seeded knockout stages that are not random (if second round are group stage, random elements appears). For example, let's consider tournament 4 groups of 4 with quarterfinals after that, and let "A1" be the notation of winnes of group A. After first round, SWOS created something like sequence of teams that will be played in second group, which in our case is: A1 B1 C1 D1 A2 B2 C2 D2 (first group winners, next runner ups, next third places if exists, etc.). And the first pair of the knockout is the first and last team of the sequence, second pair is second and next to last team, etc. So the quarterfinals will be as following:

A1-D2
B1-C2
C1-B2
D1-A2

If you will understand this exapmle, I think it should be clear how it works in another cases.

If the first stage was knockout, then the first team in the sequence is simply winner of first pair, etc.
« Last Edit: 13 December 2009, 18:43:24 by Mozg »

Offline Playaveli

  • 'Sherlock'
  • Administrator
  • SWOS Legend
  • *****
  • Posts: 8594
  • Gender: Male
  • "SWOS - A way of life" (J.R.)
    • Visit me on Facebook
Best technical post for a long time! Thanks. Especially usefull for tournaments.
Someone can program a tool to make this work automatic with a graphical and userfriendly interface.

For those about to SWOS - We salute you
http://www.facebook.com/playaveli.swos

Offline MIJB#19

  • PRO
  • **
  • Posts: 126
    • SWOS Netherlands
Awesome stuff!

Offline Marin Parushev

  • Cpt.
  • ***
  • Posts: 309
Great article. Some of the things in it I didn't know. It was really helpful to me. Thank you!

Offline Schulle

  • "devil's right swos hand"
  • SWOS Legend
  • *****
  • Posts: 2573
  • Voll in's Netz!!!
    • ISSF - InternationalSensible Soccer Foundation ESSA
[...]
Someone can program a tool to make this work automatic with a graphical and userfriendly interface.

Anything happend in this direction?
I spent a lot of money on booze, birds and fast cars. The rest I just squandered.
[GEORGE BEST]

Offline Playaveli

  • 'Sherlock'
  • Administrator
  • SWOS Legend
  • *****
  • Posts: 8594
  • Gender: Male
  • "SWOS - A way of life" (J.R.)
    • Visit me on Facebook
I think Marin was onto something here!

For those about to SWOS - We salute you
http://www.facebook.com/playaveli.swos

Offline Marin Parushev

  • Cpt.
  • ***
  • Posts: 309
I wrote a program using Visual Studio 2005 that would open a .DIY file and would edit those bytes so that you can order the teams. I sent it to Playaveli and Bomb. Bomb wrote me that it's working fine.
So far the program consists of one executable and can be ran only on Windows systems and only if you have the Microsoft .NET framework installed. I am not an expert on Visual Studio but a friend of mine told me that the .NET framework comes with the recent Windows updates.
I am looking now for ways in which I can expand the program and add some more functionalities to it.

Offline Schulle

  • "devil's right swos hand"
  • SWOS Legend
  • *****
  • Posts: 2573
  • Voll in's Netz!!!
    • ISSF - InternationalSensible Soccer Foundation ESSA
great job!
I spent a lot of money on booze, birds and fast cars. The rest I just squandered.
[GEORGE BEST]

Offline Mozg

  • PRO
  • **
  • Posts: 168
  • Gender: Male
    • last.fm profile
That's nice that somebody's continuing my work :) So if you are working on a program, i have an idea for you: The program could also allow us to set a group squad, not only to sort byte. It can be realized by sorting bytes firstly, and then sorting team informations at the end of the byte respectively. Additionaly bytes from #0099 should be sorted, because there are stored informations about team numbers and team countries. I don't know yet where are stored information about number of groups and teams per group, but if it will be helpful to somebody, I can try to find it out, if I'll have some time :)

Offline Marin Parushev

  • Cpt.
  • ***
  • Posts: 309
Yes, that's the same thing I was thinking about. I know how team information is saved in the .DIY file. I just have to think of some good user interface.

Offline Marin Parushev

  • Cpt.
  • ***
  • Posts: 309
Mozg, in order to see where SWOS saves the number of groups you can try the following:
Create 2 tournaments in SWOS. For example 1 tournament with 2 groups with 6 teams each and 1 tournament with 3 groups with 4 teams each.
Try to make everything else in those tournaments the same (from tournament name to points for a win).
Save both tournaments before the first game.
Open a program that allows binary comparison of files and compare the files.
In some byte the value in the first tournament will be 2 and the same byte in the other tournament will be 3.

Offline MIJB#19

  • PRO
  • **
  • Posts: 126
    • SWOS Netherlands
As I found the WorldCup2010 DIY file, I'm wondering which hex position has to be changed to set the team control to human, instead of CPU?

Offline rw9018

  • RES
  • *
  • Posts: 53
MIJB#19 - if you play using SWOS Total Pack there is an option in the SWOS++ game menu that allows you to edit DIY files.  Then you can select which team you want to play.  No need to hex edit. 

The France National team seem very good in this DIY file, no?!  That would be a surprise - Domenech from villain to hero!

Offline MIJB#19

  • PRO
  • **
  • Posts: 126
    • SWOS Netherlands
Thanks for the info. I haven't tried the SWOS Total Pack yet, I'll give that a shot!