Migrating a Large-Scale Game Server from Scala 2.13 to Scala 3: A Year-Long Odyssey

This post details the author's journey migrating a four-year-old, production-ready multiplayer mobile game server from Scala 2.13 to Scala 3. An initial attempt failed due to the removal of key features in Scala 3 (macro annotations, type projections) and the massive code changes required. A year later, a successful migration was achieved through a multi-pronged approach: preemptively applying Scala 3 syntax in the Scala 2 codebase, leveraging IntelliJ's code inspection tools, custom sbt source generators to produce Monocle lenses, and creative workarounds for type projections. Challenges encountered included dependency conflicts and slow compile times, resolved by forking a library, optimizing code using Scala 3's Tuple.Map, and other techniques. Despite the hurdles, the migration highlights the power and value of Scala 3's metaprogramming capabilities.
Read more