Convert Figma logo to code with AI

PaperMC logoStarlight

Rewrites the light engine to fix lighting performance and lighting errors

1,268
136
1,268
2

Top Related Projects

A Fabric mod designed to dramatically improve the performance of Minecraft's lighting engine while fixing many bugs

2,036

A Fabric mod designed to improve the general performance of Minecraft without breaking things

Rewrites the light engine to fix lighting performance and lighting errors

Quick Overview

Starlight is an open-source project aimed at optimizing Minecraft server performance, specifically focusing on improving light engine calculations. It is designed to work with PaperMC, a high-performance Minecraft server implementation, and significantly reduces server lag caused by lighting updates.

Pros

  • Dramatically improves server performance, especially during chunk generation and block updates
  • Compatible with existing Minecraft worlds and plugins
  • Actively maintained and supported by the PaperMC community
  • Open-source, allowing for community contributions and audits

Cons

  • May introduce subtle differences in lighting behavior compared to vanilla Minecraft
  • Requires PaperMC as a base, limiting compatibility with other server implementations
  • Potential for conflicts with other performance-enhancing mods or plugins
  • May require additional configuration for optimal performance in specific server setups

Getting Started

To use Starlight with your PaperMC server:

  1. Download the latest Starlight release from the GitHub releases page.
  2. Place the downloaded JAR file in your server's plugins folder.
  3. Restart your PaperMC server.
  4. Optionally, configure Starlight settings in the config/starlight-engine.yml file.
# Example starlight-engine.yml configuration
enabled: true
light-queue-size: 5000
chunk-edge-radius: 1
  1. Restart the server again if you made configuration changes.

Note: Starlight is typically included by default in recent PaperMC builds, so these steps may not be necessary for up-to-date servers.

Competitor Comparisons

A Fabric mod designed to dramatically improve the performance of Minecraft's lighting engine while fixing many bugs

Pros of Phosphor

  • More compatible with other mods due to its Fabric-based architecture
  • Potentially better performance in specific scenarios, especially with complex redstone contraptions
  • Longer development history and established community support

Cons of Phosphor

  • Generally slower performance improvements compared to Starlight
  • Less frequent updates and maintenance
  • Limited to Fabric mod loader, reducing compatibility with some server software

Code Comparison

Phosphor:

public boolean isEmptyShape(VoxelShape shape) {
    return shape == VoxelShapes.empty() || shape.isEmpty();
}

Starlight:

public static boolean isEmptyShape(VoxelShape shape) {
    return shape.isEmpty();
}

Both projects aim to optimize Minecraft's lighting engine, but Starlight generally offers more significant performance improvements. Phosphor focuses on compatibility and specific optimizations, while Starlight provides a more comprehensive overhaul of the lighting system.

Starlight is typically easier to integrate with popular server software like Paper, making it a preferred choice for many server administrators. However, Phosphor's Fabric-based approach may be more suitable for modded environments or servers requiring specific mod compatibility.

Ultimately, the choice between Phosphor and Starlight depends on the specific use case, server setup, and desired balance between performance gains and compatibility with other mods or plugins.

2,036

A Fabric mod designed to improve the general performance of Minecraft without breaking things

Pros of Lithium

  • Broader compatibility with various Minecraft versions and modpacks
  • More extensive optimization coverage, including AI, physics, and world generation
  • Client-side support, allowing for improved performance on both server and client

Cons of Lithium

  • May require more frequent updates to maintain compatibility with new Minecraft versions
  • Potentially higher complexity in configuration and setup compared to Starlight
  • Some optimizations might conflict with certain mods or plugins

Code Comparison

Lithium (Entity collision optimization):

public boolean hasEntityCollision() {
    return this.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN).isEmpty();
}

Starlight (Light engine optimization):

public int getLightLevel(long pos) {
    return this.lightData.get(pos);
}

While both projects aim to improve Minecraft performance, Lithium focuses on a wide range of optimizations across various game systems, whereas Starlight specifically targets light engine improvements. Lithium's broader scope may offer more comprehensive performance gains, but Starlight's specialized approach could potentially provide more significant improvements in lighting-related tasks.

Rewrites the light engine to fix lighting performance and lighting errors

Pros of Starlight

  • Improved performance and optimization for Minecraft servers
  • Regular updates and active development
  • Strong community support and integration with PaperMC ecosystem

Cons of Starlight

  • May have compatibility issues with certain plugins or mods
  • Potential learning curve for server administrators unfamiliar with PaperMC
  • Limited documentation compared to some other server optimization projects

Code Comparison

Starlight:

public class LightEngine {
    private final ChunkLightProvider lightProvider;
    private final LightingQueue lightingQueue;

    public LightEngine(ChunkLightProvider provider) {
        this.lightProvider = provider;
        this.lightingQueue = new LightingQueue();
    }
}

Since both repositories are named Starlight, there isn't a direct code comparison to be made. The code snippet above is an example of Starlight's light engine implementation, which is a key component of its optimization strategy.

Summary

Starlight is a popular optimization mod for Minecraft servers, focusing on improving lighting performance. It offers significant benefits in terms of server efficiency and is actively maintained. However, users should be aware of potential compatibility issues and the need for familiarity with the PaperMC ecosystem. The project's code demonstrates its approach to optimizing lighting calculations, which is central to its performance improvements.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Starlight (Fabric)

Fabric mod for completely rewriting the vanilla light engine.

Future updates past 1.20

Please see: https://gist.github.com/Spottedleaf/6cc1acdd03a9b7ac34699bf5e8f1b85c This project will not receive further updates for the foreseeable future.

Download

CurseForge (Fabric) Modrinth (Fabric)

Contact

Discord

Results

The graph below shows how much time the light engine was active while generating 10404 chunks: See "Notice about invalid gen test results" in TECHNICAL_DETAILS.md for why there is no 1.20 data for this test.

Below is a graph detailing how long light updates took for breaking/placing a block on a large platform at y = 254 down to a large platform at y = 0: Block update at height graph

  • Tested via LightBench on 1.20-rc1
  • World is just a flat world with bedrock at y = 0 and grass at y = 254
  • CPU: Ryzen 9 7950X

Below is a graph detailing light update times for a simple glowstone place/break: Simple glowstone block update

  • Tested via LightBench on 1.20-rc1
  • World is just a flat world with bedrock at y = 0 and grass at y = 254
  • CPU: Ryzen 9 7950X
  • Tested breaking and placing the glowstone on the bedrock platform, where skylight could not interfere with the test.

The results indicate that Starlight is faster for light propagation, but the absolute times indicate that it is unlikely to affect FPS in any situation on the client.

Purpose

Currently, Starlight's light section management is depended on for both Paper's rewrite of the chunk system (people in the modding space call this "TACS") and Folia's additional changes to that system. In Starlight, light sections are tied directly to ChunkAccess objects.

The light section management prevents most bugs (including performance ones) involving missing/absent light sections, as Starlight assumes that no updates are possible unless the chunk exists. This is why there are basically zero performance or bug related issues with the light section management in Starlight.

This difference in light section management allows Paper's rewrite of the chunk system (which is designed as a solid base for Folia to build on, which adds regionized multithreading to the dedicated server) to greatly simplify and optimize its chunk unload/load logic as it no longer needs to consider any light engine state as there is no light engine state.

The "stateless" property of Starlight allows the chunk system to run light updates / generation in parallel provided the scheduling is done right, see patch "Increase parallelism for neighbour writing chunk statuses" in 1.19 Folia. This is critical to allowing the chunk system to scale beyond 10 worker threads, which is important for dedicated servers with more players to stress chunk generation.