3

After a lot of digging i found this question Improving soccer simulation algorithm and converted it over to C#, and have added in extras such as fitness, morale, various statistics for players which affect the match in various ways. what i am struggling with is working in the idea of formation.

At the minute, a 1-1-1 formation would be the best possible squad as you put your highest rated player in each of those positions and their averages do not reduce due to the other players having lower statistics, i would like to make it so a 5-4-1 has a better defence than a 4-4-2 which would again be better than a 3-4-3 with all defensive players being equal.

How would i go about making the averages of the players marked as defenders are better, when there are more players of equal statistics than the other side?

Community
  • 1
  • 1
bizzehdee
  • 20,289
  • 11
  • 46
  • 76
  • As a football fan, I don't necessarily always think having a 5 man defense is better than a 4 man one but thats besides the point, AFAIK, this is why games have individual stats/ratings for individual skills, and the players rating is determined from their individual stats – Sayse Jul 01 '13 at 07:26
  • The players do all have their own individual stats, but as it stands, 1 player with a defensive score of 10, is a better defence overall than 4 players with a score of 8 each, this is why i specified, with all players being equal – bizzehdee Jul 01 '13 at 07:28
  • I think you do need to look into getting the average of the players in a defensive position (this may be all 10 players depending on your game, and where the play is currently happening (i.e freekick or a 3-2-3-2 formation)) – Sayse Jul 01 '13 at 07:31
  • If a defence comprising 1 defender with a rating of 10 is 'better' than one with 4 defenders each with a rating of 8 there's something wrong with your approach. Surely you should be adding ratings, in some fashion, rather than averaging them ? – High Performance Mark Jul 01 '13 at 08:37
  • this is what im asking, i am asking for recommendations to fix this problem – bizzehdee Jul 01 '13 at 09:07
  • I'm sorry, I don't understand your last comment. Do you mean you want someone to tell you how to add up 4 integers in C# ? 'fraid I can't help with that, I'm not a C# programmer, just an armchair footballer drawn in by the title of your question. – High Performance Mark Jul 01 '13 at 09:20
  • no, i am asking for suggestions on how best to address the problem that currently, a 1 man defence with a rating of 10, is better than a 4 man defence where each of the 4 men is rated at 8. obviously, in real life football, a brilliant guy on his own isnt as good as 4 "ok" guys together – bizzehdee Jul 01 '13 at 09:47
  • @bizzehdee - Mark got it right, if you just add them together then you should always have the right balance – Sayse Jul 01 '13 at 11:10

1 Answers1

1

The simplest solution is to SUM the statistics instead of averaging them. I'd think that two players with "5" are almost as good as one player with "10", or even better.

Beside of this, you could incorporate some scaling factors. For example, players in a group reinforce each other, so as a team they effectively play better than alone:

var playerCount = playersInLine.Count();
var teamFactor = Math.Pow(1.5, (playerCount-6)) - (1.5)^(-5));
var playerRates = playersInLine.Select(p => p.Rate + p.Rate * teamFactor);

var lineRate = playerRates.Sum();

The formula increases rate of players according to this formula: link. I assumed that there are 6 players maximum in one line, but I don't know much about football so you'll probably want to change that ;)

You could tweak with it so it for example won't change ratings much for weak players, but only for players stronger than 5 etc.

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
  • similar conclusion to what i ended up coming to anyway, thanks for the effort though, some good ideas :) – bizzehdee Aug 17 '13 at 14:02