Skip to content

Commit

Permalink
feat: hardforking
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Dec 22, 2024
1 parent 75fba1e commit 9093d16
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 62 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: setup jdk 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'microsoft'
- name: build
run: ./gradlew build
- name: capture build artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "FlowSched"]
path = FlowSched
url = https://github.com/RelativityMC/FlowSched.git
1 change: 1 addition & 0 deletions FlowSched
Submodule FlowSched added at 42e2aa
93 changes: 34 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,34 @@
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)](https://www.curseforge.com/minecraft/mc-mods/starlight)
[Modrinth (Fabric)](https://modrinth.com/mod/starlight)

## Contact
[Discord](https://discord.gg/tuinity)

## 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](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](https://i.imgur.com/ZQx7Ek0.png)
- Tested via [LightBench](https://github.com/Spottedleaf/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](https://i.imgur.com/MrA2PQk.png)
- Tested via [LightBench](https://github.com/Spottedleaf/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](https://github.com/PaperMC/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.
# ScalableLux
A Fabric mod based on Starlight that improves the performance of light updates in Minecraft.

## Why does this fork exist?
- Starlight is no longer maintained as a mod [since Mar 8, 2024](https://github.com/PaperMC/Starlight/commit/cca03d62da48e876ac79196bad16864e8a96bbeb).
- The performance of vanilla lighting engine is still a bottleneck for high-performance chunk generation.
- The base Starlight is still [100% faster than vanilla](<https://gist.github.com/Spottedleaf/6cc1acdd03a9b7ac34699bf5e8f1b85c#light-engine-performance-changes-in-120-from-vanilla>),
allowing the chunk system to scale beyond 24 threads.
- Starlight's "stateless" design allows for parallel light updates, further widening the performance gap.
It is still [rather important for dedicated servers with more players to stress chunk generation](https://gist.github.com/Spottedleaf/6cc1acdd03a9b7ac34699bf5e8f1b85c#is-starlight-obsolete).
Therefore, it is still important for Fabric or other modded servers with plenty of players.

## What does this fork do?
- Contains all the performance improvements from Starlight with additional bug fixes.
- Optionally allows for parallel light updates, bringing significant performance improvement in high-speed
world generation and heavy light updates scenarios.

## Building and setting up

#### Initial setup
Run the following commands in the root directory:

```
git submodule update --init
./build.sh up
./build.sh patch
```

#### Creating a patch
See [CONTRIBUTING.md](CONTRIBUTING.md) for more detailed information.


#### Compiling
Use the command `./build.sh build`. Compiled jars will be placed under `Starlight-Patched/build/libs/`.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def getGitCommit = { ->
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
workingDir = ".."
// workingDir = ".."
}
return stdout.toString().trim()
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pluginManagement {

rootProject.name = "ScalableLux"

includeBuild('../FlowSched') {
includeBuild('FlowSched') {
dependencySubstitution {
substitute module('com.ishland.flowsched:flowsched') using project(':')
}
Expand Down

0 comments on commit 9093d16

Please sign in to comment.