• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Documentation of the creation of a Soccer Simulation

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Hey guys! I thought I'd throw this out to see whether there is some interest.

This thread has 4 purposes:


1. Just share my experiences with creating the above mentioned type of game. I thought it might be interesting for a few people to read. Also helps me to sort my thoughts and get clear on where to put priorities.

2. Get Feedback and suggestions on some stuff. If you notice anything that you think is odd, mention it please. I tend to be rather blind after a while when staring at the same screen on end.

3. Maybe get programming advice from fellow interested Gaffers who know their way around C# (It started in this thread, but it was somewhat offtopic anyway)

4. Motivate others to start with their game projects!

I'd really appreciate it if a few people could find the time to check back to this thread now and then to give some comments on what I have done so far, or what could be improved.

I'll list all the posts where I describe actual progress below, so that you only need to check the OP to see whether I made progress if you're interested. I'll also link the current versions of the program for anyone who'd like to check them out yourself. If you havent installed the current .net framework yet, there will be an additional 1.6gb install waiting for you. Sorry guys.

Progress:

1. Making a plan
2. Creating the initial window layout to work with
3. Getting Teams as input and sort them into a table
4. Creating the algorithm to create all league matches
5. Make a basic input and simulation system for the games
6. Saving the game
7. Creating "content" for teams, part I - Players with stats
8. Creating a better Teamviewer
9. Creating "content" for teams, part II - Automatic Formations
10. Creating the TeamFormation window (Substitutions)
11. Planning the Pre Report for the Match Simulation system.
12. How to structure the Match Report segments
13. ??

Current To-Do

Near future:

- Make it save to the same folder as the program
- Adding a check for the team entries, so that you wont make a league with "no name" team
- make the game not crash when exiting the "Enter teams" window without entering teams

If done with "Near future":

- Include Team Tactics (slider?)
- Add a popup Tool box to the Team Formation view for the player values
- Save already simulated matchreports
- Change the result simulation from basic to the simulation of the matchreports

Long term:

- Either make the table scrollable to allow for more teams, or find a way to include all info in one textbox (change to DataGridView)
- Match report system (Serious & Fun versions)
- Look into 2D visualization for the match report (maybe never gonna happen)
- Make variable random names depending on which continent you are playing in

Files:

There are a few bugs I didnt bother fixing yet because they dont occur if you know where they happen, therefore screenshots for explaining buttons/controls:
Main Window: http://i.imgur.com/imVn2.jpg
Team entry: http://i.imgur.com/CMxww.jpg

Version 0.1 - Up to Point 6 in the progress section
http://www.2shared.com/file/NPHY5yho/Soccer_Table_V01.html
F5r3d.jpg

