benreid24 / Stellaru

Stellaris save data visualization suite
MIT License
88 stars 8 forks source link

Leaderboard Feature Brainstorming #89

Open Akuukis opened 2 years ago

Akuukis commented 2 years ago

Hello,

This tool has a solid foundations and nice UI. I'd love to use it for my next MP play-through, but there's one blocker - cross-empire comparisons. The goal is to have more elaborate "global leaderboard", at least for already public things scattered around Stellaris UI (notably pops & planets), and why not everything. First we played without tools "in the dark" and found it boring because nothing much to compete for or even just talk about (other than wars ofc). Last time we used the stellaris-dashboard and in spite of it's technical struggles it made the game much more transparent and therefore fun. I know some Python and lots of React, and I'm ready to contribute.

Practically it looks like two approaches

Can you please share your thoughts on this?

benreid24 commented 2 years ago

Hey thanks for dropping in! I absolutely love the idea of a leaderboard type view in Stellaru, and of course all help is always welcome!

I think the leaderboard would work nicely as a new tab/screen that all players can view and see the same data. Something like that would be really cool. The ability to customize it would be fantastic as well. The existing chart builder could probably be utilized for that purpose, with some modifications. At the very least a lot of the components can be reused. It's been quite some time since I looked at the code.

I'll give the approach some thought. Feel free to open issues for things that you think of as far as what needs to be done, and of course pull requests are most welcome as well.

Akuukis commented 2 years ago

Thanks! Agree on a new tab/screen with identical content for all players. I did some thinking based on my previous usage and wishes.

Did you think about the technical approach? I'd like to have some guidance about expected architecture and where to start.

General thoughts

Timeseries specific thoughts

Scatter specific thoughts

benreid24 commented 2 years ago

Thanks for the writeup! I think the technical approach will be relatively straightforward. Somewhere on the main screen we can add a button to the leaderboard view. In that view it might be cool to have a section that shows each player who is currently also on that page and which empire they are. I think we can just make the leaderboard a new tab on the main page honestly. Maybe it can be a different color or something to show that it's special.

In the leaderboard view itself we may want to just start with a fixed configuration of some pre-defined charts. Allowing custom charts and custom layouts is possible, but raises the questions of how/if the customizations are synced across each person viewing the leaderboard. Ideally they would be as the point is for each player to have the same view. I imagine we may want a way for the host to prevent other players from messing with the view. I also wonder if we want to sync things like filters on individual charts (clicking the legend) and the time range. To start we can avoid doing any syncing but perhaps should think about it during development.

The charts themselves (at least the pre-defined ones) won't be any different from a React perspective than any existing charts. Each chart would just be a component that takes the data as a prop. They could even be added to the ChartRegistry under a new category, which would allow them to be added to custom dashboards in the existing tool.

For your specific ideas:

  1. Ignoring contact, espionage, etc: This is already done really. It's quite a bit of effort to actually determine who can see/know what from the save data, so full visibility is default
  2. Quick filters for humans, AI, etc: This should be relatively straightforward. The data already includes a flag on each empire that indicates if it is human or AI. I'm not sure if it's possible to extract whether or not an empire is a Fallen Empire from the save data, but I will look into it
  3. Grouping empires in charts: This is a really cool idea. It would require the leaderboard charts to be aware of the groupings and would require some frontend work to allow the groupings to be made. Definitely worth it though. One approach could be to group by federation (maybe optionally include association status) and to allow custom groups in addition.

To start, I'll create some issues to track what exactly needs to be done for now, and I'll get started on making the new tab and getting the framework in place for supporting grouping. Once that's done then we're good to start making charts and working on sync features and can work in parallel. I'll ping you with a pull request once I'm ready so we're on the same page. We can use this ticket to brainstorm and can make new ones for things to do. I created a project to group all the tickets for the leaderboard development. I don't know if you can move tickets that you create to the project or not.

benreid24 commented 2 years ago

https://github.com/benreid24/Stellaru/projects/5 is populated with some tickets representing what I think is required to implement this. I will have a pull request soon for supporting the grouping of empires in the frontend so that we can do these graphs either individually, by federation, or by custom groups.

I didn't think of it at first, but the data sent to the frontend will have to be enhanced with data from other empires for the leaderboard charts. Once I have the frontend framework completed and the data format updated then I think we can start to work in parallel.

benreid24 commented 2 years ago

101 is created with a bunch of changes. I created a React context in the frontend and an empty tab. In the backend I added all the data that I think we'll need, at least for now. Next up is to build some helpers for extracting grouped data, then the charts can be built

benreid24 commented 2 years ago

I think we're at the point of being able to parallelize now. I've added a bunch of new data to what is sent to the frontend and built out the framework for the leaderboard data. I also built an example chart for testing that you can take a look at to see how it works: https://github.com/benreid24/Stellaru/blob/master/frontend/src/Monitor/Leaderboard/Charts/TestChart.tsx

To see the format of the data sent back I would honestly just recommend logging it to the console and exploring it there. You can also look through the backend code, but it's a bit fragmented.

Next I'm going to start thinking about/working on building out the ability to filter by empire type. I created a bunch of issues in the leaderboard project for the charts we want to build: https://github.com/benreid24/Stellaru/projects/5 Feel free to pick up anything that looks fun.

Akuukis commented 2 years ago

Sounds great!

This week was busy for me, but I'm available to jump in during during next week. Our next play-through will be at next weekend, so need to get ready :)