Vroom, vroom: the match engine!

The Match Engine is the software which generates all the events reported within any given Hattrick match, and in so doing generates the final match results. Over the years it has been the most criticized aspect of the game (not always constructively) but this crucial component of the game mechanics is the one that many users would much like to see improved and updated (especially after experiencing an unlikely loss).

Notwithstanding these voices of discontent, and although many of you reading this may well have complained about results generated by our Match Engine, do you actually know HOW it works?

In this article we've done our best to explain those inner machinations!

With any luck, by reading this article and learning a bit more about it, you'll be able to understand the game a bit better, improving your match orders skills. Most importantly of all, the next time you lose a match, despite having better ratings everywhere, you'll be able to post a technically more informed complaint entitled "Why did I loose?" :P

We hope you enjoy it!

Introduction

When we refer to the 'match engine' we are talking about that bit within Hattrick code that generates all events that can & do happen within every Hattrick match, and in so doing will determine the final result.

All of the events are in some way influenced by an element of random, because they're selected utilising a virtual (random) draw. However, this doesn't mean that the result of a match is entirely dependent upon the random element, because it also depends upon match ratings, upon players skills/specialities, tactics, and every random draw will be weighted for/against either team depending upon your choice of players, formation and managerial tactics.

For example, if we discover that team RED has 70% chances to get a match event against team BLUE, this can be likened to a situation where we put 70 red balls and 30 blue balls in a pot, and then we "randomly" get a ball. Therefore, the higher your relative rating versus that of your opponent, the more of these virtual balls will have in your own match event's random selection pot.

It's important to remember that what we are discussing here is purely about how the match engine works with respect to our current database of statistically observed conclusions & understanding derived from this data. There is plenty of information about the Match Engine that has been well explained in the HT manual, but there are also a lot of elements that we have discovered because of research and statistical analysis (which has been made public to increase our knowledge). This means that we can't be 100% accurate as to how the match engine works in every single detail, as we try to unravel it for you, but data error (especially on formulas) should be regarded as relatively inconsequential in the grand scheme of things.

Match engine structure

Within each match, The Match engine produces 15 "cycles". These are not evenly spaced through the 90 minutes, and so the timing of each match engine cycle is itself irregular, so there may well be quite a long period in any given match without a single cycle (or corresponding match event) and it is also possible that quite a few cycles may be generated within a very short space of time. It is much like waiting for a bus, where you might get none for half an hour and then 3 come all at once. This then explains the situation in a match where there are 3 reported goals in just one minute, so don't be too surprised when it happens to you!

Each cycle is based on 6 phases in this order:

a) Special Event;
b) Chance;
c) Potential Counter Attack, if the Chance was played but wasn't scored;
d) Yellow/Red Card;
e) Injury;
f) Team Confusion.

The first 3 phases are the only ones who can generate a goal.

Special Event

Special Events are well explained in the HT Manual (chapter 13). We'll therefore describe them without going too much in detail for each SE as you can get this from the manual.

Special Events are divided into weather events (either as a result of sun or caused by rain) and special goal events.

Weather events will affect the selected players' star ratings, and that in turn will impact upon team ratings influenced by the change to these players' performances.

Goal events are chances (which can either be scored or missed, but if missed these won't generate CA chances), generated by single players or by two players combining their skills/specialities. The chance for generating a SE-goal depends on ball possession in a linear relationship (for example, with 75% possession, you'll have 75% chances to have SE-goal whilst your opponent will have 25%, provided both teams will have the same kind of specialists capable of utilizing that SE-goal opportunity).

Goal Chance Distribution

Often simply called 'chances', these are the most important match events, as they generate most goals.

In almost all cases (with the exception of long shots and direct free kicks) these chances are not influenced by any single player's attributes, but purely as a result of the Match Engine's comparison between the two team ratings.

Chances are divided between exclusive chances and open chances.

Exclusive chances are numerically fixed. There are 5 for each team and they can either be awarded and played out by the team who receives that chance, or they can be deleted and not even be reported within the match report.

Open chances on the other hand, of which there are 5 in total, are always played out by the team who receives them (but not always reported if there is no resulting goal).

For this reason in each match we have a minimum of 5 chances and a maximum of 15 chances (never forget that sometimes chances can go unreported in match report).

In order for any team to be awarded a chance, midfield ratings are compared as follows:

prob(chance won by A) = Midfield_A^3 / (Midfield_A^3 + Midfield_B^3)

with midfield ratings expressed in Hatstats(*).

If you have a solid low midfield (26 in Hatstats) and your opponent passable very low (21), you'll win the chance with 65% probablities, against 35% for your opponent.

After a team is awarded an open chance, it gets played. This is how the chance is played out:

First of all, the match engine will determine where the chance will arise:

- flank chance (50% probability; 25% right, 25% left)
- middle chance (35%)
- indirect free kick (5%)
- direct free kick or penalty (10%)

