Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements redstone based on the vanilla implementation, meaning that behavior such as locational redstone should work correctly.
Redstone implementation
The implementation mirrors vanilla’s signal queries, neighbor update ordering, scheduled ticks, and block-specific behavior. This includes redstone wire, torches and burnout, repeaters, comparators, observers, pistons, rails, pressure plates, buttons, levers, tripwire, daylight detectors, lamps, target blocks, copper bulbs, redstone ore, and the relevant comparator sources and powered block reactions.
Supporting systems such as dynamic block shapes, moving piston block entities, block event handling, directional placement, and chained neighbor updates were also implemented or improved where redstone depended on them.
Ticking changes
During Steel’s early development, I had the idea that since we were forced to iterate over every chunk each tick anyway, we might as well tick block entities and random blocks there too. Since then, Steel has gained simulation distance and multiple levels of chunk ticking/readiness. This, alongside the performance benefits, changed my mind. Scheduled ticks are now sparse and chunk-owned, while random and block entity ticking only process relevant chunks and sections.
Another issue I noticed was that joining the game caused tick times to spike massively, sometimes putting 1 to 3 ticks above our 50 ms warning threshold. Profiling pointed toward chunk post-processing and leaves updating their distance from logs. I first added a recent chunk lookup cache so every World::get_block_state call would not require an scc::HashMap lookup. This only went so far, since the scheduled leaf ticks still ran sequentially on the game tick.
Ultimately, I wrote a leaf-distance propagator that runs during the InitializeLight generation stage. This lets us optimize and parallelize the work while keeping live in-game leaf behavior the same. Post-processing still runs on the game tick, but I plan to parallelize it in the future; this is currently blocked by the collecting neighbor updater.