Features:
- Enter own team names
- league table and matchup visualization
- Enter results (will be saves as soon as you hit the "Update Table" button
- Very basic random simulation
- currently saves in C:// directory

Version 0.2.2 - 31.08.11 - will be improved
http://www.2shared.com/file/N8w0wJx1/Soccer_Table_V022.html
e9gEO.jpg

Features, everything as above +
- Creates players for each team with (currently) 13 reasonable random values
- Included the basic Match report system which doesn't save yet and wont do anything spectacular
- Includes an improved Team Viewer with sort by value function
- Includes TeamFormation window, change Team Formation plus substitutable players
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 1: Making a plan

I am currently still on a pretty basic level, regarding programming and I used this project to get used to Object oriented programming and simply practice C#. Actually, I already finished what I wanted to accomplish with the program in the first place (and went on to make it into a proper game), which was this:

Make a program that will easily let me enter results from Fifa games I played with a friend online, and randomize the other results to "simulate" a league table while we are only playing the matches belonging to our team.

The basic problem was that I like to play Fifa with friends online, but its a bit boring not to have any goal, or comparisons. Which is why we used an online league website to track our scores in a league. After every matchday I'd randomize the results from the other teams by giving every team a random amount of goals between 0 and 5 and determine the winner from that. However randomizing these numbers takes way too long if you are playing more than 1 match day at a time, so I wanted a program that will randomize everything for me while still creating a league table.

First step by step plan:

- Make a layout where I'll have the input for the matchresults
- Enter a few teams
- Use those teams to create a league table
- Create all matches from the list of teams
- Make a randomize button which will randomize everything except results I already entered.
- Make saving possible

This is what I accomplished until Part 6. And I basically can use the program for what it was intended. Yay! However, since I already put quite some time in there, I can't stop now, so I was thinking about how to improve on it. Naturally, the direction went from a program to keep track of results and statistics to a game, where I'll have a team, train them, make decisions for the team formation, and get matchreports that will show me what happened in each match. Of course everything will start off with the most basic version possible, but I'll try to extend them bit by bit.

Next big goals (which i sort of make up going along):

- Kick out some bugs
- Give the teams more info that I can work with (Players, Playerstats) that all need to be saved as well after they have been created
- Make Matchreports possible
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 2: Creating the initial window layout to work with

I already changed a lot for the window layout but the earliest consideration were quite modest:

- Have a box to show the league table
- Have another box to show matches and enter match results, with buttons to change matchday
- Have a button to create the league
- Have another button to calculate the league according to the results in the left box

..and looked like this:
0okHt.jpg


I wanted to update the xx/xx above the left box according to the current matchday, which is why there are only x there at the moment. At that point I hadn't done anything interesting, I just wanted the layout to start instead of only imagining. As mentioned above, there were many changes being made as I went along, since I encountered new functions I needed a button for or simply due to the fact that one textbox wasn't enough for what I wanted to do.
I wish everything was as easy as this part. C# in Microsoft Visual Studio has a really awesome drag and drop interface for creating Windows... windows. This basic layout took like.. 2 minutes or something :)
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 3: Getting Teams as input and sort them into a table

The first thing before I could even start testing anything was to get some data. I thought about simply hardcoding a few teams into the program so that I wont need to enter them every time I tried the program, but that would have probably lead to me not making a proper "Enter Teams" window for ages, so I wanted to get this out of the way.

Which means that to get these teams in this box:
0okHt.jpg


I needed a new window to take the user input. Since my initial plan was to create a program to track match results for me I didn't need any random team names, but wanted to create my own teams that I used in an imaginary league with a friend. The only thing that input window needed in the beginning was:

- a textbox to enter Team names
- a button to verify these choices

But as I already mentioned, it was a major pain in the ass to enter 8+ teams every time to test the program, which is why I added another function:

- a button to enter a hardcoded set of teams that will always stay the same for comparison reasons

And then it looked like this:

gOurm.jpg


If you would open the program now, you'd see that there have been no changes to that function up to now, which is also why it is definitely the most buggiest one. I just never cared enough to take care of these bugs as I knew how to avoid them and no one else was using it anyway, but I really need to clean that up soon. The two biggest, that still exist at this point (while I am working on Part 8) are:

- The game crashes when you exit this window without entering any teams, because after exiting the window it tries to take the string inside the textbox and give it to parts of the program which will determine the teams from the player input. Since the string is empty its stuck at a part where its trying to split the string. And since said string is empty, the program goes *poof* It shouldnt be too hard to take care of that, I only need to make sure the program doesnt continue the league creation routine after exiting the window.

- You need to have the cursor on the same line as the last team in the input box. What I am currently doing is to separate the string by every "\n" which is the tag code for "Make a new line" to create team names from the input. So every time you hit enter to go to the next line, the textbox creates an invisible "\n" that takes care of putting the next word on the next line. Since I am dividing the string at every "\n", that string would be divided one more time than it actually needs to. This leads to the last time being named "", because there is nothing after the last "\n". I can probably solve this by checking whether the string ends with a "\n" or not and delete that if necessary.

Two game destroying bugs, but... it works if you avoid them, which is why I stuck with them for so long. So in short, if you enter this:

"A
B
C
D
E
F"

...you'll get a string in the program which looks like this:
"A\nB\nC\nD\nE\nF"

That is divided at the position of every "\n" to give you the clean names for the teams. Then I simply took those names and ordered them alphabetically to show them into the table (The last time I am using this picture, I swear):
0okHt.jpg


This was nice, since I saw the first time something working that I needed to program. All the stuff before was just preparation and Drag and Drop menus. After I accomplished this, I realized that the current layout of that table was... stupid. I mean I wanted to have a clean table to not only show ranking and name, but also all other kinds of statistics (Wins/Losses, Points, all games played, goals) and I was simply trying to add them up at the table, which basically looks like this:

Germany 5 2/2/1
Poland 5 2/2/1
Czech Republic 5 2/2/1
Spain 5 2/2/1
England 5 2/2/1

This is messy and highly annoying. After fiddling around with different ways of making it all the same length, I gave up and changed it to a multi column table where every value would have a set beginning and end:
1hGfD.png


This has one major advantage:
- Everything is finally neat.

And two major disadvantages:
- Any team with a name longer than "Czech Republic" does not exist or the table will look highly un-neat
- I didnt find a way to "scroll" every column at once, so I deactivated scrolling for now and people shouldn't make a league with more than 25 teams or they can't view the complete table. If I'd activate scrolling and more teams would be used, you'd have the problem of only being able to scroll one column, and the others won't move, which leads to statistics which dont fit to the team which is displayed in front.

Since I already stated that I dont care much about.. problems which can easily be avoided, this is another issue which I need to resolve at one point, but eeeeeh. Later. If I dont happen to forget it again.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 4: Creating the algorithm to create all league matches

This part is a bit.. heavily programming focussed.

At this point, I already had the teams and the basic table structure. But the table was still void of any results or statistics. To get any results, I'd need a way to enter results for the matches that I could interpret for the league table, which is where I finally got to use the left textbox.

Before I was able to enter any results (or even randomize anything) I needed to create all matches for the league to have data I can check for which matches are being played to see which team will get how many points. The basic idea was that the normal list of teams looks like this -> "A, B, C, D, E, F". I wanted to change it accordingly for every matchday, so that you always have the teams playing in pairs. Meaning that the first matchday will be saved as "A, B, C, D, E, F" and the second as "A, C, D, F, B, E" and so on. The problem was however, how to find those match combinations. This was unexpectedly tricky. Another Gaf member helped me out to get started with a solution on how to approach this. He had a pretty clever solution to brute force checking which matches are still missing and then trying the matches that are still missing on a matchday until one setup made sense. But while trying to implement his idea, I finally found the correct algorithm to directly create the correct matchups:

Since I want to create matchups for each day, I need to check previously whether its an uneven number of teams, and if its uneven add a "FREE" to the team list, which will show up in the matches textbox to show which team isnt playing on that day, but not on the league table.

Also: TeamsWithMax[n] has previously been filled with n number of teams and TeamsWithoutMax[n-1] is the same list but missing the last element, since I'll have every match of last team in TeamsWithMax through the if statement. Therefore, I dont need it anymore for the else statement and leave it out.

Oh yeah and Matchcount is the count for which match it is on that day. Meaning, that on every matchday with 8 teams, there will be matches with a Matchcount of 1 to 4.
Code:
List TeamsWithMax[n];
List TeamsWithoutMax[n-1];
Max=TeamsWithMax.Count;
Daycount=Max-1;
Matchcount=1;

while Matchcount<=Max/2
{
     if Matchcount=1
     {
     Matches[Daycount].Add(TeamsWithMax[Daycount]);
     Matches[Daycount].Add(TeamsWithMax[Max]);
     Matchcount=Matchcount+1;
     }
     else
     {
     DummyPlus=Daycount+(Matchcount-1);
     DummyMinus=Daycount-(Matchcount-1);
  
     if DummyMinus<1
         {
         DummyMinus=Max-1+DummyMinus);
         }

     if DummyPlus>(Max-1)
         {
         DummyPlus=DummyPlus-(Max-1);
         }

     Matches[Daycount].Add(TeamsWithoutMax[DummyPlus]);
     Matches[Daycount].Add(TeamsWithoutMax[DummyMinus]);
     Matchcount=Matchcount+1;
     }
}

int counter=1;
foreach (List/string/whatever elem in Matches)
{
     while i<=Max/2
     {
     WriteLine(elem[counter] +":" + elem[counter+1]);
     counter=counter+2;
     }
}

