The more you know...
In this week's blog post, I thought we'd take a look into Virtualmanager's engine room and examine how we use randomness in the match simulator.
A certain amount of randomness is necessary in a game like this, in order to make sure that the results don't become too predictable. Randomness adds flavour. But, as anyone who has ever sat for hours in a dungeon in a game like WoW or Everquest waiting for that rare drop will tell you, a random number generator can be cruel and unmerciful.
So how is randomness used in Virtualmanager?
A simple example is what happens when one player has caught up with an opponent who has the ball, and now wants to attempt tackling him. At this point, we need to figure out if he'll be successful or not.
The way we decide who wins this "skirmish" can be likened to a roulette wheel.
Let's say the the guy dribbling the ball has 50 Dribbling and the guy trying to tackle has 20 Tackling.
In this situation we build a sort of roulette wheel with 50 slots labelled "Dribbling" and 20 slots labelled "Tackling". We then spin the wheel and toss in the ball, and where it lands determines who wins.
If the ball lands in one of the Dribbling slots, the guy who's dribbling wins, and if it lands in one of the Tackling slots, the guy trying to tackle wins.
So, there's an element of randomness, but clearly, there is a greater chance that the guy with 50 dribbling wins, because he has more slots on the roulette wheel.
It also means that if we were looking at 99 Dribbling vs. 1 Tackling, for example, the guy trying to tackle does in fact have a chance to succeed - just a very very slim one. And if those two guys were to meet 1 million times, you'd expect that the guy with 1 Tackling would still succeed around 10.000 times.
The last point also relates to this blog post I wrote back in August, about how even very improbable outcomes WILL and MUST occur, given that we play hundreds of thousands of matches each week.
There are more factors in the actual match simulation.
Now, the example above is a simplification of what actually happens. In the actual match simulation, there are more factors than just the two guys' raw dribbling and tackling. We also factor in a bunch of other stuff like their current energy, home advantage, captain's influence, their placement on the pitch, their orders in the tactics editor, and morale if they're behind. These factors can all raise or lower the number of "roulette wheel slots" each player gets by a certain percentage, but their stats are always used as the base.
We also give a bonus to anyone attempting to tackle, in order to make sure we get a number of successful tackles that we think gives the right feel in the game.
That's it for now.
I hope you've found this look into the Virtualmanager engine room interesting, and that it gives you better insight into how your players' abilities are pitted against your opponents'.
Have a nice weekend, everybody!