Skip to content
/ LC2H Public

A multithreading engine for The Lost Cities project. Offloads all heavy calculations to a dedicated thread manager via the Quantified API, delivering an extreme performance boost.

License

Notifications You must be signed in to change notification settings

Admany/LC2H

Repository files navigation

LC2H | Lost Cities: Multithreaded



Overview

LC2H is a high-performance, multithreaded overhaul for The Lost Cities Minecraft mod. It moves the entire generation pipeline off the main thread, eliminating lag spikes and providing smooth city exploration.

Technical Architecture

Core Components

Async Job Pipeline

// Example: Async chunk generation scheduling
SpawnSearchScheduler.scheduleAsync(cityPos, (result) -> {
    // Process results on main thread safely
    applyGeneratedChunks(result);
});

Quantified API Integration

  • Parallel Compute: CPU-based parallel processing for spawn scanning
  • GPU Acceleration: OpenCL compute shaders for heavy computations
  • Memory Management: Dedicated GPU memory pools with automatic cleanup

Threading Model

  • Worker Pools: Configurable thread pools for different workloads
  • Job Scheduling: Priority-based async job execution
  • State Isolation: Translation layers prevent thread-unsafe operations

Caching System

  • RAM Cache: Fast in-memory storage with TTL
  • Disk Cache: Persistent storage for large datasets
  • Combined Limits: Prevents memory exhaustion across caches

Key Classes

  • LC2H.java - Main mod entry point and initialization
  • AsyncManager.java - Central async job coordination
  • SpawnSearchScheduler.java - Parallel spawn scanning with Quantified API
  • AdaptiveBatchController.java - Dynamic batching for optimal performance
  • GPUMemoryManager.java - GPU resource management

Installation

Requirements

  • Minecraft 1.20.1
  • Forge 47.x
  • The Lost Cities mod
  • Java 17+

Steps

  1. Download LC2H from CurseForge
  2. Place the JAR file in your mods folder
  3. Launch Minecraft with Forge
  4. Configure via Mods → LC2H → Config

Configuration

Access the configuration UI in-game:

  • ModsLC2HConfig

Key Settings

Performance

  • Async Double Block Batcher: Enable parallel block placement
  • GPU Acceleration: Toggle OpenCL compute shaders
  • Worker Threads: Adjust thread pool sizes

Caching

  • Combined Cache Cap: Total memory limit for all caches
  • Cache TTL: Time-to-live for cached data
  • Eviction Policy: LRU or size-based eviction

Diagnostics

  • Cache Stats Logging: Periodic performance logging
  • Benchmark Tool: Integrated performance scoring

Contributing

We welcome contributions! Here's how to get involved:

Development Setup

  1. Fork this repository
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/LC2H-Lost-Cities-Multithreaded.git
  3. Setup workspace: Import as Gradle project in your IDE
  4. Create feature branch: git checkout -b feature/your-feature-name

Code Guidelines

  • Follow existing code style (similar to Minecraft Forge conventions)
  • Add Javadoc comments for public APIs
  • Test changes thoroughly, especially threading-related code
  • Update documentation for any user-facing changes

Pull Request Process

  1. Test your changes thoroughly
  2. Update documentation if needed
  3. Create a Pull Request with a clear description
  4. Wait for review - we'll provide feedback and merge when ready

Translation Contributions

  • Translations are managed via Crowdin LC2H
  • Join our Crowdin project to contribute translations
  • Changes are automatically synced to the repository

Bug Reports & Feature Requests

  • Use GitHub Issues
  • Provide detailed reproduction steps for bugs
  • Include performance metrics when reporting performance issues

Performance

LC2H V3 achieves significant performance improvements:

  • Generation Speed: 2-3x faster than vanilla Lost Cities
  • CPU Utilization: Efficient use of multi-core systems
  • Memory Usage: Controlled via configurable caching
  • Scalability: Performance scales with hardware capabilities

Benchmark Results

  • Light Modpacks: 15k-25k performance score
  • Heavy Modpacks: 30k-40k+ performance score
  • GPU Acceleration: Additional 20-50% speedup on supported hardware

Compatibility

Supported Mods

  • C2ME - Enhanced chunk generation
  • Sinytra Connector - Fabric mod compatibility
  • Distant Horizons - LOD rendering

Known Issues

  • Some mods may conflict with async generation
  • GPU acceleration requires compatible hardware
  • Very high city densities may still cause brief stutters

License

This project is licensed under BRSSLA v1.3.

Modpack Usage

  • CurseForge: Automatic permission for all modpacks
  • Non-commercial: Allowed until 100,000 total downloads
  • Commercial: Contact BlackRift Studios for licensing
  • Credit: Always retain proper attribution

Credits

  • McJty - Creator of The Lost Cities
  • BlackRift Studios - Development and maintenance
  • Quantified API - Parallel computing framework
  • Community Contributors - Bug reports, testing, and translations

LC2H V3.0.0 - Created by Admany - BlackRift Studios

What Is LC2H

LC2H is a performance and stability rework layer for The Lost Cities.

It preserves the art, profiles, and gameplay identity of Lost Cities, but replaces the entire execution model under the hood.

