Improve usabiltiy of in-space body indicators#4764
Improve usabiltiy of in-space body indicators#4764sturnclaw merged 6 commits intopioneerspacesim:masterfrom
Conversation
Thank you, much appreciated! If I could bother you a little more, could you separate that out into its own (appropriately named) commit? It'd make review slightly easier, and keeps our commit history sane 😄
Hmm... +145/-105? That's very small in my book! The only thing I'd suggest is that you try to squash your commits a little: the I'm very busy with non-Pioneer work right now and I can't review the code at this time, but if @impaktor or @vakhoir want to take a look and sign off, I'd be happy to get this merged. |
993b7ee to
322b0c3
Compare
|
@Web-eWorks Rebased things a little:
Added a separate commit for this
Items 1 and 2 squashed into c1c98b7, items 6 and 7 squashed into 322b0c3. In fact I realised yesterday that it probably wouldn't make much sense to have e.g. 6 without 7 anyway, at least IMO: if the nav target is part of a group but not its main body, the nav target box may be "far" away from the (main) body indicator and its label, i.e. the body indicator is completely outside of the box. |
|
Well, I have nothing to complain about. PR is well described, and commits seem reasonable, and seems like good stuff, so thanks for good job, @cwyss! I haven't reviewed the actual code, as I mostly have my head filled with gray lint, rather than brains. Sorry. (I've been meaning to learn that UI code stuff at some point, sorry) Maybe @mike-f1 could take a look, if not too busy |
|
Oh, if someone ask with a little of care, sure I try to find time ;) ... I also hope @cwyss let me merge this stuff also on top of my work, can I? Below some question.
...There were also a problem of a lot of hyperspace clouds being displayed in the same group but not clickable or which seems to exist, is this solved? ...did you see it? |
|
Thanks @mike-f1 for taking a look. And please feel free to use this stuff yourself, that's fine with me. Concerning your remarks:
|
|
@cwyss to build with the profiler enabled, simply run Then, simply run Pioneer as normal, and you'll find a timestamped HTML file and a folder named after your save file in your Check |
| std::vector<Body *> m_bodies; | ||
| bool m_hasNavTarget; | ||
|
|
||
| GroupInfo(Body *b, const vector2d &coords, bool isNavTarget) : |
There was a problem hiding this comment.
| GroupInfo(Body *b, const vector2d &coords, bool isNavTarget) : | |
| GroupInfo(Body *b, const vector2d &coords, bool isNavTarget, size_t num) : |
...where num is used to...
| m_screenCoords(coords), | ||
| m_hasNavTarget(isNavTarget) | ||
| { | ||
| m_bodies.push_back(b); |
There was a problem hiding this comment.
| m_bodies.push_back(b); | |
| m_bodies.reserve(num); | |
| m_bodies.push_back(b); |
...reserve ahead of time, then you could use my old way or do your own assumption... Not that much :)
Btw: This struct is really a nice idea 👍
You're welcome, and thanks you too for permission :) Here the open points
3-4: Not a problem if you feel that a less complex algorithm may suffice, I'm only pointing out that it's a different approach. There's some other points open in case you would use the same algorithm, but I left on code a lot of comments which should help, EDIT: Edited to highlight better the differences between the implementations because I noted the example I given works only on couples of points (as your algorithm does :P ) |
|
@Web-eWorks Thanks, got the profiler running. Though apparently line 176 in
which is not a cmake command. I changed it to
which does the trick. Does this sound reasonable? If yes, then I can put this in another PR. |
- Remove duplicate entry from collapsed bodies popup - Centre selection area on body - Shrink selection area to prevent overlapping areas of nearby bodies
- clicking on collapsed group of in-space bodies containing the nav target clears that target (no popup displayed) - PiGui.GetProjectedBodiesGrouped(): return additional info for each group; code cleanup / partial rewrite
- Use main body's coordinates to place indicator - If group contains nav target, this becomes the main body
322b0c3 to
37ceda8
Compare
The numbers are mcycles for |
|
accidentally closed this :) |
|
@cwyss , it's enough for me! I would add just a couple of considerations (which may or may not lead to a
...These are two question I simply would pose: not that I want to see code or something, but just to share some thought... |
|
I'll run some tests and go over the code later this week; if everything checks out like I think it will, this should be good to merge! |
|
Please do, @cwyss. |
|
Well technically it is a valid CMake macro, but only available in 3.12 and
later, which was released in July 2018.
Le jeu. 16 janv. 2020 à 09:17, Karl F <notifications@github.com> a écrit :
… Though apparently line 176 in CMakeLists.txt is faulty: The upstream line
reads
add_compile_definitions(PIONEER_PROFILER=1)
which is not a cmake command. I changed it to
add_definitions(-DPIONEER_PROFILER=1)
which does the trick. Does this sound reasonable? If yes, then I can put
this in another PR.
Please do, @cwyss <https://github.com/cwyss>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4764?email_source=notifications&email_token=AAEQ4NKQ3SGP5NC6TG5VYPLQ6AJYJA5CNFSM4KCPYRB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJDFVIY#issuecomment-575036067>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEQ4NPAXXTRJ6L6NWW3XL3Q6AJYJANCNFSM4KCPYRBQ>
.
|
Well, it seems that, at least for gcc 8.3, they didn't read that book: |
|
OK, let's settle this. What Stroustrup meant is that typical vector implementations use power of 2 memory allocations for object storage. This means that to insert N elements in an empty vector, you'll have log2(N) reallocations, which is really low compared to high values of N. This could be even further amortised by signaling the memory allocator that the memory allocation might need to grow further in the future, which might lead said allocator to put the allocation at the start of an unfragmented chunk of memory. I don't know if it's actually being done, though. All this means that the mental overhead of figuring out the size of the final container and calling reserve() on it might not be worth it, hence Stroustrup advice. I don't particularly agree with him, though. Note that the GCC implementation is as typical as they come, with the 0, 1, 2, 4, 8, 16 pattern showing as predicted. Now that we explained Stroustrup's advice, is it applicable here ? Well... We're dealing with really small sizes here, so this is where you'll have the most reallocations occurring. Assuming there's an actual performance problem I'd go with |
|
According to the profiling results, this code takes about 0.5% to 1% of the total time spend in |
|
Np on my side, let Big Boys show their skills & reasoning :D |
|
Turns out I didn't get a chance to go over this when I thought I would, but it's done now! Everything looks good, thank you very much @cwyss for your contribution! |
Several fixes to the game UI handling of the in-space body indicators in order to improve their usability:
These changes fix obvious bugs and also restore old functionality of the game UI as it was pre d90e14e (5 May 2019, #4548). As already mentioned in #4761, I went through the discussion of #4548 but could not find any comments/reasoning for the change of the game UI functionality. For some of the above items however (in particular 6. and 7.), the new, post d90e14e behaviour might still be the preferred one; this is perhaps subject to debate and/or decision of the maintainers.
The 7 commits of this PR reflect the above items, ordered (roughly) from "obvious bug" to "we might want to keep the new behaviour introduced with d90e14e".
EDIT: Items 1 and 2 squashed into c1c98b7
Fix in-space body ..., items 6 and 7 squashed into 322b0c3In-space indicator for collapsed ...Additional comments to the items:
@Web-eWorks I also added Lua API documentation for
GetProjectedBodiesGrouped():-)Apologies if this PR is too big, i.e., concerns too many features. But since all of this affects the selection/display of in-space bodies and happens in the same piece of code, I decided to put this in only one PR. Hopefully this also helps when reviewing... :-)