DummyMinus and DummyPlus are getting an If exception because there are no List entries[-1], it just takes the value and counts from the current top value (Max-1) down (or the other way round for DummyPlus).

That makes it basically looking like this:

Code:
4 Teams

Daycount:Max |	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------
Daycount:Max |	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------
Daycount:Max |	Daycount+(Matchcount-1):Daycount-(Matchcount-1)

which then transforms into (remember that if a value is below 1, it will be counted from Max-1 down, and the other rule for a value above Max-1):


1:4 | 1+(2-1):1-(2-1)
-------------------------
2:4 | 2+(2-1):2-(2-1)
-------------------------
3:4 | 3+(2-1):3-(2-1)

=

1:4 | 2:3
----------
2:4 | 3:1
----------
3:4 | 1:2

And it works for every amount of teams because the base setup is really simple:

Code:
8 Teams
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Daycount:Max	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)	|	Daycount+(Matchcount-1):Daycount-(Matchcount-1)

Fuck yeah! God, I love programming. It felt awesome to finally have this part down.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 5: Make a basic input and simulation system for the games

That part was thankfully easier than the last one. I added another button, the "Rnd" button below the match textbox:

Xs6EX.jpg


and went from there. First thing I did was checking the results from the textbox below the word "result" for how many x:x pairings have been created, because that was the amount of results I'd need. Then I tried to get a random score between 0 and 5 for each "x" and checked which team had the higher score to determine the winner of a game. As soon as you press "Update Table", the program will evaluate the results, and update the table accordingly by updating the correct amount of goals, points etc.

This was a bit harder than what I am describing right now as it still was a bit tricky to get the program to understand which team was supposed to get which amount of points etc. I ended up using a list for each matchday that will keep track of which team is in which match and whethers its team 1 or team 2 in that match. That way I can always look those up, according to the matchday, and find which team played.

There were another 2 minor problems, though:

1.
Since I wanted the user to input own results I had to make a check to see whether a game already had an input and tell the program to ignore that game. That was rather easy as I only needed to add an exception to the check for "x:x" to not make new results for anything that wasnt "x:x"

2.
The second problem was that I forgot that the user might be changing his own results, for whatever reason. Up to now the program was simply adding any change you made on top of the current statistics for that team. If you changed a 3:0 to a 2:0, the first team would have 2 wins and 5:0 goals. Since I already added an exception for checking whether its a "x:x" result or not, I was able to easily find the place to add another check and subtract the old result before adding the new one, making changes easy and painless.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
6. Saving the game

This is probably the biggest fail in my program. Despite having clear advice to do something which is integrated in C# to save certain parts of the game, I ended up writing my own save/load routines for every data structure I needed. However, I need to say that adding new stuff to these routines isn't too hard when I know beforehand that I want to save/load them later. But the first time I tried integrating saving and loading for all the stuff that wasnt optimized for saving/loading (again: still a beginner here), I was nearly banging my head against the wall. Extracting all the user input data and randomized data from the program to save it was a horror since I spread all the important things everywhere without any order.
After I finally figured out which stuff I'd need and where in which variable it was stored at the point of saving, I began with writing that into a txt file, which then looked sort of like this:

Russia
Germany
France
England
Portugal
Argentina
Brazil
Ivory Coast
Netherlands
Italy
%Russia°Italy°Germany°Netherlands°France°Ivory Coast°England°Brazil°Portugal°Argentina^Italy°Germany°France°Russia°England°Netherlands°Portugal°Ivory Coast°Argentina°Brazil^France°Italy°England°Germany°Portugal°Russia°Argentina°Netherlands°Brazil°Ivory Coast^Italy°England°Portugal°France°Argentina°Germany°Brazil°Russia°Ivory Coast°Netherlands^Portugal°Italy°Argentina°England°Brazil°France°Ivory Coast°Germany°Netherlands°Russia^Italy°Argentina°Brazil°Portugal°Ivory Coast°England°Netherlands°France°Russia°Germany^Brazil°Italy°Ivory Coast°Argentina°Netherlands°Portugal°Russia°England°Germany°France^Italy°Ivory Coast°Netherlands°Brazil°Russia°Argentina°Germany°Portugal°France°England^Netherlands°Italy°Russia°Ivory Coast°Germany°Brazil°France°Argentina°England°Portugal^Italy°Russia°Netherlands°Germany°Ivory Coast°France°Brazil°England°Argentina°Portugal^Germany°Italy°Russia°France°Netherlands°England°Ivory Coast°Portugal°Brazil°Argentina^Italy°France°Germany°England°Russia°Portugal°Netherlands°Argentina°Ivory Coast°Brazil^England°Italy°France°Portugal°Germany°Argentina°Russia°Brazil°Netherlands°Ivory Coast^Italy°Portugal°England°Argentina°France°Brazil°Germany°Ivory Coast°Russia°Netherlands^Argentina°Italy°Portugal°Brazil°England°Ivory Coast°France°Netherlands°Germany°Russia^Italy°Brazil°Argentina°Ivory Coast°Portugal°Netherlands°England°Russia°France°Germany^Ivory Coast°Italy°Brazil°Netherlands°Argentina°Russia°Portugal°Germany°England°France^Italy°Netherlands°Ivory Coast°Russia°Brazil°Germany°Argentina°France°Portugal°England^%2 : 1°3 : 0°0 : 1°3 : 2°3 : 2^1 : 2°2 : 1°2 : 0°4 : 2°3 : 4^1 : 3°1 : 3°3 : 2°4 : 3°4 : 3^x : x°x : x°x : x°x : x°x : x^1 : 2°1 : 8°2 : 0°4 : 1°2 : 1^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^x : x°x : x°x : x°x : x°x : x^

I imagine its probably the way most people start off saving stuff into a TXT file. I divided the three big sections Team List, Matches for every day and Match results for every day with a "%" and then divided the smaller parts of each section with "^" and "°". I knew that I wouldnt use these signs for any team names so I thought its save to use these as separators. For loading you'd basically backwards engineer the save.txt and give the divided data to methods which will feed the program again with the data it needs to know.

