How yell0wsuit/cuttherope-dx works
Purpose and entry points
Cut the Rope: DX is a .NET 10 fan-maintained enhancement of the original PC puzzle game. The solution separates reusable game logic from desktop and WebAssembly hosts. Main executables are src/CutTheRopeDX.Desktop/Program.cs, src/CutTheRopeDX.Browser/Program.cs, and the graphics-backend launcher src/CutTheRopeDX.Launcher/Program.cs. Content acquisition/building is a separate CLI at content/Builder/Program.cs.
Core bootstrap and application control
The core project owns startup, global application state, navigation, save/progress behavior, and resource initialization. src/CutTheRopeDX.Core/CtrBootstrap.cs wires host-provided services into the game; src/CutTheRopeDX.Core/Commons/CTRApp.cs and src/CutTheRopeDX.Core/GameMain/CTRRootController.cs coordinate high-level screens. Startup generally transitions through loading/menu controllers into a gameplay scene, while command-line custom-level mode bypasses normal menu/progress flow.
• src/CutTheRopeDX.Core/GameMain/StartupController.cs
• src/CutTheRopeDX.Core/GameMain/LoadingController.cs
• src/CutTheRopeDX.Core/GameMain/CommandLine.cs
Framework boundary: platform-neutral game engine
CutTheRopeDX.Core defines its own UI, rendering, input, resource, media, and platform abstractions rather than directly depending on a desktop or browser runtime. Host implementations are injected through PlatformServices; interfaces isolate content storage, graphics, preferences, windows, updates, cursors, rich presence, and assets. Core owns view/controller hierarchy, responsive viewport calculations, animation, and lightweight constraint-based physics.
• src/CutTheRopeDX.Core/Framework/Platform/PlatformServices.cs
• src/CutTheRopeDX.Core/Framework/Core/Application.cs
• src/CutTheRopeDX.Core/Framework/Physics/ConstraintSystem.cs
Level ingestion and gameplay simulation
Pack metadata and XML map files are data inputs; GameScene loads map metadata and object definitions into the active simulation. Its partial files divide initialization, input, object loading, updates, collisions, drawing, and end-of-level behavior. Object loaders map level XML entities to gameplay systems such as ropes, candy, targets, bubbles, hazards, and transport devices. Input gestures alter scene objects, physics advances state, collisions/outcomes determine stars and level result, then controller flow presents replay/progression.
• src/CutTheRopeDX.Core/GameMain/GameScene.cs
• src/CutTheRopeDX.Core/GameMain/GameScene.LoadObjects.cs
• content/maps/1_1.xml
Rendering, assets, and authored content
The resource manager reads content via an abstract store and parses TexturePacker-style JSON atlases, Flash XML animations, fonts, localized strings, and maps. Visual elements emit renderer operations through the platform render backend. The repository’s content/ directory is the authored game-data boundary: maps are XML; image/animation descriptors are JSON/XML; translations are JSON. Content pack selection is governed by pack manifests.
• src/CutTheRopeDX.Core/Framework/Core/ResourceMgr.cs
• src/CutTheRopeDX.Core/Framework/Core/TexturePackerAtlasParser.cs
• content/packlist.json
Desktop runtime and distribution
The desktop host uses MonoGame for the window, rendering, texture/audio integration, and game loop. It supplies file-backed content, save preferences, file watching for custom-level reloads, update checks, and optional Discord Rich Presence. Video backend selection supports FFmpeg generally and AVFoundation on applicable macOS builds. Release scripts package Windows, macOS, Linux AppImage, and Debian artifacts.
• src/CutTheRopeDX.Desktop/Game1.cs
• src/CutTheRopeDX.Desktop/Desktop/DesktopHostApp.cs
• src/CutTheRopeDX.Desktop/Framework/Media/VideoPlayerBackendSelector.cs
Browser runtime and offline delivery
The browser project is a WebAssembly host using Skia rendering, Web Audio, JavaScript interop, fetch-backed content, browser input, and localStorage preferences. It is a static PWA with service-worker caching, so its external runtime boundary is the browser platform rather than a server. Browser-specific content is preconverted from source assets by Python plus NuGet-provisioned FFmpeg; GitHub Pages deployment publishes wwwroot.
• src/CutTheRopeDX.Browser/Browser/BrowserHostApp.cs
• src/CutTheRopeDX.Browser/Browser/SkiaRenderBackend.cs
• src/CutTheRopeDX.Browser/wwwroot/service-worker.js
Content pipeline and external dependencies
The content builder manages archived/downloaded assets and manifests, while the browser conversion pipeline transcodes images, audio, videos, and fonts to web formats. Material infrastructure includes .NET SDK/WebAssembly tooling, Python 3.11+, FFmpeg, MonoGame, Skia, browser APIs, GitHub Actions/Pages, and optional Discord IPC.
• content/Builder/Builder.cs
• content/Builder/Assets/AssetDownloader.cs
• scripts/build_web_content.py
Main entry points: DesktopHostApp.cs MonoGame desktop host · BrowserHostApp.cs Browser host · CtrBootstrap.cs Core bootstrap · packlist.json Game content packs
Components 22
Runtime Hosts
- Desktop entry point
src/CutTheRopeDX.Desktop/Program.cs - MonoGame desktop host · Provides windowing, game loop, local storage, and desktop integrations.
src/CutTheRopeDX.Desktop/Desktop/DesktopHostApp.cs - Desktop game runtime
src/CutTheRopeDX.Desktop/Game1.cs - Video backend selection · Selects FFmpeg or macOS AVFoundation playback.
src/CutTheRopeDX.Desktop/Framework/Media/VideoPlayerBackendSelector.cs - Browser entry point
src/CutTheRopeDX.Browser/Program.cs - Browser host · Bridges browser APIs, fetch content, input, audio, and localStorage.
src/CutTheRopeDX.Browser/Browser/BrowserHostApp.cs - Skia renderer
src/CutTheRopeDX.Browser/Browser/SkiaRenderBackend.cs - Graphics launcher
src/CutTheRopeDX.Launcher/Program.cs
Core Game
- Core bootstrap · Wires injected host services into the game.
src/CutTheRopeDX.Core/CtrBootstrap.cs - Platform services · Interfaces for storage, rendering, preferences, windows, media, and platform features.
src/CutTheRopeDX.Core/Framework/Platform/PlatformServices.cs - Application framework
src/CutTheRopeDX.Core/Framework/Core/Application.cs - App and root control · Coordinates global state, screens, saves, and progression.
src/CutTheRopeDX.Core/Commons/CTRApp.cs - Root controller
src/CutTheRopeDX.Core/GameMain/CTRRootController.cs - Startup and loading · Transitions to menu or command-line custom-level gameplay.
src/CutTheRopeDX.Core/GameMain/StartupController.cs - Gameplay scene · Loads level objects, handles gestures, updates gameplay, collisions, drawing, and results.
src/CutTheRopeDX.Core/GameMain/GameScene.cs - Constraint physics
src/CutTheRopeDX.Core/Framework/Physics/ConstraintSystem.cs - Resource manager · Loads atlases, animations, fonts, strings, and maps through abstract content storage.
src/CutTheRopeDX.Core/Framework/Core/ResourceMgr.cs
Content Pipeline
- Game content packs · Pack manifests select XML maps, visual assets, and localized data.
content/packlist.json - Content builder CLI · Builds manifests and manages archived or downloaded source assets.
content/Builder/Program.cs - Asset downloader
content/Builder/Assets/AssetDownloader.cs - Web content conversion · Python and FFmpeg convert source media into browser-ready formats.
scripts/build_web_content.py
Web Delivery
- PWA service worker
src/CutTheRopeDX.Browser/wwwroot/service-worker.js
Connections 22
- Desktop entry point → MonoGame desktop host: starts
- MonoGame desktop host → Desktop game runtime: runs
- MonoGame desktop host → Core bootstrap: injects services
- MonoGame desktop host → Video backend selection: uses
- Browser entry point → Browser host: starts
- Browser host → Core bootstrap: injects services
- Browser host → Skia renderer: renders through
- Graphics launcher → Desktop entry point: launches
- Core bootstrap → Platform services: binds
- Core bootstrap → Application framework: initializes
- Application framework → App and root control: hosts
- App and root control → Root controller: coordinates
- Root controller → Startup and loading: begins with
- Startup and loading → Gameplay scene: opens gameplay
- Gameplay scene → Constraint physics: advances constraints
- Gameplay scene → Resource manager: loads maps and objects
- Resource manager → Game content packs: reads
- Content builder CLI → Asset downloader: acquires assets
- Content builder CLI → Game content packs: builds packs
- Web content conversion → Game content packs: converts assets for web
- Browser host → PWA service worker: delivered offline by
- PWA service worker → Game content packs: caches web content