Right now, each team has 3 stats: defence rating, midfield rating, and attack rating.SiENcE wrote:I would be interested how do you simulate the matches? What approach to you choose to simulate this complicated game.
thx.
I then get the difference between the home teams attack rating and the away teams defence, the same for the away teams attack minus the home teams defence, and then the difference between the midfield of both teams.
I then assign a random fluctuation to all 3 values, just to make things a little bit more interesting.
Each value is then weighted according to a weight value (for attack it is currently 0.05, for midfield it is 0.04) which gets things normalised and converted into percentage chances of scoring a goal at any minute. There is also a slight attack boost added too, purely because otherwise games can tend to be very low scoring.
Once that is done, you are ultimately left with two percentages (usually around 1% - 3%), which are the chances of scoring at any minute. The game then steps through every minute and scores a goal if the RNG produced the required values.
There is also a slight scoring boost to the home team, to compensate for the fact that the home team will generally score more goals than the away team.
Ultimately all this combines to produce a pretty nice simulation from just 3 statistics. It produces some interesting upsets, some high scoring games, some dull games, and some standard results you would expect.
The actual match engine used for player games however will run slightly differently, using basically the same system, but will also simulate possession, shots, corners, etc. I already have an outline of doing this in my notebook, but have not implemented it just yet.
EDIT: Here are the functions used in the engine.lua class used to simulate games.