PotatoMC Engineering Update: Worldgen Performance Acceleration & 1:1 Vanilla 26.2 AI Parity
Overview
Over the past iteration, our engineering focus was directed at two mission-critical pillars of PotatoMC:
- World Generation Throughput: Overhauling the complete world-generation pipeline to eliminate CPU hotspots, lock contention, and redundant voxel passes, achieving unprecedented multi-threaded performance.
- Vanilla 26.2 AI & Combat Parity: Eliminating subtle behavioral discrepancies in mob AI—headlined by the infamous wild wolf revenge persistence bug, full owner protection mechanics, advanced Skeleton kiting, and dedicated Wither Skeleton melee physics.
Part 1: Worldgen Performance Acceleration
1. The Bottlenecks Identified
By profiling PotatoMC's complete pipeline against Vanilla 26.2, we isolated four major computational bottlenecks:
Underground Voxel Redundancy
Evaluating 320 subterranean blocks for heightmaps wasted over 80,000 unnecessary function calls per chunk.
Per-Block Noise Construction
Dynamically instantiated a new noise sampler from scratch for every single block coordinate during surface rules.
Buffer Pool Shifting
Thread-local density buffers forced an O(N) memory shift on up to 1,024 elements per allocation.
Trilinear Interpolation Loops
Slice index bounds and 3D coordinates were recalculated repeatedly in inner loops rather than using direct plane offsets.
2. Optimizations Implemented
- Column-Optimized Noise Population & Early Heightmap Cutoff: Bypassing block-tag queries, movement tests, and heightmap checks completely once the 4 heightmaps are satisfied.
- Zero-Allocation Static Noise Sampler Cache: Samplers are initialized once per world seed and reused indefinitely.
- O(1) Buffer Recycling: Converted linear array removal to swap removal to eliminate shifting.
- Streamlined `fill_cell` Loop: Precalculated offsets to allow the compiler to autovectorize contiguous memory writes.
3. Measured Performance Benchmarks
| Dimension | Baseline | Optimized | Gain | MSPT |
|---|---|---|---|---|
| The Nether | 115.15 ch/s | 465.25 ch/s | +304.0% (4.04x) | 23.56 ms |
| The Overworld | 63.76 ch/s | 201.06 ch/s | +215.3% (3.15x) | 38.28 ms |
Part 2: Complete Vanilla 26.2 Entity AI Parity
1. Wolf Taming & Retaliation Fixes
We fixed the "Angry Pet" bug where a tamed wolf would continue attacking its owner.
- Reset States: When tamed, wolves now explicitly reset their anger timers, targets, and tracking IDs.
- Ownership Model: Wolves can no longer attack their owner or co-owned pets under any circumstance.
- Retaliation: Tamed wolves now properly target anything their owner attacks, and retaliate against anything that attacks their owner.
2. Skeleton Tactical Kiting
Skeletons are now dynamic ranged combatants rather than static turrets.
- Distance Maintenance: They actively back away if the player gets too close, and advance if the player retreats.
- Difficulty Scaling: Bow cooldown drops from 40 ticks on Normal to 20 ticks on Hard.
- Line-of-Sight: Skeletons now raycast to track if walls block their shot, holding their arrows until they have a clear path.
3. Wither Skeleton Melee
Wither Skeletons are distinct from standard Skeletons and no longer inherit ranged AI.
- Spawn with Stone Swords dealing 7.0 base damage.
- Apply the Wither status effect for 200 ticks on a successful hit.
- Actively hunt Piglins and Piglin Brutes.
Part 3: Verification Matrix
| Entity / System | Test Scenario | Status |
|---|---|---|
| Wolf | Wild Wolf hit by Player → Tamed | Pass |
| Wolf | Owner attacks Hostile Mob | Pass |
| Wolf | Mob damages Owner | Pass |
| Wolf | Player A's Dog vs Player A's Cat | Pass |
| Skeleton | Player closes distance (< 4 blocks) | Pass |
| Wither Skeleton | Melee attack on Player (Applies Wither) | Pass |
| Wither Skeleton | Piglin Infighting | Pass |
| Worldgen | Nether Generation Throughput | Pass |
| Worldgen | Overworld Generation Throughput | Pass |
Ready for Deployment
This update establishes rock-solid Vanilla 26.2 compliance and up to a 4.04x world generation performance multiplier. The optimized release executable is packaged and ready.
Download Release