I sort of hope to learn the better of way of saving later , but that will probably be reserved for any next project to come.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
7. Creating "content" for teams, part I - Players with stats

Up until now the teams didn't have much personality or difference at all except the team name. The basic premise of what I wanted to accomplish was done and now I wanted to see how far I push what I can do with this program. Since I cant do anything advanced with the faceless teams as they are now, I started by adding players to each team. Later I also need to add more stuff for each team, like fanbase, stadium name, size, Manager name etcetcetc.

Whats the first thing a player needs? A name!
I took the list with 1000 most common surnames and the 1000 most common male first names in the US, wrote a program to delete all the numbers they added to the names on the website, and made a hardcoded names database within the program. I thought about getting names from other regions too, and making the names differ for which starting region you'd chose. But thats something to consider later as well.

After having a name I wrote up a few basic values the players should have. This list probably isnt complete but its which skills I deemed useful up to now:

*[0] Rating in his position
*[1] Speed
*[2] Power
*[3] Jump Strength
*[4] Shot Strength
*[5] Passing Accuracy
*[6] Long Pass Accuracy
*[7] Shot Accuracy
*[8] Stamina
*[9] Risk of injury/Sturdiness
*[10] Goalkeeping
*[11] Defending
*[12] Left/Right Foot (0 is right, 1 is left, 2 is both)

I randomized stuff in thousand ways to ensure they'd still sorta make sense. First of all I randomized the amount of players each team has by giving them a random amount of Goalies between 2 and 3, a random amount of defenders between 5 and 7 , a random amount of midfielders between 5 and 7 and a random amount of attackers between 4 and 6. Depending on which position the players were created at they got differing random chances for their values, meaning that for example an attacker has a random value between 6 and 8 (out of 10) for Shot Accuracy, while most defenders have a random value between 4 and 7, with an extra 10% chance of having a higher or lower value.

This is one example result:

Code:
Goal: Roman Sawyer             (6)  7,  5,  5,  7,  1,  5,  3,  3,  6,  7,  0,  0
Goal: Burton Byrd              (6)  6,  4,  5,  5,  6,  3,  4,  6, 10,  5,  8,  0
Defend: Refugio Donaldson      (7)  2,  6,  4,  4,  6, 10,  4,  9,  6,  3,  8,  0
Defend: Shad Burch             (7)  6, 10,  5,  9,  8,  8,  5, 10,  4,  0,  7,  0
Defend: Brandon Woods          (6)  5,  3,  7,  2,  6,  8,  4,  2,  6,  0,  8,  0
Defend: Emmitt Keller          (5)  2,  6,  4,  4,  6,  7,  4,  4,  6,  3,  5,  1
Defend: Dorsey Carney          (6)  8,  6, 10,  4,  9,  8,  2,  5,  4,  3,  4,  0
Defend: Lonnie Trevino         (8)  8,  7,  4,  6, 10,  5,  8,  7, 10,  1,  9,  1
Defend: Geoffrey Bridges       (7)  4,  2,  7,  4,  9,  7, 10,  4,  9,  3,  8,  0
Midfield: Lacy Flowers         (6)  4,  5,  6,  7,  8,  7, 10,  5,  9,  2,  7,  1
Midfield: Cornell Lawrence     (6)  6, 10,  4,  8,  8,  8,  5,  5,  8,  0,  7,  0
Midfield: Daryl Burton         (6) 10,  4,  8,  6,  4,  6,  3,  9,  4,  1,  4,  2
Midfield: Normand Blackburn    (6)  5,  4,  7,  2,  7,  8,  4,  7, 10,  0,  8,  0
Midfield: Sung Barrera         (6)  4,  8,  7,  7,  6,  9,  7,  4,  7,  0,  4,  0
Midfield: Brice Ellis          (6)  4,  3,  6,  4,  6,  7,  7,  5,  9,  2,  7,  0
Attack: Hank Tyler             (6)  9,  7,  7,  6,  4,  3,  4,  7,  4,  1,  1,  0
Attack: Troy Finley            (7)  7,  6, 10,  5,  8,  5, 10,  4,  3,  3,  0,  0
Attack: Reuben Sanford         (7)  6,  7,  4,  6,  9,  3,  8,  6, 10,  0,  7,  0
Attack: Sammie Brooks          (7)  6,  7,  4,  9,  6,  3,  6,  9,  7,  0,  4,  1
Attack: Rueben Travis          (7)  4,  2,  8,  7,  7,  4,  9,  8,  7,  2,  2,  0
Attack: Dillon Silva           (7)  5,  6,  4,  6,  9,  6,  8,  6, 10,  0,  7,  0

As you can see, the goalkeepers have the highest goalkeeping, the mid fielders have the best long pass accuracies and the attackers generally tend to have the best shooting capabilities. I used a simple formula to calculate the rating (the first value) for each player in a certain position:

Goal:1+3+6+8+9+3*10
Def:1+2+3+5+6+8+9+3*11
Mid:1+2+3+4+2*5+2*6+7+2*8+9+10
Attack:1+2+3+2*4+5+2*7+8+9

The rating is still a bit off, though. There is no way that the goalkeepers should have the same rating for example. But its good enough for now I guess, I'll change that when I know exactly how much I am going to use which value in the actual match simulation.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
And thats where I currently stand. I'll update on what I am doing with the formations tomorrow, but maybe I'll get a few interested people to read and comment on this in between :p
 

superbank

The definition of front-butt.
Cool stuff. I don't know much about coding but I want to get into it and create games. It's interesting to see the process. Keep it up. :)
 
Wow I was just about to consider researching the same thing! Looks like you are way more advanced then I will be for while. I have a ton of ideas for a football simulation but have little creation or coding experience.

I would love to be the creative behind a football game because I know football and feel I have some good ideas that weren't even done by 2k sports.

Subscribed. And I will look over your stuff in detail tomorrow. Best of luck man.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
superbank said:
Cool stuff. I don't know much about coding but I want to get into it and create games. It's interesting to see the process. Keep it up. :)

Dash Kappei said:
Neat. Subscribed :)

