Exchange ideas about the simulation approach #10
Replies: 6 comments 10 replies
-
There is a different possible approach, that has not been mentioned yet. I would call it a top-down approach. First calculate the end result of the game, depending on probabilities (depending on the selected fomations, players, fitness ...). Then step by step calculate more fine-granular events. How and when happend the goals, what move was made before the goal ... But I think this approach is also very limiting. Because you can not influence the outcome of the game during the game, because the result is already calculated. So my personal opinion is, that we should start with a simple markov based approach. You have a list of possible events and you have a current state. A event leads from the current state to a different state and the probability of a event depends on the current state. |
Beta Was this translation helpful? Give feedback.
-
And in addition we should think about the implementation. I do not think, that it is a good idea to hardcode all the states and events. At the moment the event list and probabilities are hard coded. We should use a generator class, which generates the state machine with the probabilities. And maybe we should also use some kind of description files, which describe the states and the possible events. This keeps the software expendable and improves the code readability. |
Beta Was this translation helpful? Give feedback.
-
It took me a while, but I've completed the work on defining the clubs and working with player and club generation. I'm not sure if you're still willing to help, but I'm going to be focusing on implementing a very simple GUI first, and then I can work with the match simulation and visualize it in real time. Development pacing should speed up in the next few days. Anyone interested can use this Discussion tab to contact me about the development. I'll set up some issues to work on if that's the case. |
Beta Was this translation helpful? Give feedback.
-
Nice to hear from you and great that you're making progress with the project. |
Beta Was this translation helpful? Give feedback.
-
Hello, it's starting to take on a good shape. Having said that, how are you going to manage the aspects linked to the success of the actions by the players. For example, if 2 players are fighting over the ball, how do you calculate which of the 2 will win? The same goes for a defender tackling an attacker or an attacker shooting at goal. |
Beta Was this translation helpful? Give feedback.
-
This is still on the works, so in the current master branch as of commit 1d438ab I'm working on this implementation. Anyone is welcome to contribute with ideas and approaches to the match simulation, I just want to share my thoughts on the implementation, and perhaps describing it gives me a better view on how to continue implementing this. There are two important classes here: LiveGame and SimulationEngine. The LiveGame is the current game and tracks the state of the game. It receives the details of the Fixture (football game), and passes the teams to the SimulationEngine. The SimulationEngine is where the magic happens, where the events are drawn. I've selected some events from a list of simplified events in a football match. All of the events derive from a SimulationEvent abstract class, and they're listed as an enum in the EventType enum (I've been working with Rust lately, and working with well-defined types instead of strings are better IMO). These are: Pass, Dribble, Shot, Foul, Free Kick, Corner Kick, Goal Kick and Penalty Kick. I believe Throw-In and other minor events are not so relevant to the match itself, so I'm not concerned with these. Each event has their own EventOutcomes, which again is just a list of enums for some things that can happen in the game's events. The SimulationEngine tracks the current GameState: the minutes that have passed and the position that the ball is in in the field. Once an event is drawn from a transition matrix of events that corresponds to the current attacking team's TeamStrategy, the SimulationEngine passes the teams to the Event's The events use the Player's attributes to calculate the probabilities of the EventOutcomes. Events can change the current team in possession and alter the current team's stats. The event then returns the new GameState class with a new PitchPosition (if it changed at all). I'm still figuring out how to fit in the Substitutions in the middle of this, but I have an idea of pausing the current game simulation and doing that out of the current simulation loop, and then restarting the game again from where it left off. Probably I'll need an AI for computer-only games, and for the player's opponents as well, but I don't see that as being too difficult to pull off. After each iteration of the Event simulation engine, the GameState adds 0.1 minutes to the game's clock, until we reach the end of the current half or the game itself. That can trigger a pause for live player-controlled games. This is still in early stages but my tests are showing it's a promising approach. A lot of details have to be worked out, and I still need to take care of small details, but progress is here nonetheless. |
Beta Was this translation helpful? Give feedback.
-
The most important part of a football manager game is the simulation engine, as already discussed in #3. I start this discussion to further exchange some ideas about how to compute the outcome of a game and the events, that happen in during the game.
@sturdy-robot brought up some ideas for possible approaches in #3:
My personal opinion is also to start with a simple approach, which can be evolved in the future. But I think that generating random Events from a List of events with a fixed probability is to simple, to get a somehow realistic simulation of a football game.
Beta Was this translation helpful? Give feedback.
All reactions