Skip to content
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

Reworking of how map names are handled #416

Open
Cepheid-UK opened this issue Jul 29, 2021 · 7 comments
Open

Reworking of how map names are handled #416

Cepheid-UK opened this issue Jul 29, 2021 · 7 comments
Labels
Backend Requires work on website-backend enhancement New feature or request good first issue Good for newcomers maps ui

Comments

@Cepheid-UK
Copy link
Member

This is a good standalone project for anyone interested.

Right now, map file names are fed to the website-backend from the matchmaking-service, the website-backend does this before it sends to the frontend:

https://github.com/w3champions/website-backend/blob/237cd0821094d6b0fc289262324fd7cbbd5ab103/W3ChampionsStatisticService/Matches/MapName.cs#L9

Then on the frontend, we apply translations to these strings:

twistedmeadows: "Twisted Meadows",

This can lead to some nasty gore on the frontend before we add the translations, and it also means that updating a map (even very minorly) means duplicate names.

The matchmaking-service has access to the metadata of maps, one field is the actual name of the map in text, e.g. "Twisted Meadows", and we can serve this to website-backend, and then pass on after validation checks to the frontend.

This will require a senior dev to make the relevant change to matchmaking service, but the rest can be handled on the open source repos.

@Cepheid-UK Cepheid-UK added Backend Requires work on website-backend enhancement New feature or request maps ui labels Jul 30, 2021
@Cepheid-UK Cepheid-UK added the good first issue Good for newcomers label Jan 3, 2022
@osagemo
Copy link
Contributor

osagemo commented Apr 10, 2022

This seems to be partially resolved in the following commits:

w3champions/website-backend@fb82177
2863272

So the matchmaking-service has been updated and we get the name & id from the metadata. This has been added to ongoing and finished matches in the backend and the "MatchesGrid" has been updated to use the new map name in the frontend.

I was able to find and update other components reading the mapname from matches in the frontend.

There are remaining statistics components (If I'm not mistaken) reading the map names "the old way", due to map name not being added to the statistics related models:

(VueComponent - Backend Model)

  • MapSelect - MapsPerSeason
  • MapsPerSeasonChart - MapsPerSeason
  • RacetoMapStat - OverallRaceAndWinStats
  • WinratesTab - OverallRaceAndWinStats

Is the intention to update these models the same way (using map name from metadata)? Any considerations with regards to past data? I would need some direction and discussion to tackle this

@zygissss
Copy link

done

@cmavelis
Copy link
Contributor

I'm looking to get back into working on the website and noticed the map name gore on a stats page today. What's the status of this issue? Still some backend work needed for the models?

@osagemo
Copy link
Contributor

osagemo commented Aug 20, 2022

No news from my side.

@Cepheid-UK
Copy link
Member Author

Cepheid-UK commented Aug 22, 2022

I did the investigation on how to fix this once and for all:

Right here is where the name of the map is picked up in website-backend:

image

In the MatchFinishedEvent this looks something like this:

image

The MapName class now does this absolutely disgusting string mutilation:

image

Meanwhile, the MatchFinishedEvent already has the data right here in a much nicer form:

image

Therefore we should do something like:

image

However, a few hiccups.

Firstly, and very easily, the website-backend data model needs to understand and parse this from the response (this line doesnt currently exist):

image

and secondly, and much more of a problem, this mapInfo field looks to be using whatever the game client sends MatchmakingService:

image

As you can see, this is not english:

image

Therefore, we need the Matchmaking service to populate that field with it's saved "rational" name in the database for that map, by referencing it against the mapfile path, and ideally sending the map ID as part of that object.

Here is how the data is saved in the Matchmaking database for a map:

image

@Cepheid-UK
Copy link
Member Author

Cepheid-UK commented Aug 22, 2022

Actually, I just noticed something that could make life a little easier.

  1. The MatchFinishedEvent does actually have the mapId in the object:
    image

  2. We have an website-backend endpoint that has all the map info for the current season maps: https://website-backend.w3champions.com/api/maps/currentseason
    image

Proposed solution:
Have website-backend cache the response from that endpoint, and cross reference the mapId to the name.

Then we add the mapId to the database entries, and get the counts by the ID, and not the Map:

image

@cmavelis
Copy link
Contributor

These ids look to be by season, but we'd want them to be global, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Requires work on website-backend enhancement New feature or request good first issue Good for newcomers maps ui
Projects
None yet
Development

No branches or pull requests

4 participants