Thanks for the interest :) There probably wont be much progress in the next 2 weeks because I need to write a termpaper until then, but I finally had the time yesterday to write that up. And I hope I can make at least a bit progress within that time.

diamondstar said:
Wow I was just about to consider researching the same thing! Looks like you are way more advanced then I will be for while. I have a ton of ideas for a football simulation but have little creation or coding experience.

I would love to be the creative behind a football game because I know football and feel I have some good ideas that weren't even done by 2k sports.

Subscribed. And I will look over your stuff in detail tomorrow. Best of luck man.

Yeah, I had this thing on my mind for a while as well. Stuff isnt too exciting up until now since 95% of my time went into making things work at all instead of making them interesting.

Feel free to brainstorm about anything regarding this though, I'd add stuff to the list with stuff to do in the far future. I haven't thought about that too much yet since the "near" future will keep me busy for a while.

I also wouldnt mind, sorta making this a community project or something. Of course everyone helping would be referenced ;)

Anyway, I'll post again in a few minutes to tell you what I am working on currently.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Sooo, I'll make a more intricate post about it when I am finished with that part, but right now I am still setting up data that I can use for simulating the matches.

Actually I was already starting that as you can see in the V0.2 screenshot on the right, but I noticed immediately that it doesnt make any sense without any team formations.

I already got a simple check down to see which formation might be fitting, which is determined by the strength of the best player ratings. Atm I only use simple 3 part formations, so no fancy 3-1-3-1-2 formations. Still thinking about how to handle this.

A quick simulation for 6 teams results in these formations:

4-3-3
4-5-1
3-5-2
3-5-2
4-4-2
4-3-3

This isnt overwhelming, but a nice variety to get going I'd say, so that not every team looks exactly the same. And since its depending on actual team/player strength its even useful.

Right now I am trying to get the program to sort the best players of each team into these formations. Basically a "auto-sort" function for the formation it got before. This is even more useful since I can use the auto sort function later to have the player change the formation and automatically suggest a team line up for the first 11 players.

I'll let you know when I accomplished that :)

After that I want to visualize this somehow. Having a formation screen is way more exciting than just letters and numbers in a row. Hopefully that won't be too painful.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Yay, okay. Every team now has 11 suitable players for the start formation. Now I need to figure out a way to get them sorted into the correct places within their position, meaning, left footed defender to the left side, defenders with more jump strength to the middle etc.

And a way to look at all this without the need of going into each variable. Guess I'll work on a team management screen next.

Edit: Kicked out a few crash bugs you'd get for entering a matchday that doesnt exist in the matchday selection, same for the matchreports.

Also reworked the match report choice to make it more intuitive, entering "1" will now give the match report of the first match on that matchday instead of "0".
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
I probably need symbols for the player stats. Would be awesome if anyone is bored enough to make small icons for these:

*[0] Rating in his position
*[1] Speed
*[2] Power
*[3] Jump Strength
*[4] Shot Strength
*[5] Passing Accuracy
*[6] Long Pass Accuracy
*[7] Shot Accuracy
*[8] Stamina
*[9] Sturdiness (The higher it is, the lower the risk of injury)
*[10] Goalkeeping
*[11] Defending
*[12] Left/Right Foot (0 is right, 1 is left, 2 is both)

I'll try it myself later, but it probably will look rather... erm.. bad.
 
Cool man I like what you are doing but I had the impression when you said football you meant American football. Haha. I will still pay attention because maybe it will help my journey as well.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
diamondstar said:
Cool man I like what you are doing but I had the impression when you said football you meant American football. Haha. I will still pay attention because maybe it will help my journey as well.

Ha lol, I was actually thinking about naming it soccer or something, but eh too late I guess. Well no harm done :) And good luck with your project as well.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
I was thinking about the Random team names right now. I probably will integrate a function to choose a random abbreviation (FC, KC, SC) and randomize it with the 270 biggest cities in the US, since I was already taking the 1000 most common names and surnames of the US. I was thinking of adding regional differences there later anyway (other names and cities for other regions) so I thought I'd keep that consistent for now. Hopefully that will turn out as good as the random player names.

Another thing that crossed my mind was the random fun name function. I havent told anyone yet what thats supposed to be later but basically supermoves as player skills and funnier match reports. I thought random names like "Flying Robots", "Killing Dolphins" etc would go nicely with that. Will take a bit longer to create a database for that though. Suggestions appreciated.
 

Bebpo

Banned
For someone who dabbled in game programming and wants to get back to it someday, this is fascinating. Keep up the good work!
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Bebpo said:
For someone who dabbled in game programming and wants to get back to it someday, this is fascinating. Keep up the good work!

I am actually a bit surprised that I found a few people reading that wall of text. I wasnt quite expecting it to get THIS long. Oh well. Glad some of you enjoy it :)
 

RooMHM

Member
This is mostly impressive but i'm not sure I understand the final goal of this project. Do you want to make a text based football simulation (a game)? or do you want to make an alternative league processing program such as what's in Football Manager for example?
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
RooMHM said:
This is mostly impressive but i'm not sure I understand the final goal of this project. Do you want to make a text based football simulation (a game)? or do you want to make an alternative league processing program such as what's in Football Manager for example?

The idea began with the alternative league processing program for me and a friend. And what it was supposed to do is already finished with Progress part 6 (except a few bugs). What I am doing now is adding stuff to see where I end up, but the ultimate goal is a game (as far as I can get). I'll try to keep the league simulation mode somewhat intact as an extra mode, though.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Finally managed to make a more polished Teamview window. While I was at it, I was looking at listviews, which were already suggested for the league table. And boooy am I glad I did.

N8sBx.jpg


Atm, you can sort by every value and even by value but position first. So that you can easily compare every attacker for example.

I want to add another "presorting" function so that I can sort by the current formation first and I hope I can find a way to colorcode the different positions.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
speedpop said:

Thanks. If I would take a longer break from it, I would probably feel the same. Hopefully the notes I made inside the program are somewhat self explainable.

Don't know how far I can get with it yet, though. I am just trying to add basic features to see what I can do and what not. Hopefully it will turn out somewhat interesting in the end.
 

