ES Filter by Genre, Publisher/Developer, Players and Rating
-
Hi all.
Have you ever wanted to find out what Capcom games you had in your gamelist? Now you can.
What about having a fighting game session with your pals, and only see those games? You got it.
What about showing only games for two players? Uh-huh.
Showing only games with a 5 star rating? Yes sirree.All of the above? You got it! (The answer will be "Final Fight" or "Street Fighter Alpha 2").
I added filters to the gamelist menu, where you can filter by genre, player number, rating, and publisher/developer (yes, they're combined) - provided there is data on those entries.
What this is not:
- It is not a filter for ALL systems at the same time. It's only for the currently selected system. It is good enough for now - I don't plan on implementing a "RetroPie-wide" filter because not all systems have the same genres/metadata values, and a lot will just show an empty list.
- It does not save filters between sessions (i.e. if you reset Retropie, it'll start without a filter).
- It's not a free-form search field. It allows you to select entries which you do have in your metadata. It's meant to be used without keyboard, for arcade machines or playing with controllers only.
Now that we got that out of the way, here's a small build for testing/perusal of the RetroPie community. Would love your testing and feedback on an bugs you find. If testing goes well, this will be merged with the main ES build soon, as it's based on that :)
This is based on the main ES branch from 2-3 weeks ago - it's not based on the OMX Player build I published a while ago. Since the development has been going on for a few weeks, it also does not have the latest changes on carousel themes.
The binary was compiled on a RPi 3, so it might only work on a RPi2/3 at the moment. If you compile it from source, you may get it to work on a Pi 1 or a Windows/Ubuntu system.
Get it here:
https://github.com/pjft/EmulationStation/releases/tag/0.1-filtersThanks in advance, and have fun. :)
Instructions:
-
Either download a fresh copy of retropie from https://github.com/RetroPie/RetroPie-Setup/releases/download/4.1/retropie-4.1-rpi2_rpi3.img.gz and install it on an SD card or use a pre-configured (and backed up) configuration.
-
Connect the raspberry pi to the network
-
Boot the raspberry pi and exit ES back to the terminal
-
Download or copy the new ES build https://github.com/pjft/EmulationStation/releases/download/0.1-filters/emulationstation into the home directory, e.g.
wget https://github.com/pjft/EmulationStation/releases/download/0.1-filters/emulationstation
-
Make executable and replace the original ES
chmod +x emulationstation
sudo cp emulationstation /opt/retropie/supplementary/emulationstation/ -
Install your ROMS and configuration including <video> tags and a video supported theme. More important than having a working video theme, though, is actually having videos in the gamelist files. I suspect you may be using a non-video theme for the purpose of benefiting from the video screensaver and launch.
-
Restart your Pi.
-
@pjft Sounds awesome! I'll hopefully have a chance to test it out soon (but right now it's bed time).
-
@mattrixk thanks, please do! :) Let me know how it goes. It doesn't have the carousel changes, but other than that should be good to go!
-
This is a great effort! Nicely set up and future-proof for whatever data source we might use in the future (xml or sqlDB).
I have not tested it yet, but did look at your changes. I have some questions about the implementation details, would you rather discuss them on GitHub, or here in this thread? -
@Zigurana Oh my, you're looking into my code! <quickly closes the curtains> :)
Happy to discuss wherever you feel it's appropriate, would certainly love to.
I'll be honest: the code is still very much work in progress - I'm sure there still is a bit of refactoring to do there before merging it, in order to make it even more generic, but for now I just wanted to get it out the door. I'm also sure that, asides from the tremendous logging code that I still have there (I am debugging via logs) that needs to be cleaned up, there are quite likely several methods to delete and a handful of them that are not even being used at the moment as the design evolved while it was being developed.
Happy to have it here, on GitHub (how does that work?), or even over email - whatever works.
Thanks!
-
Ha! Don't worry, it all looks very decent if you ask me, nothing at all to be ashamed of.
I was (of course) thinking how to leverage this to allow a new iteration of the Kid-modes stuff, as it's in such a similar domain.
I 'll try take it to Github to comment on particular parts of the code. -
@Zigurana Ah, of course.
In fact, as I was developing it, I was thinking about, if we actually had the metadata for favorites and kids being loaded into the current ES version, that this would very easily handle it - it can probably be added in 15-30 mins, if that much.
Happy to chat!
EDIT:
Actually, thinking about the previous talk we had about breaking down the Kids mode into smaller commits, if you do add the metadata PR, this can handle the filtering easily without you having to implement it again.
This indexes the games at load time, and then at render time, we filter. I implemented a hacky "empty" item, so that it wouldn't crash if there's no match for the filter combination.
The main difference is that this is not system-wide, but more by design (because different systems will have different developers/publishers/etc), but nothing prevents us from filtering system-wide for kids and favorite at render time.
On metadata editing (or, in your case, on setting favorite and kid-friendly), I just remove the game from the index and re-insert it again with the new metadata. That's so I can remove categories from the index that do not match any current game data.
Hope these help.
Edit 2: and yes, I tried to design it in a way that can be easily adapted to whatever metadata architecture we end up pursuing (xml, SQLite or something else). :)
-
How about the ability to Star or Favorite games? That was what a LOT of us have been asking for off and on for a while - it would make those LONG (like 1000+) complete game libraries so much easier to navigate through if our most favorite games could be brought to the top of the list (or something like that). I'm currently stuck using folders...
-
@Dochartaigh Yeah, I was just answering @Zigurana in that direction. He already did the whole work of adding that metadata.
If you use this, for the time being, you can just filter by 5 star ratings, for instance, but I agree - favorites and kid friendly should be a straight application of this, and as I said, it's fairly easy to implement should the metadata be there.
-
@pjft I am testing this out on my linux desktop. I pulled the latest source from your github repository and built it myself. I haven't had a chance to dig in to find the cause, but if I pick a set of filters that would result in no games available, I get a core dump.
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0) Aborted (core dumped)
-
@jdrassa wonderful :)
Thanks for looking into this.
That's interesting, as that exact behavior should be... Explicitly... Coded... For. Hmm.
Unless it just got busted when I refactored the code to move the filtering to FileData!
That may be the case.
I'll try it out later and dig into it. I don't recall testing whether an empty selection still worked after I did the last change.
Thanks! I'll get back to you, no need to waste time tracking it down - unless you do have a proper way to do debugging other than via logs, which is how I'm doing it. If that's the case, if you can track down the exact line where it's crashing it's easier for me, but it still shouldn't be a big deal for me to track down otherwise.
Happy Saturday!
-
@pjft said in ES Filter by Genre, Publisher/Developer, Players and Rating:
@Dochartaigh Yeah, I was just answering @Zigurana in that direction. He already did the whole work of adding that metadata.
If you use this, for the time being, you can just filter by 5 star ratings, for instance, but I agree - favorites and kid friendly should be a straight application of this, and as I said, it's fairly easy to implement should the metadata be there.
it would be cool if there is also some visual indication in the gamelist already as well (recalbox has a star in front of the game name if it's a favorite + moved to the top of the list)
-
@jdrassa Of course, that was the case. Had left some logic in the view that should have moved to FileData.
Should be sorted now - apologies for the trouble, and thank you for catching it!
If you pull the code now it should work now.
@daeks Different feature request :) We don't have favorites yet, but that's a good idea if/when it ends up being implemented, should it be easy.
Sorting shouldn't be hard - the visual component I imagine will need to be done at a theme level. That does not exist at the moment.
Thanks both!
-
@jdrassa FYI, there's a leftover problem from the refactoring where in some occasions the gamelist will reset to the first on the list.
I'll look into it today.
EDIT: and it's fixed now. Should be all sorted! Thanks for testing.
-
Hey @pjft, I know this is an older thread, but I have a question that relates to how the filtering works:
If I select 2 options, eg Racing and Shooting, will that return all games with the Racing genre and all games with the Shooting genre? Or will it return just the games with both the Racing and Shooting genres?
Is it possible to choose how the filtering works? Inclusive or Exclusive? Broad or Explicit? I don't know the best way to phrase it.
-
@mattrixk Hi!
Not at all, glad someone is happy to use this :)
The filtering is:
- UNION/JOIN in the same <category>
- INTERSECT across different <categories>
So, what this means is:
- If you select two different genres, it will show games that match either genre 1 or 2 (as a game can't have more than one genres, so doing it otherwise would always return none :) ).
- If you select two categories (say, genre and players), it will intersect both. So, if you select:
- Developer: Capcom, SNK
- Genre: Fighting
- Players: 2
- Rating: 4, 5
It will filter for Capcom or SNK fighting games for 2 players which have ratings of 4 starts or above.
I hope this helps. I wouldn't think of making this more complex unless there is a clear need/use case for it. The use case here is "you're looking for something that matches a criteria", rather than "everything that matches at least one of the parameters".
But do let me know how it goes!
-
@pjft said
as a game can't have more than one genres
Uhh... so I can't have a gamelist that looks like this:
<game id="goldnaxe"> <path>./goldnaxe.zip</path> <name>Golden Axe</name> <desc>Golden Axe is a sideways scrolling beat-em-up set in a traditional fantasy world.</desc> <image>./media-detailed/goldnaxe-detailed.png</image> <genre>Brawler, Hack-Slash, RPG, 2.5D, Golden-Axe</genre> <players>2</players> </game>
So I can then filter by all Brawlers, or by all Hack-Slash games, or all 2.5D games?
I've spent most of my free time doing that to my Genre tags so I can easily filter exactly what I want. I hope I haven't been wasting my time.
-
@mattrixk Huh.
I'm not really sure that's how these tags are meant to work, but in this case what that'll result will be in an entry for "Brawler, Hack-Slash, RPG, 2.5D, Golden-Axe" :l
The genres usually come from the scraper and are a single entry. It is "genre", not "genres" :/
At least for now that will now work as you expect it to.
Sorry for that.
-
@pjft Darn. Oh well, at least I don't have to do my whole collection that way (it would have taken a while). Cheers for letting me know. I'll have to have a play with it when I get the chance.
-
@mattrixk If your gamelist has the data saved, I'd imagine you could probably have a script turn those genres into a custom collection. So all your 2.5D games would get its own collection, Brawler would be a collection, etc. This isn't a filter, but it would give you just the games you wanted per collection.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.