V3 moves the full generator pipeline off the Minecraft main thread.

City generation no longer blocks ticks or freezes the game loop. Exploration stutter is replaced with smooth async work.

City chunks are generated asynchronously, in parallel, and only applied to Minecraft when the results are safe.


V3.0.0 - An Engineering Marvel

V3.0.0 is not a patch and not an extension of V2.

It is a ground up rebuild that restructures Lost Cities into a job based, fully async pipeline.

  • explicit job-based generator API
  • enterprise grade async scheduler
  • parallel worker pools under load
  • translation layer for thread-safe data
  • multi tier caching system
  • optional GPU acceleration via Quantified API

V3 is an engineering marvel that pushes Lost Cities into a performance tier it was never designed to reach.


City Safe Structure System

V3 introduces a structure control system built for dense city environments.

Vanilla and modded world structures are prevented from spawning inside city boundaries.

This guarantees no structures generate inside buildings, clip through streets, or float above cities.

V3 also cleans common worldgen artifacts:

  • removes floating vines
  • clears bugged tall grass placements
  • prevents vegetation from spawning mid air above cities

The result is clean city skylines with zero visual corruption.


Config UI - Commands Replaced

All command based configuration has been removed in V3.

Configuration is now handled through a proper in game UI.

Path:

  • Mods + LC2H + Config
  • Config button is located near the Done button

The config UI includes an integrated benchmarking tool. When run, it produces a final performance score. Higher scores indicate better performance.

On heavily modded packs such as ChaosZProject or ZombieCraft, a score in the 30k-40k range is considered excellent. This means LC2H was fast enough to keep up with Minecraft's generation workload while still maintaining performance headroom.

  • benchmarking tool is located at the bottom of the config screen

The UI acts as the control center for power modes, caches, diagnostics, and performance testing.


V2 vs V3 - Technical Differences

V2 focused on partial async hooks layered on top of Lost Cities.

Most heavy logic still depended on the main thread and shared unsafe state.

V3 fully separates Lost Cities logic from Minecraft execution flow.

  • V2 reused existing generator hooks
  • V3 replaces the generator pipeline entirely
  • V2 reduced lag spikes
  • V3 eliminates them under normal load
  • V2 was limited by MC thread safety
  • V3 enforces thread isolation by design

This architectural change is what allows V3 to scale with hardware instead of fighting it.


Performance Snapshot

Higher is faster. Visual comparison only.

Speed
|", 
|",                     |-^
|",                     |-^       
|",                     |-^
|",          |-^        |-^
|",          |-^        |-^        3. LC2H V3
|", |-^      |-^        |-^
|", |-^      |-^        |-^        2. Vanilla
|",  
|",  1.     2.       3.            1. LC2H V2 (Behind Vanilla by 20%)

V3 is designed to keep city generation ahead of vanilla, even at high density.


Why V3 Feels So Fast

Lost Cities compresses expensive logic into a small generation window.

V3 expands that window by executing the heavy steps in parallel async worker pools.

  • main thread is no longer the bottleneck
  • workers stay saturated
  • caches prevent rebuild storms

Optional GPU acceleration offloads selected compute heavy paths when supported.


The Translation Layer

Lost Cities was never designed to be thread safe.

V3 extracts required data, converts it into a safe representation, and isolates worker threads from unsafe state.

This is what allows nearly all Lost Cities work to run off thread without corruption or crashes.


The V3 Story

V3 is what I wanted to see with V1 of LC2H, or as we knew it, Lost Cities: Multithreaded.

V3 development started on September 17, 2025. The first prototypes were small, mostly reworks of V2 and V1 caching, partial multithreading, and early experiments.

Around mid October, I came to the conclusion that V3 had to take the step I should have done with V1, but I was too scared.

That decision created Quantified API. Its purpose was to bring the tools to me, and to everyone, without having to remake the same systems over and over per mod.

I will be honest: V3 caused immense pain at times. I cried, and I gave up more than once, because the complexity was real.

Multithreading The Lost Cities is on par with multithreading Minecraft's chunk generation. One mishandled piece of data, and it stops working as it should.

All I want to say is that I am proud. Proud of the work, and how much I had to give up in real life to make this. I hope this helps modpacks and others push performance forward, and leaves the old days of Lost Cities lag behind us.


Credits and Creator

Huge thanks to McJty for creating The Lost Cities.

LC2H exists because Lost Cities deserved to scale to modern hardware without sacrificing stability or visual identity.

All credit for the original concept, visuals, and gameplay design goes to McJty.


About the author

I'm Admany, founder of BlackRift Studios.

LC2H is built to take Lost Cities fully off the main thread, remove generation bottlenecks, and make large scale city exploration smooth on both servers and heavy modpacks.

LC2H is not affiliated with Mojang or McJty. This project is a performance rework layer, not a replacement in any way.

LC2H - Version 3.0.0 - Created by Admany - BlackRift Studios - January 4, 2026

About

A multithreading engine for The Lost Cities project. Offloads all heavy calculations to a dedicated thread manager via the Quantified API, delivering an extreme performance boost.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages