-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logic jump UI enhancement #10108
Draft
code-explorer786
wants to merge
8
commits into
Anuken:master
Choose a base branch
from
code-explorer786:logic-jumps
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Logic jump UI enhancement #10108
Conversation
This file contains 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
Original canvas.jumps is now a reference to canvas.statements.jumps. Please remove canvas.jumps in favour of canvas.statements.jumps in a future release. Thanks!
Note that this is very incomplete, for two different reasons: - it's O(n^2) or potentially worse - it makes the GC work hard (it invokes `new` in `LCanvas.DragLayout.layout()`) For the second reason this does not clearly fit the criteria of CONTRIBUTING.md, but I have yet to figure out ways to work around this (or make the algorithm more efficient).
This method uses signaling (through a boolean) and I feel like it's extremely hacky, but I tested this and it (kind of?) works. Unfortunately I found this to potentially lag when resizing. I am not sure if this is guaranteed to work (as in, produce correct behaviour) or not, but to my understanding only LogicDialog uses LCanvas (grep out "LCanvas\|canvas" and see) so it will most likely work? I tested this and accidentally found an unrelated issue related to LCanvas.maxJumpsDrawn, but I hope this will be fixed in the near future.
It looks good.
See #general-programming in the Mindustry Discord server: https://discord.com/channels/391020510269669376/663854113418641429/1256146387834372106 Co-authored-by: Ilya246 <ilyukarno@gmail.com>
I haven't checked this yet, but it seems like it also reduces the complexity (runtime) from ≈O(n^2) to ≈O(k^2 + n) (n = number of jump curves) (k = number of unique destinations) The worst case, that is k = n, is still O(n^2) but generally it's much more (scalably) performant. Thanks Arkanic for suggesting this! https://discord.com/channels/391020510269669376/663854113418641429/1256161815503704104 Co-authored-by: Arkanic <50847107+Arkanic@users.noreply.github.com>
code-explorer786
force-pushed
the
logic-jumps
branch
from
August 11, 2024 02:01
8a6d6e0
to
0d2d406
Compare
I like |
jump color based on jumping to instruction color? |
It's based on the destination's index/line number. int idx = e2.button.to.get().index;
if(dragging != null && idx >= dragging.index) idx += 1;
e2.button.defaultColor.set(jumpColors[idx]);
});
} |
If you like, you can merge some from this commit TinyLake@b7be5a3. I implemented the culling support for jumping, getting better performance. |
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.
If your pull request is not translation or serverlist-related, read the list of requirements below and check each box:
Warning
I often reorder my commits and force push to this branch, so be careful while pulling from it!
Note
I am not that good in computer science.
If anyone has a better method1, I'd recommend discussing it here, in general-programming, or make a competing PR.
I got the
not-in-#development
treatment, so I can't really access the #pulls channel right now.I'd love to hear your ideas!
Overview
The goal of this PR is to improve jump UI.
As such, this competes with @MEEPofFaith's #9925 and Foo's Client's implementation.
This PR adds in three features2:
Tested feature combinations
I think fixing Trapezoidal Jumps and Colored + Trapezoidal Jumps implies reimplementing Dynamic Jump Heights in some form or another.
I don't think there's an alternative, but I could make Trapezoidal Jumps require Dynamic Jump Heights.
Footnotes
With both Dynamic Jump Heights and Trapezoidal Jumps, I'd estimate the complexity determining jump heights is about
O(k^2 + n)
wherek
is the number of unique end destinations andn
the number of jump curves. ↩I've decided that these three features belong in one PR because they complement each other.
Still, I've made them configurable in separate settings anyway. ↩
It improves both graphical rendering of the jumps and the implementation of Dynamic Jump Heights. ↩
Runs slower on logic with a lot of jumps.
(I removed
maxJumpsDrawn
) ↩ ↩2 ↩3 ↩4