More Refactoring Podcast episodes

Refactoring Street Fighter With AI   with Adam Tornhill thumbnail

Refactoring Street Fighter With AI with Adam Tornhill

Published 2 Oct 2026

Duration: 00:53:46

"Large-scale AI refactoring of *Street Fighter 3*'s 300K-line C codebase improved quality, reduced development costs, and highlighted the importance of clean code for AI efficiency, while addressing challenges in enterprise vs. game codebases, AI-assisted testing, and the evolving role of developers."

Episode Description

Today's guest is Adam Tornhill, founder of CodeScene, author of Your Code as a Crime Scene, and one of the very few repeat guests of the show.With Ada...

Overview

The podcast discusses a large-scale AI-assisted refactoring project on the 25-year-old Street Fighter 3 codebase, which consisted of 300,000 lines of C code. Using AI agents, the team improved the code's health from a score of 5.4/10 to near AI-optimal levels, enabling more efficient and cost-effective development. The process relied on automated verification - such as frame hashing - to ensure behavioral consistency, and introduced a detailed "refactoring playbook" where AI documented both generic and codebase-specific patterns, including novel applications like the strategy pattern through "action parameters." This demonstrated that healthy, well-structured code significantly enhances AI's ability to understand, modify, and extend legacy systems.

The discussion expands to broader implications for AI-driven software development, emphasizing that clean architecture, strong testing practices, and modular design are now even more critical in agentic workflows. End-to-end tests and system-level validation enable autonomous iteration, while static typing - as seen with Rust - improves AI performance by constraining solution spaces. However, challenges remain, particularly around validation bottlenecks and the risk of losing human insight when relying too heavily on AI. The conversation also highlights the evolving role of developers, who must now combine technical, architectural, and product thinking, raising concerns about how junior developers can gain deep expertise in an AI-accelerated environment where traditional coding experience is less central.

What If

  • What if you used AI agents to refactor your legacy codebase into AI-friendly shape?

    • Move: Identify a high-impact, poorly structured module (1k - 10k lines) in your product. Use an AI agent with a refactoring playbook (e.g., extract method, strategy via parameterization) to restructure it while preserving behavior via automated end-to-end tests.
    • Why Now?: AI models now have strong enough reasoning and context to handle large-scale refactoring safely - especially with deterministic verification (e.g., output hashing or UI snapshots). The cost of API tokens is low compared to long-term technical debt.
    • Expected Upside: 2 - 3x faster feature development on the refactored module; lower defect rates; improved AI agent performance when extending functionality due to cleaner abstractions.
  • What if you built a custom refactoring playbook for your own codebase and reused it across projects?

    • Move: After one successful AI-assisted refactoring pass, extract the patterns the AI applied (e.g., "parameterize action logic" or "split monolithic handler") into a structured playbook. Apply this playbook to similar modules using automation or prompt templates.
    • Why Now?: AI can now document its own actions at machine-granular detail - something impractical for humans. This creates reusable, codebase-specific IP that compounds value over time.
    • Expected Upside: Reduced refactoring time by 50 - 80% on future modules; consistent architecture; enables junior developers or AI agents to make senior-level improvements autonomously.
  • What if you switched your core service from a dynamically typed language to a statically typed one optimized for AI collaboration?

    • Move: Benchmark a critical Python/Ruby service's maintainability with AI agents. Then use AI to incrementally rewrite it in Rust or another static, AI-friendly language - preserving behavior with system-level tests throughout.
    • Why Now?: Static typing acts as "executable documentation" that constrains AI search space, reducing hallucinations and errors. Recent success cases (e.g., rewriting MCP in Rust) prove viability even with smaller model training data.
    • Expected Upside: Faster AI-driven iterations; fewer bugs; better tooling integration (telemetry, linting); long-term reduction in review overhead and higher confidence in autonomous changes.

Takeaway

  • Refactor legacy code incrementally using AI agents, focusing first on high-impact areas like frequently modified components, to improve code health and reduce future development costs.
  • Implement automated end-to-end testing with behavior verification (e.g., frame hashing in games) to ensure refactoring preserves functionality and enables safe, large-scale AI-driven changes.
  • Build and maintain a detailed refactoring playbook that documents both generic and codebase-specific patterns, enabling consistent AI application and reuse across projects.
  • Experiment with multiple AI models for different tasks - using specialized models for documentation, code generation, or refactoring - to optimize performance and cost efficiency.
  • Invest in deterministic safeguards such as code health gates, architectural checks, and strict test coverage requirements to enable reliable autonomous agent workflows while minimizing technical debt.

Recent Episodes of Refactoring Podcast

15 Sept 2026 Making AI agents work in your team with Dennis Pilarinos

"AI adoption is surging but failing to boost productivity, with inefficiencies in workflows, code review bottlenecks, and fragmented data challenging effective integration, requiring context-powered solutions and better automation strategies."

17 Jul 2026 Speed Is the Only Moat with Anush Elangovan

"AI-driven software development is accelerating through open-source collaboration, balancing innovation with validation, while tech leaders must adapt to AI's role in enhancing productivity and creativity."

10 Jul 2026 The Rise of Malleable Software with Geoffrey Litt

"Malleable software, like Notion, blends structured features with deep customization, evolving through AI and user-driven development to decentralize control, while balancing complexity, automation, and trust."

More Refactoring Podcast episodes