Tiki Tech - A Haskell simulation of football

Tiki Tech is an open source Haskell simulation of (association) football.

It begins from first principles, i.e. the motion of the players and the ball rather than from some existing statistical analysis of football. The idea is instead to work backwards from those statistical models and tweak the physical parameters until something approximating the real game of football emerges. I hope that this approach sets the simulation up for success as the application of data and analysis to football evolves and better statistical measures of success become increasingly available.

Motivation

There are clearly a number of existing football simulation games that are wildly more advanced and capable than this simple hobby project. The closed source and commercial nature of these alternatives makes for a good game but a poor experience of being able to inspect and understand what’s truly happening under the hood.

I’m, personally, about as far from an expert in football tactics as you can get but I also know that the game has undergone a significant tactical evolution over the last 5, 10, 20 years and some of these things are not well captured by existing simulations. I am specifically thinking of things like “pressing traps” and formations that rotate significantly depending upon the phase of play.

My objective with this simulation is to create a project around which people who share an interest in Haskell and football tactics could experiment with how to model the various tactical concepts involved in the modern game and maybe experiment with some new and innovative tactical ideas.

Implementation

Tiki Tech uses:

  • sdl2 to display the game in real time.
  • STM for optimistic currency.
  • jc_voronoi (C) for computing voronoi diagrams that help the players to conceptualise the space.
  • tagless final for the simulation DSL

It is currently extremely rough around the edges, both in terms of code quality and in terms of simulation quality (the players make some really weird choices much of the time) but it now just about captures some of the barest elements of football so I wanted to make it public early in case others fancied chipping in with PRs or just with ideas.

Demo

Demo

12 Likes

I tried it and it remarkably good in the simulation, well done!