Self-plug: Old World, a 4X game from the lead of Civ4, has from day one shipped with a copy of the entire gameplay source code. It's not the full source of the game as the rendering-related parts and a couple systems classes are excluded but most of that is handled by Unity anyway, but every bit of game logic is public.