The non-free kick chance could be then be converted into a long shot if you have selected the long shot tactic (and sometimes a long shot conversion can take place anyway, even if you don't opt for this tactic), or it could be moved from flank to middle (or from middle to flank) if you are using AIM/AOW tactics. Note that the team tactic skill is taken into account when determining if this conversion succeeds.

The chance is then assessed. The match engine will calculate whether it will be a goal or a miss.

To calculate this bit, it compares ratings (again, in Hatstats) of your attack and opposite defense, within the area where the chance will happen. The match-ups compared are:

Central attack against central defense
Right attack against left defense
Left Attack against right defense
Indirect free kick attack against indirect free kicks defense.

The formula used, according to recent research, seems to be:

prob(goal scored) = 0,74*attack^3 / (0,74*attack^3+defense^3)

Therefore, if the corresponding attack and defense ratings are equal, on average you'll have a 42.5% probability for converting the chance into a goal.

The comparison with respect to direct free kicks and long shots, isn't between team ratings but instead between two single players: the player who gets to shoot, and his opposing goalkeeper.

We don't have a clear idea as to the exact mathematical formula, but we know that keeper uses his goalkeeping and set pieces skill combined, and the set pieces taker uses his set pieces skill for a direct free kick (or a penalty) and his set pieces and scoring skills combined for a long shot.

Counter Attack

Whenever you miss a normal chance, a counter attack chance can be generated and allocated to the defending team. A Counter attack is more likely to be generated if the team has been instructed and has sufficient tactic rating skill to use the counter attack tactic, but from time to time it can happen irrespective (the so called spontaneous counter attacks).

A generated counter attack is resolved like any normal chance (but it can't become a penalty), so the match engine will first calculate the area it occurs, and a goal or miss, as described before.

Tactics

Tactics chosen by the 2 teams can influence events in the first 3 phases.
How they work is described in detail in HT manual (ch. 14).

- Pressing: you'll have a possibility to skip a chance phase in a cycle. There's no guarantee it will just be an opponent's chance, your chances can be skipped too.

- Attack in the middle or attack on flanks: you'll have chances to convert a chance from middle to flanks, or from flanks to middle (useful if you think to have more chances to score in a specific position);

- Long shots: you'll be able to convert chances into long shot chances;

- Play Creatively: you'll raise both teams chances to have Special Events (both weather and goal events).

- Counter Attack: it gives you the chance to create chances from missed opponent's chances, provided that your midfield (before a 7% reduction is applied using this tactic) is lower than the opponent.

Never forget that each tactic carries a downside. For this reason you have to be careful and sure that using the tactic won't make you weaker.

Cards, injuries, confusion

After the first 3 phases the engine plays out the chances for players (not the GK) to be punished with a yellow or red card (depending on his personal attributes); or, to have an injury (spontaneously or dependent upon opposing player fouls); or, to have a confusion event if you play with a formation with a low rating (excellent very low, or lower), or similarly, as a relatively inexperienced team in the final minutes of a cup/playoff match (or a U20/NT official match).

Overconfidence and pullback

There are two more events that are not cyclical, but can significantly alter the match ratings. These are overconfidence and pullback.

Overconfidence (described in detail as "Underestimation" in the last paragraph of Ch. 16 in the Manual), can happen when you play a league opponent that is in a (much) worse position on the table than you are. If this occurs the midfield of the stronger team suffers a penalty, that can be partially or totally cancelled at half-time (if the scoreline is negative).

Pullback can happen after scoring a goal that puts a team two or more ahead. The probability of this happening is 20% when leading by 2, 40% when leading by 3 and so on until 100% with a 6 goal lead. Pullback is irreversible and lowers attack ratings by 20% while giving a 15% bonus to defense ratings.

Tiredness and ratings changes

It's important to note that your ratings, which determine your chances to get an open chance or to convert one into a goal, aren't fixed, but change during the match. In fact, even without injuries or players being sent off, weather events, substitutions, overconfidence or pull back, stamina related changes happen continuously as players tire.

When you want to check a match, don't watch just final average ratings that you see on the match report, but check ratings tab, and how ratings changed during the match.

Conclusions

This is the most accurate description of what happens whenever a Hattrick game is played, based on the most up to date knowledge and the hypotheses that are considered most reliable. The various predictors (Fantamondi, HTEV, the Preniubbo) which forecast most likely result or the probabilities of winning are based on the same information.

It's important to consider the following:
If you have an 80% chance to win a game, 10% to draw and 10% to lose, it does mean you're a strong favourite and that you'll most likely win, but one in ten games, the favourite will lose a match like this! It's no scandal when it happens as it would actually be more surprising to play 10 matches like that in a row and to win 10 every time!

(*) To convert a rating into Hatstats, take note that disastrous very low equals 1 and then add 1 point for each sublevel (or 4 points for each level, it's quicker). So disastrous low equals 2, disastrous high 3 etc. For the total Hatstats rating of the team, the midfield rating is multiplied by 3. This is not the case for the numbers in this article.




Editor's note: liked the article? Don't forget to like it at the end of the page! Discuss it on the forum: (16675477.1)

2014-10-01 20:44:36, 28271 views

Link directly to this article (HT-ML, for the forum): [ArticleID=18016]

 
Server 070