Opening explorer
Only supports the master database for now. Thought it'd be a good idea to create a pr before I go any further, in order to get your thoughts. demo:
Hi Mauritz Thanks, looks promising. I was working on the opening explorer feature a few months back, but had to stop due to other personal obligations. Unfortunately, I don't expect this to change in the next few months :(. I have published my progress here, so maybe you can take some inspiration: https://github.com/HaonRekcef/lichess-mobile/tree/opening-explorer Here's a screen recording of how it looked:
https://github.com/lichess-org/mobile/assets/78898963/2bc445d9-ea35-409a-89a7-fdf85c02f1ee
Note that the code and the design are not polished. If I remember correctly, the communication with the server is not done well, and there are some other things not implemented.
Some feedback and points to discuss:
- I am not sure if there is space for the opening explorer in the analysis board, even though I loved it there in the old app. If there is some notation and the engine is turned on, it won’t fit.
- I experimented with different types of Flutter tables a lot, and I think the data table widget takes up too much space vertically. I managed to get a working version with the Table widget that uses less space while still having the ink behavior of the data table widget (highlighting the whole row). See here: https://github.com/HaonRekcef/lichess-mobile/blob/e65893273b07b3bfb2512dc084a3ad75e060d44f/lib/src/view/explorer/opening_explorer.dart#L106C23-L224C23
- In my opinion, an opening explorer without a way to view games is incomplete.
Hi! Thanks for taking the time to share your thoughts and give feedback, I appreciate it more than you know.
To address your points:
- I agree that it should be a separate screen, right now you have to scroll a lot and it's hard to get a good overview.
- I agree on this one as well, I think the less scrolling needed the better. I'll check out the way you used the table widget.
- Definitely, I will add it.
On a side note, I tried to get each color block in the percentage graph to have widths according to their percentage, but I had a lot of problems with the table changing size depending on the data and sometimes going of screen, and I couldn't really figure out why. Do you remember if you had any similar problems?
From what I can see in your video, the opening explorer is only available as a standalone tool, separate from the analysis board. I think that it's a must that it's a part of the analysis board, so you can use it when analyzing games.
I think designing the ui is the difficult part. The table itself takes up a lot of space, and you also need to be able to switch between the masters, lichess, and player db, and the different settings for each of them. All while still being available from within the analysis board.
One option that comes to mind is to be able to swipe between the move list and the opening explorer. It has the benefit of always being able to see the board, which I think would be a big plus, but it leaves less space for the explorer compared to having a whole screen dedicated to it. Any and all ideas are appreciated, since I feel like it can be quite tricky to get it right.
This one will wait in the queue for the review, until I've dealt with older PRs.
Just a couple of quick notes from what I've read here:
- a separate dedicated screen is a must have indeed (I think accessed from the analysis screen with a bottom bar icon, and also separately from the tools tab)
- but it doesn't prevent having a split view in the analysis screen as you did (with a settings disabled by default I'd say); can be useful for devices where vertical space is not an issue
- for wins/draws/loss, width according to percentage is a must have
- we should try to reduce the vertical padding of table rows but we shouldn't shrink them too much (as in the 2nd video), since these rows are also tappable targets.
Do you need a review or feedback about the UI @Mauritz8 ? Please send a screen recording if you need.
Overall, I'm quite happy with how it has turned out, but feedback is, as always, welcome. Functionality wise, there are a few things still missing, but a few of them can probably be left for another pr:
- Add unit tests for api requests.
- The specific lichess player endpoint streams the response using newline delimited json, which I didn't account for. To support it I'll have to change the approach quite a bit I think.
- Cache results.
- Ability to view master games. Not sure how this should be done, I quickly looked at the website and it seems like it uses websockets for this, but I don't know why that would be necessary.
- Tablebase, should be separate pr.
- Some other small adjustments.
I usually have a ton of feedback. I have very little, a sign that this looks awesome. Great work dude.
Only thing is was the percentage of the move removed intentionally. To me I like that being there to help highlight the relative popularity of comparative moves. I do prefer it columned like on mobile more so than the slash in your original recording above.
Oh and would it make sense to get the wiki book in as well at some point
This looks awesome! Excellent work. I'll review and give more detailed feedback later.
To view master games, I think they are imported in lichess so it should just be a game ID? Also newline delimited JSON is already supported in the app, so it should not be too hard.
I spent a lot of time on this, so I'm glad you like it!
Only thing is was the percentage of the move removed intentionally. To me I like that being there to help highlight the relative popularity of comparative moves. I do prefer it columned like on mobile more so than the slash in your original recording above.
Horizontal space was a bit of an issue, so I made it show up on long press instead. Having a separate column for it would take to much space, unless the column name would be very short. And like you, I didn't really like how it looked when separated with just a slash or space.
Oh and would it make sense to get the wiki book in as well at some point
I could make the opening name below the board be a link to the wikibook page. If integrating it into a dedicated screen is a wish, it is probably best left for later.
I spent a lot of time on this, so I'm glad you like it!
❤️
Horizontal space was a bit of an issue, so I made it show up on long press instead. Having a separate column for it would take to much space, unless the column name would be very short. And like you, I didn't really like how it looked when separated with just a slash or space.
Hmm this is one time I'll disagree with ya. I still think percentage. Is important enough to show outright rather than on a long press. What about scaling font size down? Is there any other way?
I could make the opening name below the board be a link to the wikibook page. If integrating it into a dedicated screen is a wish, it is probably best left for later.
This totally works for me. Only request is link opens in-app browser as opposed to safari redirect
Thanks❤️, I'm also really hyped about this! Since your review, I've added a couple more things:
- Support for the player endpoint, which streams the results while it indexes more games. So, now one can see the results before it has fully indexed, and it also shows a loading indicator so the user knows it's not fully done.
- The opening explorer data is now cached for every position, to avoid uneccesary requests to the server.
- I made the opening name a link to it's wikibooks page.
- The percentage is now shown directly in the table, instead of on long press.
- Unit tests for parsing the api responses
I haven't addressed any of the things you mentioned in your review just yet. I'll also upload screen recordings later.
I've now addressed all of your comments. I've made some screen recordings, the emulator starts lagging quite a lot when I'm recording unfortunately.
Screencast from 2024-08-09 13:11:28.webm
Thanks for the recordings! The UI is slick, and looks nice on both phones and tablets.
One suggestion: we could have a preloaded chip with the current user when you choose "player" database. Because most of the time users want to see their game.
I've refactored the cache implementation, it's still exposing a stream though (see my previous comment). I also added a move number cap to try and fetch the wikibooks url, and now it selects the current user as default for the player db.
I added a few widget tests as well, that check that the data loads for each db type. I'm not sure what the preferred way to mock a provider is, when it needs different state between test cases. I did a bit of a hack to change the database type between tests, but there's probably a better way.
I've updated everything now.
I must thank you again for your work @Mauritz8 . It is really awesome to see the explorer in the app finally 🎉
I've added only cosmetic changes to your PR, and improved the loading effect (it doesn't blink anymore).
Hey @Mauritz8 had two questions?
- when clicking a popular opening in mobile web, I see some openings open a page like this (so not directly wikibooks but a more comprehensive native page; in fact this page then links to wikibooks). Should the app do similarly?
- I've noticed that if I use opening explorer to analyze an opening, then open up like a masters game, that subsequent masters game if I go to game review and then click the opening explorer from there, the title of the opening does not open wikibooks same way it would if I came directly from the opening explorer itself. It's kinda like opening an opening explorer from An opening explorer. Should it? The opening explorer screens look the same so would expect them to operate the same regardless if you're in one inside another.
- Having a native wikibooks page would definitely provide better and more seamless experience. I might not have time to work on it anytime soon though, but feel free to open an issue and I might get around to working on it.
- Unfortunately (or fortunately?) I'm unable to reproduce this, for me the link opens just fine either way.
- Having a native wikibooks page would definitely provide better and more seamless experience. I might not have time to work on it anytime soon though, but feel free to open an issue and I might get around to working on it.
Sorry not necessarily more native. But what I mean is the page that opens first in mobile web is not the wikibooks page. There's a more dedicated page that opens first that has a link to wikibooks page. Basically wondering if that's the page we should first have access to. If you try on mobile web perhaps you'll see what page I mean . It's just a different link I was curious about.
- Unfortunately (or fortunately?) I'm unable to reproduce this, for me the link opens just fine either way.
I think the bug is if you go far enough I , like 8 moves sometimes, clicking the opening doesn't do anything in app. But putting the exact same opening sequence in mobile web, the link is clickable. If you need a recording lmk
@ijm8710 I think this will eventually be its own tool, instead of only linking to the opening explorer. Currently in Beta, it's Lichess's way of offering their own crowdsourced explanations to openings and their variations without relying on the (in my opinion) often vague wiki books explanations. Because this feature is relatively new even for the website, unless someone really wants to make a PR for it I don't think it's too high on priority.
Right now I believe it uses wikibooks as a baseline and are slowly filling it in with original content
I'm not asking for it to be more native. I'm saying currently it's just a web redirect but the page provided is different from mobile web. Shouldn't we use the same one?
I see, it should just link to the lichess.org page instead. I like that, and it seems like an easy thing to change.
A recording of the bug would be appreciated.
I'm not asking for it to be more native. I'm saying currently it's just a web redirect but the page provided is different from mobile web. Shouldn't we use the same one?
I see, sorry for the misunderstanding
I see, it should just link to the lichess.org page instead. I like that, and it seems like an easy thing to change.
A recording of the bug would be appreciated.
Awesome glad you agree and here's video of other. When there's a pause it doesn't open link
https://github.com/user-attachments/assets/7044f89b-2ba9-49be-a3b2-9133e6023d6c
This recording doesn't show what you described with opening master games. Do you have an example where it works for a certain position one time, but not after opening the explorer from a master game? If not, it seems like it's an issue with certain openings at all times, such as the moscow variation you showed.
Perhaps that's a better way of describing the issue. I probably interpreted it wrong. Either way Moscow does work in mobile and has a wiki book so would assume it should work.
Actually yes I have an example. If you go to the 8th master game from top (the ones that show up without making a first move) and from analysis you jump right to c5?! It will not work. But if you move one move back it will work. But both have the exact same name I believe
Wikibooks has a different page for each sequence of moves, so even if two positions have the same opening name in lichess they will have different wikibook pages. In this case, after c5 there is no wikibook page.
Ah okay that makes sense! Apologies for the long road to show you that.
On mobile web, since it opens that OTHER beta page I referenced rather than wikibooks directly, it opens up "Indian Defence with e6, Nf3"
If you were to use this OTHER beta page, would it be able to do it even in the app too off of c5?! As well or is there some extra magic they do to basically go off move name rather than the entire sequence if there's an innacurzcy to the sequence line opening?