I wrote a an article going into the technical details here:
https://github.com/mmulet/code-relay/tree/main/markdown/HowI...
I also released the code for the game engine. Available here: https://github.com/mmulet/code-relay/tree/main/markdown/Tuto...