speedpop

Has problems recognising girls
On the subject of colour coding and if you nail it down, say you have a group of attackers on your team and you want to see which player in your squad has the best shooting ability and such, it might be helpful for the highest skill number to be highlighted somehow.

That way you will be able to easily identify who is best at what in your overall squad, or something. It is probably not that important to deal with but I always thought something like that was a great addition to a stat-based game.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
speedpop said:
On the subject of colour coding and if you nail it down, say you have a group of attackers on your team and you want to see which player in your squad has the best shooting ability and such, it might be helpful for the highest skill number to be highlighted somehow.

That way you will be able to easily identify who is best at what in your overall squad, or something. It is probably not that important to deal with but I always thought something like that was a great addition to a stat-based game.

Yeah, this is why I worked on the "Sort by position before any value"-function. If you have that on it looks like this:

7dhWE.jpg


(oh yeah, color coding works, yay)
This is sorted by position first and then SST (Shot strength), so that I can easily see which player in a certain position has the best shot strength.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 8: Creating a better Teamviewer

Sooo, up to now I was only using this:

rftZ9.jpg


..to check on some values and see whether the player creation was working correctly. It was quick and easy but has a whole lot of problems on its own. First of all: Formatting. If you make a stat based game, you need to ensure the data stays somewhat readable. I already had the same problem for the league table and, due to the lack of knowing better, I decided to create a new textbox for each column which was updated separately. This also meant that those columns, used for the league table cant be moved/scrolled together, and as soon as you would need to scroll down because the list is too long, you'd inevitably screw up the correct order of the values.

Since I didnt wanted to make the same mistake twice, I looked into something wonderful called "Listview". This is a function that basically creates the overall setup and I only need to fill in the values used for each column. I chose the list of players for each team that was already sorted by position (since this is probably something you'd need the most) as the starting point and after a bit of fiddling around managed to get the Listview to understand what I want:

aMObN.jpg


This is already very nice but still not serviceable enough. The main problem is that you dont have enough options with only that view to get the information you want. One thing I am very glad was easy to integrate was the colorcoding which always shows which position a player belongs to.

sJBpy.jpg


Again, hooray for listview. That wouldn't have been possible with the textbox format I used prior. But why would I need colorcoding that much if every player in the same position was right next to each other anyway? Easy answer: Because I not only want to sort by position, but by every possible value the players have. And if you do, you get this:

uBUm6.jpg


If you change around the sorting all the time, there is no way you'd be able to keep track of which value is important where. This screenshot was sorted by stamina, and relatively randomly sorted. If you'd sort that by shot strength you'd see more attackers in the top positions etc. Another problem I shouldnt forget taking care of later is that there is no easy indication after which value the whole list is sorted atm. Need to add that to the to-do list.

Problem is, you still can't easily compare values from players on the same position. For that I included the "Sort by position before any value" checkbox. That way you could easily compare the values of only your defenders for jump strength (useful if you know that your next opponent has a main attacker with very good jump strength skills, so you might want to get even on that skill).

So instead of being only sorted by position, as its done initially, you can sort by position and then every other value (in this case SST - shot strength):

7dhWE.jpg


Another thing which is mightily important is to view your team formation and make changes if needed. I havent programmed that yet, but included a temporary solution here to at least be able to check the start formation properly:

7BaXz.jpg


If you press "Show current formation", you'd get the currently saved formation (in this case a 3-5-2 setup) by looking at the players until the second set of goalkeepers. I needed this to explain the next part, which is why I included here. I'll also probably add 2 buttons soon to change the team, right now its only the first one every time you start it up.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 9: Creating "content" for teams, part II - Automatic Formations

Already mentioned this in bits and pieces before, but now on to the conclusive explanations.

So, the problem was that I had my players and wanted to go on to make some Match reports. Stuff like "Player A tackled Player B, stole the ball and shot a goal! Goalie A had no chance". This is why I already have the matchreport Text box inside the program. However, I soon realized that there isn't enough data to pull from, after all, which players are actually playing on the field?

I already explained how I calculated the ratings, and I used these to make a simple "suggestion"-routine for the AI Teams. Basically the best rated Goalkeeper will be Goalkeeper 1 and the best rated defenders will be the ones initially playing in the starting formation. The bigger problem was determining how many defenders will actually play so that I know for how many defenders I am looking for in the starting position. I used a very basic algorithm to determine the best players by rating and then chose those for the team formation. It works basically like this (The numbers are the amount of players in each position [goal,defence,midfield,attack]):

Determine best player -> He is Defender -> Add to Defence (1,1,0,0)
Determine next best player -> He is attacker -> Add to Attack (1,1,0,1)

And so on. Since the stats are sort of random, it might happen that the best 7 players in your team are attackers, but of course you wouldnt want all of them to play. I simply used an exception to stop looking for attackers if there are already 3 in the starting formation. Example: currently 1 goalie, 1 defender, 0 midfield and 3 attackers

Determine next best player -> He is attacker -> More than 3 attackers are not allowed, skip
Determine next best player -> He is midfielder -> Add to midfield (1,1,1,3)

This continues until the starting formation has 11 players and results in a "3-4-3" formation or whatever formation is possible right now in the program. This still has a serious problem with the rating system though. At the moment that is quite... lets call it unbalanced. A Goalie with Goalkeeping 10 might have a worse rating than a goalie with goalkeeping 7 because of his other values. This is a bit... unintuitive. But as I already mentioned before, to balance that now doesnt make any sense at all as I dont know yet which skills are mostly used in the match report/simulation system later on, which is why I stick with it for the moment.

Anyway, since the ratings are sorta random, the teams end up with slightly different formations which makes the whole league setup a bit more interesting. A few examples:

pFHvw.jpg


5 defenders, 5 midfielders or only 1 attacker should be possible as well.

Another restriction to the system currently is that only 3 part formations are possible. No fancy 2-1-3-1-2-1 formations yet. No idea how to tackle that currently though.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Made a check that will ensure that left footed players will play on the left side for AI players. Now onto visualizing that formation.

Edit: Also included Trikot numbers for the player values. Best goalie is 1, second best is 12 etc.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Formations are now saving correctly as well. Here are the formations for a complete 20 teams league setup:

Spain^1°3°4°3
USA^1°3°4°3
Brazil^1°4°3°3
Argen^1°3°5°2
Chin^1°5°2°3
Engla^1°3°4°3
Urug^1°5°3°2
Port^1°4°3°3
South^1°3°4°3
Para^1°4°4°2
Germ^1°3°5°2
Czec^1°3°4°3
Cana^1°4°3°3
Franc^1°4°4°2
Chile^1°4°5°1
Switz^1°4°3°3
Ivory^1°3°5°2
Japan^1°3°5°2
Nethe^1°3°5°2
Russia^1°5°2°3

Edit: I am very curious to see how these will affect the matchreports later.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Highlighting currently selected Column = Done.

oftZc.jpg


That was trickier than expected. There is no function for highlighting a complete column, so I had to write quite a bit of code for that. Also you can see the Player Trikot numbers in the first column of that screenshot.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Last update for today:

Added a simple random check for the 267 biggest cities in the US as team names.
gmjUm.jpg


(I plan to make this for every continent later, if I am bored)
 

Omikron

Member
speedpop said:
On the subject of colour coding and if you nail it down, say you have a group of attackers on your team and you want to see which player in your squad has the best shooting ability and such, it might be helpful for the highest skill number to be highlighted somehow.

That way you will be able to easily identify who is best at what in your overall squad, or something. It is probably not that important to deal with but I always thought something like that was a great addition to a stat-based game.

It is actually super important to highlight important information in a stats based game (think FM) either by bolding the better stats, or colouring them as they improve etc. Makes such a difference to be able to quickly scan a list of stats, rather than have to give yourself a headache trying to read in super detail. :)


