Skip to content

Commit

Permalink
new: port to NeoForge
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Dec 31, 2024
1 parent c8ae85a commit 40b1332
Show file tree
Hide file tree
Showing 3 changed files with 535 additions and 0 deletions.
147 changes: 147 additions & 0 deletions patches/main/0001-Revert-feat-hardforking.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ishland <[email protected]>
Date: Tue, 31 Dec 2024 14:09:26 +0800
Subject: [PATCH] Revert "feat: hardforking"

This reverts commit 1881f614419f9bd958ea57b0469c4c873bd05d6f.

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 8132eca..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "FlowSched"]
- path = FlowSched
- url = https://github.com/RelativityMC/FlowSched.git
diff --git a/FlowSched b/FlowSched
deleted file mode 160000
index 42e2aad..0000000
--- a/FlowSched
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 42e2aad57ac461e9854850e9eca920afaa7a33fb
diff --git a/README.md b/README.md
index 5066ce5..a2c8095 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,59 @@
-# 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/`.
+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.
diff --git a/build.gradle b/build.gradle
index a5fedcd..ed6d51b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,7 +22,7 @@ def getGitCommit = { ->
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
-// workingDir = ".."
+ workingDir = ".."
}
return stdout.toString().trim()
}
diff --git a/settings.gradle b/settings.gradle
index 59b33fb..72ebf6e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -11,7 +11,7 @@ pluginManagement {

rootProject.name = "ScalableLux"

-includeBuild('FlowSched') {
+includeBuild('../FlowSched') {
dependencySubstitution {
substitute module('com.ishland.flowsched:flowsched') using project(':')
}
Empty file removed patches/main/0001-empty.patch
Empty file.
Loading

0 comments on commit 40b1332

Please sign in to comment.