Also, subscribed.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Omi said:
It is actually super important to highlight important information in a stats based game (think FM) either by bolding the better stats, or colouring them as they improve etc. Makes such a difference to be able to quickly scan a list of stats, rather than have to give yourself a headache trying to read in super detail. :)


Also, subscribed.

Hm, I was thinking about using a color gradient later. Meaning a darker shade of the colour in which position someone is playing in. defenders are light blue, and making the blue darker for higher values. It wouldn't hurt to integrate it with another "choice" checkbox, so people could use what they want.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Mini Update:

Created the window where you should be able to view the formation later and hopefully also change it. Still no clue how to do that.

xih4L.jpg
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
bFJ1v.png


Now only to include the player information (at least surname and Trikot Number) in those white boxes and make it possible to exchange players in the formation.

The cherry on top would be that you could change the positions of players slightly to create more offensive wingers etc, but I dont know how to save that yet as I'd probably need to save coordinates or something.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
As you guys can see I was working on it a bit in the past few days, but I'll need to take a break from this project for about a week due to a term paper I REALLY need to get to finish. I'll be back with more progress in a few days :)
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Finally finished my term paper!

So here is some progress I just made:
f1iJw.jpg


As you can see I implemented the correct trikot numbers and the name. However thats still a bit messy. I am trying to find out whether I can get the Textboxes always to align perfectly symmetrical under their box.

After that I still need to find a way of substituting players and I should be ready to finally dive into the match simulation.

Fake Edit:
Also found a few more bugs that need attention. For some reason I had a weird bug where it was saving the results for a team into another team, but with no noticeable reason. Probably a save/load problem. And I just randomized a league where a team was not being shown in the table. Weird.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
VvBmy.jpg


Got it to align properly, so you can actually look at it without getting headaches. Now on to the substitution system. That might take a while.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
8tOLn.jpg


Fuck Yeah! That was hard. For me at least. I had to learn several new things about mouse input and List options, but it somehow worked out in the end. In that picture I swapped 1 and 11, or 7 and 10. :)

Great that this is working. However, atm you can only drag and drop change them by drag and dropping the trikot number, not the name. Not sure whether there is a way around that currently. And I need to use a different color code here. Probably always color code the positions of the first team and leave the substitutions blank. Otherwise you wont know who is actually playing after a few substitutions.

And I still need to change the rating based on the position the player has been swapped into.

But hey, it works at all!
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
And I should be finished with this window for now:
tnfBb.jpg


You now get the formation listed on the top, and if you choose another formation from the drop down menu, it would change the currently chosen formation setup. If you press "Suggested Players", the program would suggest the players for you, based on the formation you chose. You could still substitute players of course.

Only thing I'd really want in there is a pop up window for player stats. But thats something for later. Now I'll probably work on the Match report system (finally) and killing some bugs down the line.

First thing there: Save and load match reports.

Edit: Oh and yeah, I also changed the rating for this window (If you put an attacker in the goal position he should get a lower rating) and only coloured the players in the starting formation.
 

Kalnos

Banned
Just wanted to pop in and say great job, you have clearly learned a lot over the past 3 months. This looks way more fun than the stuff I have to do at work.
KuGsj.gif
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Kalnos said:
Just wanted to pop in and say great job, you have clearly learned a lot over the past 3 months. This looks way more fun than the stuff I have to do at work.
KuGsj.gif

Thanks! :) The most interesting stuff is still yet to come, though. The Match report system will make the whole thing interesting. At the moment its just numbers without any weight.

Hopefully, I can get this part done somewhat serviceable as well, but I am already glad that I found ways to do everything I wanted so far. AND I think I really "got" the idea of OOP. :) This is waaaaaaaaay easier than without. Glad I took my time to understand it. Thanks to all of you helping out in the other thread. Thanks again!
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Part 10: Creating the TeamFormation Window (Substitutions)

This part was probably one of the trickiest so far for the reasons I'll state below. Really glad it worked out.

I already had a TeamViewer window where you can check the individual stats of every player, so why did I need another one? While working on it, It noticed that these windows are indeed quite different and they only differentiate themselves in regard to the how the player gets the information presented visually. Its kinda fascinating that sometimes there is a use for an extra menu point, just to give the player the same information in a different way.

So the basis would be again the player list, this time I don't need it sortable by stats, but they'd need to be sorted by Team Formation. I got the program to make suggest Team Formations for every game, and here is where the player should be able to change the Formation type (4-3-3, 5-3-2...) and make substitutions in the team. Again, I started off with the basics: Make a window and include the basic Input Boxes:

xih4L.jpg


For the left side, I made a football field representation so that I can hopefully give a visual representation of the formation chosen, and the right side is the listview of my team members which I shortened for this use, as I dont need to directly see every stat here. However, it is important to check some values now and then, which is why I'd like to integrate a pop up window for every player that will give you the stats if you hover over him for a second, which is another thing I am not quite sure how to do yet.

Everything so far was the easy part, now it got trickier. The first thing I wanted to do, since it seems to be relatively easy and won't affect the stuff I want to do later, is the representation of the formation on the football field. I thought of making small trikot icons and including a number and the name in them. For some reason I didn't find out how to include these:

DmpLTs.jpg


...without the outer frame, because it just looked ugly and stupid with it. It seems that, or at least I didnt find how to do it, I can't integrate partly transparent pictures. Would be nice to have a bit of flavor for these visual representations, but thats something to consider later (Another idea was to randomly give team colours to the teams, which would be represented in these trikots, but thats even more far off atm)
For the reasons mentioned above, I chose to integrate a simple Label for the number and a label for the name:

VvBmy.jpg


The information about the team formation set up is saved in every team. So I just needed to check which team formation the team is using and activate the proper labels. I created labels in every possible player position:
wORQ2.jpg

.. and activated/deactivated player positions accordingly. For a 4-3-3 formation I'd deactivate the middle defender and the two outer midfield positions and then sort the rest of the team in the remaining position slots. Voilá! I still had some minor issues with the labels for the names, as they weren't centered below the numbers. I simply put the labels below the trikot numbers and depending on the length of the name, these name labels would either be too short or too long. What I did was checking the width of the label with the name and automatically sort it to a certain position below the trikot number, and adjust the position according to the measured length. This has 2 advantages:

1. If I ever get to giving the player the possibility to adjust player positions (A more offensive Winger) by drag and dropping the player positions on the football field, the name would always be shown in the correct spot, even though they are 2 separate labels.

2. I can change the font how I like, because its dependend on the width of the box and will calculate itself accordingly.

The most problematic part about the whole TeamFormation business was yet to come. Making substitutions... After all, to make it playable, I need to give the player a way to exchange who is playing for his team at the moment, otherwise there wouldnt be much of a game. And this was hard, because I had no idea how to give a "substitution" prompt to the list on the right. My initial Idea, which was also the idea I managed to include, was to give the player the ability to change his formations by drag and dropping players in the list. However, this isn't a function thats handily integrated into the List, so I needed to look around the net to find out how I could implement this.
By doing so, I learned how to get the information which List item is currently selected, and if it is selected, the mouse still pressed down and if moving, it would create a small window next to the mouse to show that you are currently drag/dropping something. At this point I knew how to get one part of the substitution (the one you are selecting first), but I had no idea how to give the program a new input for a second player, as my mouse is currently pressed, so it cannot select another item in the list (Selecting an item in the list is done by clicking on it). The solution to this problem was to include a check at which position of the list the mouse is currently at, and if it was in drag/drop mode, to give the information of the mouse position to the list, which would give me the information about which item of the list was at that position when I unpressed the mouse.

You have no idea how awesome it felt to do that. That seemed impossible when I started this window. Anyway, so if you change your positions around, you'd sort of see that:

8tOLn.jpg


In this example I changed 1 and 11, and 7 and 10 from the upper to the positions of the lower picture. Funny thing is that I actually thought, I'd be done with the TeamFormation window after this part, but as it always is with programming, you find more stuff to do.

(At this point I also changed the positions, so as not to be in a straight row, because some of the names were overlapping)

The player now has the ability to substitute players, but he still does not have the ability to actually change the formation of the team, which is as important for tactics as the players themselves. For that I included a drop down box which would be represent which formation currently has been chosen, and by chosing another option, would change the formation accordingly. I also included another button to have the AI making a starting formation suggestion for the currently selected team formation.

Another thing bugging me was the representation of the player list. Currently, every player is colorcoded by the position he is playing in. If you substitute the players a few times, the whole list will be a very disordered colored mess, where you won't be able to see at one glance which players are actually in your starting formation anymore. Due to that, I changed the way it is colorcoding the list. Instead of giving every player a color according to his normal position, I only color the first 11 players according to the currently chosen formation. 4-3-3 means first player yellow (goalie), next 4 blue (defense), next 3 green (midfield) and next 4 red(offense). The rest of the players stay white.

Together it looks like this:
tnfBb.jpg


Almost done! One last annoying thing was the fact that the RATING column always show the normal rating of the player (which is fine in the Teamview with every stat), but here it doesnt make sense to show that the player has a rating of 8 if I changed and 8 rated attacker to the goalie position. Due to this, I changed the rating column to a "relative rating" column where it would calculate the rating according to the position you swapped a player to, without touching his normal position rating. Which reminds me that I need to think about a method to change the position of a player ingame if you think he is more suited to play defender, than midfield or something.

PL5mS.jpg


Above: Goalie in the attacking position and Attacker in the goal position, both having a rating of 4 because their stats dont fit for the position.

Something else to consider later: Sliders for changing the team tactics (be more aggressive, use the wings, dont play high balls etcetc)
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
Hm, I might be doing the tactical stuff before anything else. Already added a TAC(tactical understanding) stat to the players, that will take care of how exact they are with your orders.

I thought about having tactics decisions like

aggressive - lenient
attack through the center - over the wings
pass low - high passes
etc.

And for example if you have High passes on the highest setting a player with a TAC value of 10 would use high passes 90% of the time (the other 10% are randomized). The lower the TAC value, the higher the chance that his decision will be randomized instead of what you told him.

One thing I am still considering though, is whether to make it only for the team, or individual tactical player settings.
 

Toma

Let me show you through these halls, my friend, where treasures of indie gaming await...
mclaren777 said:
I wasn't expecting this thread to be about soccer.

Football != American Football, but yeah, maybe I should bug a mod about it.
 
Top Bottom